|
Henry, I've haven't seen much action on this bug (http://www.openlaszlo.org/jira/browse/LPP-2074) for a while, so I thought I'd take a look again. I dove deep, deep, deep into the Java this time, and I found the reason for the behavior we are seeing, and a couple of possible fixes. I still haven't been approved by my boss to be an OpenLaszlo contributor, and I'd really like this issue fixed, so I'll refrain from showing any of my code that would fix it, but it shouldn't hurt if describe the problem in detail. In the file ImportCompiler.java, in the method "compileLibrary" there is the following line: CompilationEnvironment env = new CompilationEnvironment(mEnv); Looking at this you might think that you would get back a new environment with exactly the same properties as the original mEnv. This is not precisely the case. Inside the constructor in CompilationEnvironment.java, there is the following line: this.mProperties = new Properties(srcEnv.getProperties()); You might think that this would create a new Properties object with the same settings as srcEnv. This is not what happens. If you look at the documentation at http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html, you will see that Properties(Properties defaults) Creates an empty property list with the specified defaults. This is kind of like copying the properties. Back in compileLibrary in ImportCompiler.java if you call either: mEnv.getProperties().getProperty("debug") or env.getProperties().getProperty("debug") both will return true. But in the case of mEnv, it is actually a property that is being checked. In the case of the copy, env, it is failing to find the property (since as per documentation the property list is empty) and is finding it in the defaults section. This would not cause any problems, except for the way the script complier is written. Instead of using a Properties object, it uses an OptionMap, and when it builds the OptionMap from the Properties, it doesn't take defaults into account. See the method setProperties in the file Compiler.java in the sc folder. Obviously you could fix this in either the CompilationEnvironment constructor or in the script compiler. I don't know the code well enough to know if the behavior of the Properties object when a CompilationEnvironment is constructed was intentional or accidental, and what the side effects (if any) of any of these changes might be. If at all possible I would like to see the options passed down to the import libraries, ideally in the 3.4 release. Thanks for your time, -Jason Henry Minsky wrote: I will take a look. I'm filing a bug placeholder at http://www.openlaszlo.org/jira/browse/LPP-2074 -- Jason Stafford Principal Developer Inspiration Software, Inc. The leader in visual thinking & learning InspireData(tm), the newest innovative thinking and learning tool from Inspiration Software(r), extends the proven power of visual learning to data analysis. Learn more at www.inspiration.com. 503-297-3004 Extension 119 503-297-4676 (Fax) 9400 SW Beaverton-Hillsdale Highway Suite 300 Beaverton, OR 97005-3300 |
_______________________________________________ Laszlo-dev mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
