Recently, I've noticed that the output of asjsc is not always identical. Sometimes, it will incorrectly add a goog.require() for a class that is in the external library path. Not always, though.
Here's some simplified example output (comment added for emphasis): goog.provide('feathers.core.FeathersControl'); goog.require('createjs.Container'); //this should not be here /** * Constructor. * @constructor * @extends {createjs.Container} */ feathers.core.FeathersControl = function() { }; Here's what I've discovered so far: 1) In org.apache.flex.compiler.internal.projects.FlexJSProject, on line 170, the call to linkageChecker.isExternal(cu) inside the isExternalLinkage() method sometimes returns false for createjs.Container. It should always return true. 2) Earlier in the same method, the linkageChecker is created, if it is null: if (linkageChecker == null) { ts = getTargetSettings(); linkageChecker = new LinkageChecker(this, ts); } I tried to add System.out.println() calls before and after the LinkageChecker instance is created: if (linkageChecker == null) { ts = getTargetSettings(); System.out.println("Creating new LinkageChecker"); linkageChecker = new LinkageChecker(this, ts); System.out.println("Created LinkageChecker"); } This is my output when the issue reproduces: Creating new LinkageChecker Creating new LinkageChecker Created LinkageChecker Created LinkageChecker When it works correctly, only one LinkageChecker instance is created: Creating new LinkageChecker Created LinkageChecker It appears that isExternalLinkage() may get called again before the linkageChecker variable is set. I don't see anything in the LinkageChecker constructor that might cause that. It's just setting a couple of member variables. Is the compiler using more than one thread? Could different threads be calling isExternalLinkage(), and am I seeing a race condition? - Josh