开发者

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开发者_StackOverflow社区'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.


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


you are only allowed one class definition per actionscript file, otherwise you have to use the internal keyword so it should be private internal class Enforcer()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜