Hmm.  The one you sent is the same as the one I have.  Maybe I dreamt
about what I saw earlier.  Let's go back to verifying how the code works.
In MXMLFlexJSEmitter.java in postProcess(), there is a code block like
this:

for (String usedName :usedNames) {
  if (!foundRequires.contains(usedName)) {
    if (usedName.equals(classDefinition.getQualifiedName())) continue;
    if (((JSFlexJSEmitter)
asEmitter).getModel().isInternalClass(usedName)) continue;
    if (subDocumentNames.contains(usedName)) continue;
    if (flexJSProject != null &&
flexJSProject.isExternalLinkage(flexJSProject.resolveQNameToCompilationUnit
(usedName)))
      continue;
    namesToAdd.add(usedName);
  }
                    }

For me, when usedName is XML, I end up calling isExternalLinkage and it
returns false and thus namesToAdd ends up with XML in it.  See if you can
add more System.out calls to determine if isExternalLinkage is getting
called for XML and returning true.


Then the puzzle is to see why isExternalLinkage returns true.  There is a
special case in isExternalLinkage in FlexJSProject.java.  There is code
that looks like this:

List<String> qnames;
        try {
  qnames = cu.getQualifiedNames();
  String qname = qnames.get(0);
  if (qname.equals("QName"))
    return false;

For me, the cu for XML contains QName, XML and XMLList and QName is first
so this test returns false.  I thought I saw a case where a
playerglobal.swc had a different set of classes in the cu for XML.  Maybe
in your case, XML is being defined in some other cu.  You can output
cu.getAbsoluteFilename().

We could just change the test to test if qnames.contains("XML"), but that
is potentially a lot slower.  We should verify exactly what is going on
before making such a change.

Thanks,
-Alex 

Reply via email to