flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Dufilie (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLEX-34993) implicit super() constructor call receives subclass constructor params
Date Fri, 11 Dec 2015 21:57:46 GMT
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)

Mime
View raw message