Does anyone know a better solution to this? For some reason, static getters and setters weren't being called properly in a release build with ADVANCED_OPTIMIZATIONS. We included @export for the static properties, which seems to work fine for non-static getters and setters. However, for static getters and setters, Closure compiler was collapsing the property down to a global variable instead. I switched back to @expose, and it started working properly.
The problem is that @expose is deprecated by Closure compiler. Obviously, I'd prefer not to use it, but I can't seem to find a working alternative. According to the docs [1], @nocollapse is supposed to stop a property from being collapsed into a variable. I tried replacing @export with @nocollapse, and I tried using both @export and @nocollapse, but it just didn't seem to work. [1] https://developers.google.com/closure/compiler/docs/js-for-compiler - Josh On Sat, May 28, 2016 at 2:08 PM, <joshtynj...@apache.org> wrote: > Repository: flex-falcon > Updated Branches: > refs/heads/develop b3708662c -> fc4e3af9f > > > compiler-jx: static getters and setters use @expose instead of @export > because @export does not work in the release build with > ADVANCED_OPTIMIZATIONS > > > Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo > Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/fc4e3af9 > Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/fc4e3af9 > Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/fc4e3af9 > > Branch: refs/heads/develop > Commit: fc4e3af9f772ab586a75950afce9cc284878c3ff > Parents: b370866 > Author: Josh Tynjala <joshtynj...@gmail.com> > Authored: Sat May 28 14:08:08 2016 -0700 > Committer: Josh Tynjala <joshtynj...@gmail.com> > Committed: Sat May 28 14:08:08 2016 -0700 > > ---------------------------------------------------------------------- > .../flex/compiler/internal/codegen/js/jx/AccessorEmitter.java | 6 +++++- > .../internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java | 4 ++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > ---------------------------------------------------------------------- > > > > http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc4e3af9/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java > ---------------------------------------------------------------------- > diff --git > a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java > b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java > index 7440462..5e7aa50 100644 > --- > a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java > +++ > b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java > @@ -340,7 +340,11 @@ public class AccessorEmitter extends JSSubEmitter > implements > propName); > IGetterNode getterNode = p.getter; > ISetterNode setterNode = p.setter; > - writeNewline("/** @export */"); > + // @expose is supposed to be deprecated, so this isn't > ideal, > + // but @export and/or @nocollapse were not working in a > release > + // build with ADVANCED_OPTIMIZATIONS, so I don't know > what else > + // to do. maybe it's a bug in closure compiler... -JT > + writeNewline("/** @expose */"); > if (getterNode != null) > { > startMapping(getterNode); > > > http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc4e3af9/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java > ---------------------------------------------------------------------- > diff --git > a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java > b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java > index 58769fe..b00d31e 100644 > --- > a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java > +++ > b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java > @@ -86,7 +86,7 @@ public class TestFlexJSAccessorMembers extends > TestGoogAccessorMembers > IClassNode node = (IClassNode) getNode("public static function get > foo():int{return -1;}", > IClassNode.class, WRAP_LEVEL_CLASS); > asBlockWalker.visitClass(node); > - assertOut("/**\n * @constructor\n */\nFalconTest_A = function() > {\n};Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ > {\n/** @export */\nfoo: {\nget: function() {\n return -1;\n}}}\n);"); > + assertOut("/**\n * @constructor\n */\nFalconTest_A = function() > {\n};Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ > {\n/** @expose */\nfoo: {\nget: function() {\n return -1;\n}}}\n);"); > } > > @Override > @@ -136,7 +136,7 @@ public class TestFlexJSAccessorMembers extends > TestGoogAccessorMembers > IClassNode node = (IClassNode) getNode("public static function set > foo(value:int):void{}", > IClassNode.class, WRAP_LEVEL_CLASS); > asBlockWalker.visitClass(node); > - assertOut("/**\n * @constructor\n */\nFalconTest_A = function() > {\n};Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ > {\n/** @export */\nfoo: {\nset: function(value) {\n}}}\n);"); > + assertOut("/**\n * @constructor\n */\nFalconTest_A = function() > {\n};Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ > {\n/** @expose */\nfoo: {\nset: function(value) {\n}}}\n);"); > } > > @Test > >