You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Andy Dufilie (JIRA)" <ji...@apache.org> on 2015/12/11 22:57:46 UTC
[jira] [Created] (FLEX-34993) implicit super() constructor call
receives subclass constructor params
Andy Dufilie created FLEX-34993:
-----------------------------------
Summary: implicit super() constructor call receives subclass constructor params
Key: FLEX-34993
URL: https://issues.apache.org/jira/browse/FLEX-34993
Project: Apache Flex
Issue Type: Bug
Components: Falcon, FlexJS
Affects Versions: Apache FlexJS 0.5.0
Reporter: Andy Dufilie
Priority: Minor
AS input (2 files):
{code}
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;
}
}
{code}
JS output (relevant part only):
{code}
/**
* @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);
{code}
The correct behavior would be to implicitly call the default constructor (no params):
{code}
foo.bar.MyExtendingClass.base(this, 'constructor');
{code}
The current workaround is to explicitly call super() with no params in the subclass.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)