Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
Apache FlexJS 0.5.0
-
None
Description
AS input (2 files):
package foo.bar { public class MySuperClass { public function MySuperClass(superParam1:String = "Hello", superParam2:String = "World") { this.superString = superParam1 + superParam2; } public var superString:String; } } package foo.bar { public class MyExtendingClass extends MySuperClass { public function MyExtendingClass(extendingParam:String) { this.myExtendingString = extendingParam; } public var myExtendingString:String; } }
JS output (relevant part only):
/** * @constructor * @extends {foo.bar.MySuperClass} * @param {string} extendingParam */ foo.bar.MyExtendingClass = function(extendingParam) { foo.bar.MyExtendingClass.base(this, 'constructor', extendingParam); this.myExtendingString = extendingParam; }; goog.inherits(foo.bar.MyExtendingClass, foo.bar.MySuperClass);
The correct behavior would be to implicitly call the default constructor (no params):
foo.bar.MyExtendingClass.base(this, 'constructor');
The current workaround is to explicitly call super() with no params in the subclass.