Mon 16 May 2011 04:44:15 PM UTC, original submission:
I'd like to suggest the following patch to allow one to make
setting INDIRECT_DEFINES the default for new InheritingEnvironments.
It simply adds a static flag to gnu.mapping.InheritingEnvironment
to specify that setIndirectDefines be called in the constructor.
The rationale is that setting INDIRECT_DEFINES can only safely be
done at the time the environment is created. Attempting to set this
flag later, in application code, can put the environment into an
inconsistent state (because of the way Kawa uses timestamps for
SharedLocations). For implicitly created environments (e.g. in futures),
the constructor is the safe place to do this.
I don't think I've thoroughly understood how Kawa uses these timestamps
for lookups, but this change takes care of a problem where symbol
lookups were failing in some circumstances where setIndirectDefines is
called too late.
Index: gnu/mapping/ChangeLog
===================================================================
--- gnu/mapping/ChangeLog (revision 6981)
+++ gnu/mapping/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2011-05-16 thomas kirk <tk@research.att.com>
+
+ * InheritingEnvironment.java (DEFAULT_INDIRECT_DEFINES): New flag.
+ (constructor): call setIndirectDefines upon creation of environment
+ if DEFAULT_INDIRECT_DEFINES is true.
+
2011-04-25 Charles Turner <chturne@gmail.com>
Per Bothner <per@bothner.com>
Index: gnu/mapping/InheritingEnvironment.java
===================================================================
--- gnu/mapping/InheritingEnvironment.java (revision 6981)
+++ gnu/mapping/InheritingEnvironment.java (working copy)
@@ -9,6 +9,10 @@
Environment[] inherited;
int baseTimestamp;
+ /* true if newly created InheritingEnvironments should
+ set INDIRECT_DEFINES by default */
+ public static boolean DEFAULT_INDIRECT_DEFINES = false;
+
public InheritingEnvironment (String name, Environment parent)
{
super(name);
@@ -19,6 +23,9 @@
baseTimestamp = timestamp;
currentTimestamp = timestamp;
}
+
+ if (DEFAULT_INDIRECT_DEFINES)
+ setIndirectDefines();
}
public final int getNumParents () { return numInherited; }
|