|
Re: Problem with Xtext based OCL and accessing inherited properties [message #799255 is a reply to message #799075] |
Wed, 15 February 2012 11:58  |
Eclipse User |
|
|
|
Hi Filip
Sorry; it's a bug in the Indigo Pivot release; lookups of secondary
bases fails.
Works fine in the Juno M5 release.
Regards
Ed Willink
On 15/02/2012 12:14, Filip Krikava wrote:
> Hi,
>
> I found a weird behavior with the Xtext based OCL editors (including
> console) related to properties inherited from multiple classes:
>
> I made this model example of 4 classes A,B,C and D to demonstrate:
>
>
> module _'My.ecore'
> package my : my = 'http://my.me/'
> {
> class A
> {
> attribute name : String[1] { ordered };
> }
> class B
> {
> attribute type : String[1] { ordered };
> }
> class C extends B, A
> {
> attribute required : Boolean[1] { ordered };
> }
> class D
> {
> attribute main : Boolean[1] { ordered };
>
> invariant myinv:
> main implies property.name <> '' and property.type <> '';
> property property : C[1] { ordered };
>
> }
> }
>
>
> I got an error in the editor: unresolved property 'name' for
> 'My.ecore::my::C', but there is a property 'name' in type C it is
> inherited from A. The other inherited property 'type' works just fine.
>
> The same happens if I try to use the Xtext OCL console from the
> context D: self.property.name:
>
> My.xmi:
>
> <?xml version="1.0" encoding="ASCII"?>
> <my:D xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:my="http://my.me/" xsi:schemaLocation="http://my.me/ My.ecore">
> <property type="Type1" name="Name1"/>
> </my:D>
>
>
> Evaluating:
> self
> Results:
> D false
>
> Evaluating:
> self.property.name
> Results:
> Parsing failure
> null
> Unresolved property 'name' for 'My.ecore::my::C'
>
> Evaluating:
> self.property.type
> Results:
> 'Type1'
>
>
> On the other hand from the old OCL console it works fine:
>
>
> Evaluating:
> self
> Results:
> D false
>
> Evaluating:
> self.property.name
> Results:
> 'Name1'
>
> Evaluating:
> self.property.type
> Results:
> 'Type1'
>
>
> What is interesting that if I change the inheritance order of the
> class C to:
>
> class C extends A, B
>
> It will work file - both properties ('name' and 'type') are resolved
> just fine.
> I don't know if it is a bug or I'm missing something?
>
> Thanks
> Filip
|
|
|
Powered by
FUDForum. Page generated in 0.03430 seconds