royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Rovira <carlosrov...@apache.org>
Subject Re: Possible compiler error
Date Tue, 28 Aug 2018 15:57:12 GMT
Hi,
thanks for the responses, but maybe I didn't express right. I mean the
superclass signature is in ListView

protected function selectionChangeHandler(event:Event):void

and I want to change it to have default "= null":

protected function selectionChangeHandler(event:Event = null):void

then child class (TableView) will need to be like the following override:

override protected function selectionChangeHandler(event:Event = null):void

this throws:

/Users/carlosrovira/Dev/Royale/Source/royale-asjs/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/TableView.as(99):
col: 31 Error: Incompatible override.

        override protected function selectionChangeHandler(event:Event =
null):void
         ^

/Users/carlosrovira/Dev/Royale/Source/royale-asjs/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/TableView.as(99):
col: 31 Incompatible override.

        override protected function selectionChangeHandler(event:Event =
null):void

If like Harbs said is an AS3 restriction is ok for me, in fact I don't need
it now, since I took other path to make what I want.
If is a compiler bug then we must to write an issue.




El mar., 28 ago. 2018 a las 13:03, Olaf Krueger (<mail@olafkrueger.net>)
escribió:

> Hi Carlos,
> as Harbs mentioned, my experience is also, that implemented interface
> methods or overridden methods always has to be implemented with the entire
> same signature, including optional (default parameters) and required
> parameters.
>
> From the AS3 docs regarding interfaces [1]:
> "You also have some flexibility with default parameter values. An interface
> definition can include function declarations with default parameter values.
> A method that implements such a function declaration must have a default
> parameter value that is a member of the same data type as the value
> specified in the interface definition, but the actual value does not have
> to
> match"
>
> Why do you think that this doesn't make sense?
>
> Olaf
>
> [1]
>
> https://help.adobe.com/en_US/as3/learn/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f41.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7f20
>
>
>
>
> --
> Sent from: http://apache-royale-development.20373.n8.nabble.com/
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
> <http://apache-royale-development.20373.n8.nabble.com/>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message