|
|
Re: [Xcore] calling super method from overridden method [message #1576590 is a reply to message #1574726] |
Wed, 21 January 2015 11:55 |
Stefan Winkler Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Hi Ed,
thanks. Currently, I'll have to stick with an older version of Xcore,
because my customer's development and target platforms are currently
still based on Kepler. Maybe I'll get back to this, when we have updated
the platform.
I just wanted to make sure that I don't use the wrong syntax.
Thanks,
Stefan
Am 20.01.15 um 12:45 schrieb Ed Merks:
> Stefan,
>
> I know I've fixed bugs before with resolving "super" and it worked at
> that time. But perhaps changes in the base framework have crept in to
> break that again.
>
> If the problem is reproducible with updates from
> http://download.eclipse.org/modeling/emf/emf/updates/2.10.x
> <http://download.eclipse.org/modeling/emf/emf/updates/2.10.x/core/R201409011055>
> please open a bugzilla with the test case.
>
>
> On 20/01/2015 11:41 AM, Stefan Winkler wrote:
>> Hi all,
>>
>> I have the following declarations in Xcore:
>>
>> ---8<---
>>
>> class ValueBase { ... }
>>
>> class ValueArray extends ValueBase
>> {
>> int size
>> double [] values
>> String valueUnit
>>
>> op boolean isValueEqual(Value v)
>> {
>> if (!(v instanceof IValueArray))
>> {
>> return false
>> }
>> val other = v as IValueArray;
>> return Iterables.elementsEqual(this.values, other.values);
>> }
>>
>> op boolean equals(Value v)
>> {
>> return super.equals(v) && isValueEqual(v) &&
>> (v instanceof IValueArray) &&
>> Objects.equals(valueUnit, (v as IValueArray).valueUnit)
>> }
>> }
>>
>> ---8<---
>>
>> ValueBase implements its own equals() method. In the concrete class
>> ValueArray, I want to call super.equals() to compare the base class'
>> common fields and then do comparisons specific to the concrete class.
>>
>> But Xcore complains about that code that it "Couldn't resolve reference
>> to JvmIdentifiableElement super".
>>
>> How can I call the equals()-method from the super class?
>>
>> Best,
>> Stefan
>
|
|
|
Powered by
FUDForum. Page generated in 0.03524 seconds