Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Xcore] calling super method from overridden method
[Xcore] calling super method from overridden method [message #1574644] Tue, 20 January 2015 10:41 Go to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
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
Re: [Xcore] calling super method from overridden method [message #1574726 is a reply to message #1574644] Tue, 20 January 2015 11:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30135
Registered: July 2009
Senior Member
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
Re: [Xcore] calling super method from overridden method [message #1576590 is a reply to message #1574726] Wed, 21 January 2015 11:55 Go to previous message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 301
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
>
Previous Topic:Warning sign
Next Topic:ViewerRefresh.refresh(IViewerNotification notification)
Goto Forum:
  


Current Time: Fri May 24 23:28:47 GMT 2019

Powered by FUDForum. Page generated in 0.01958 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top