Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Extend EcoreEnvironment locally
Extend EcoreEnvironment locally [message #917816] Thu, 20 September 2012 13:04 Go to next message
Eclipse UserFriend
Hello,

there is an opportunity to extend the EcoreEnvironment by using for
example the "defineOperation" method. I did this for example to extend
the OCLEnvironment by the operation "getValue()" of a EFeatureMapEntry.

But when I tried to evaluate this operation I got a NullPointerException
caused by line 227 in the class EcoreEvaluationEnvironment.
I think this occurrs because of a mistake in line 206.

When an operation is added to the Environment a so called "ShadowClass"
with the added EOperation will be created. But in the shadow class no
information about the correct InstanceClass is stored.

To get this information I changed line 206 to:
EClassifier container = OCLStandardLibraryImpl.getOwner(operation);

Am I right, is this a mistake?

Best regards,

Lilija Klassen
Re: Extend EcoreEnvironment locally [message #918056 is a reply to message #917816] Thu, 20 September 2012 17:43 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You give no clue about which version you use.

For me line 206 is a blank line.

Regards

Ed Willink



On 20/09/2012 14:04, Lilija Klassen wrote:
> Hello,
>
> there is an opportunity to extend the EcoreEnvironment by using for
> example the "defineOperation" method. I did this for example to extend
> the OCLEnvironment by the operation "getValue()" of a EFeatureMapEntry.
>
> But when I tried to evaluate this operation I got a
> NullPointerException caused by line 227 in the class
> EcoreEvaluationEnvironment.
> I think this occurrs because of a mistake in line 206.
>
> When an operation is added to the Environment a so called
> "ShadowClass" with the added EOperation will be created. But in the
> shadow class no information about the correct InstanceClass is stored.
>
> To get this information I changed line 206 to:
> EClassifier container = OCLStandardLibraryImpl.getOwner(operation);
>
> Am I right, is this a mistake?
>
> Best regards,
>
> Lilija Klassen
>
Re: Extend EcoreEnvironment locally [message #918635 is a reply to message #918056] Fri, 21 September 2012 07:32 Go to previous messageGo to next message
Eclipse UserFriend
Hey,

Oh yes, sorry for that I use version 3.1.0, but its also the same line
in version 3.2.0.

class EcoreEvaluationEnvironment, method getJavaMethodFor,
line 206: EClass container = operation.getEContainingClass();

Regards

Lilija Klassen


Am 20.09.2012 19:43, schrieb Ed Willink:
> Hi
>
> You give no clue about which version you use.
>
> For me line 206 is a blank line.
>
> Regards
>
> Ed Willink
>
>
>
> On 20/09/2012 14:04, Lilija Klassen wrote:
>> Hello,
>>
>> there is an opportunity to extend the EcoreEnvironment by using for
>> example the "defineOperation" method. I did this for example to extend
>> the OCLEnvironment by the operation "getValue()" of a EFeatureMapEntry.
>>
>> But when I tried to evaluate this operation I got a
>> NullPointerException caused by line 227 in the class
>> EcoreEvaluationEnvironment.
>> I think this occurrs because of a mistake in line 206.
>>
>> When an operation is added to the Environment a so called
>> "ShadowClass" with the added EOperation will be created. But in the
>> shadow class no information about the correct InstanceClass is stored.
>>
>> To get this information I changed line 206 to:
>> EClassifier container = OCLStandardLibraryImpl.getOwner(operation);
>>
>> Am I right, is this a mistake?
>>
>> Best regards,
>>
>> Lilija Klassen
>>
>
Re: Extend EcoreEnvironment locally [message #918863 is a reply to message #917816] Fri, 21 September 2012 12:19 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

ShadowClasses are a necessary evil when using an underlying meta-model
representation that does not allow DataTypes to have Operations. (The
Pivot model for new Eclipse OCL code does not have this restriction.)

The existing tests of defineOperation seem to ge only for Classes.

Your (remarkably obvious) example for an EDataType fails as you observe.

Your change seems to do no damage (apart from a small execution cost) so
I've raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=390094 to
incorporate it.

Thanks.

Regards

Ed Willink


On 20/09/2012 14:04, Lilija Klassen wrote:
> Hello,
>
> there is an opportunity to extend the EcoreEnvironment by using for
> example the "defineOperation" method. I did this for example to extend
> the OCLEnvironment by the operation "getValue()" of a EFeatureMapEntry.
>
> But when I tried to evaluate this operation I got a
> NullPointerException caused by line 227 in the class
> EcoreEvaluationEnvironment.
> I think this occurrs because of a mistake in line 206.
>
> When an operation is added to the Environment a so called
> "ShadowClass" with the added EOperation will be created. But in the
> shadow class no information about the correct InstanceClass is stored.
>
> To get this information I changed line 206 to:
> EClassifier container = OCLStandardLibraryImpl.getOwner(operation);
>
> Am I right, is this a mistake?
>
> Best regards,
>
> Lilija Klassen
>
Previous Topic:how to concatenate each element of first sequence with every other element of the second sequence
Next Topic:Changing OCLinEcore editor code formatting
Goto Forum:
  


Current Time: Wed Apr 24 20:21:52 GMT 2024

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

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

Back to the top