Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
Apache FlexJS 0.5.0
-
None
Description
In the example below, notice that the InternalClass output does not include FLEXJS_CLASS_INFO, so the "as" operator in testFunction() will return null and iti.test() will crash.
AS input:
package foo.bar { public class TestMissingFlexClassInfo { public function testFunction():void { var iti:ITestInterface = new InternalClass() as ITestInterface; iti.test(); } } } import foo.bar.ITestInterface; internal class InternalClass implements ITestInterface { public function test():void { } }
JS output:
/** * Generated by Apache Flex Cross-Compiler from foo\bar\TestMissingFlexClassInfo.as * foo.bar.TestMissingFlexClassInfo * * @fileoverview * * @suppress {checkTypes} */ goog.provide('foo.bar.TestMissingFlexClassInfo'); goog.require('foo.bar.ITestInterface'); /** * @constructor */ foo.bar.TestMissingFlexClassInfo = function() { }; /** * @export */ foo.bar.TestMissingFlexClassInfo.prototype.testFunction = function() { var /** @type {foo.bar.ITestInterface} */ iti = org.apache.flex.utils.Language.as(new InternalClass(), foo.bar.ITestInterface); iti.test(); }; /** * Metadata * * @type {Object.<string, Array.<Object>>} */ foo.bar.TestMissingFlexClassInfo.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'TestMissingFlexClassInfo', qName: 'foo.bar.TestMissingFlexClassInfo'}] }; /** * @constructor * @implements {foo.bar.ITestInterface} */ InternalClass = function() { }; /** * @export */ InternalClass.prototype.test = function() { };