Search code examples
apache-flexactionscript-3parsley

Flex / Parsley - Internal class quirk with compile mode


This is a puzzler.

Relevant Environment: Flex app, running parsley, which gets built by ant.

Problem class:

package com.foo.bar {
    public class ProblemClass {
        // constructor
        public ProblemClass(enforcer:Enforcer) {}

        public static function build():ProblemClass  {
            // Do some setup
            return new ProblemClass(new Enforcer())
    }
}
// internal private class
class Enforcer() {}

Elsewhere, in a seperate class (which gets defined in a Parsley context):

package com.foo.bar {
    public class ProblemClassBuilder {
        [Factory]
        public function getProblem():ProblemClass {
            return ProblemClass.build();
        }
      }
}

Here's the kicker: When I compile this from an ant task with debug="true", it works fine. When I compile it with debug="false", parsley throws an error while building the context:

Error applying [object FactoryMethodDecorator]: Error #1065: Variable Enforcer is not defined.

No other code changes, except turning debug on / off in the mxmlc ant task.

Has anyone seen similar problems with internal classes & ant debug compile modes?

I've been able to fix the issue, (by removing the internal class), but don't understand why it didn't work in the first place.


Solution

  • Sounds like a bug in the compiler... I'd file it at bugs.adobe.com