[xcore/OCL] Error in auto generated code [message #898488] |
Thu, 26 July 2012 13:22 |
Wouter Schaekers Messages: 17 Registered: July 2012 |
Junior Member |
|
|
Hi
Example:
class Rule
{
Integer num
@Pivot(derivation="self.num > 3")
derived Boolean b
}
Problem: This gives me an error in the auto generated code. In the src-gen folder, Project.impl package, RuleImpl.java class:
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case Test2Package.RULE__NAME:
setName(NAME_EDEFAULT);
return;
case Test2Package.RULE__NUM:
setNum(NUM_EDEFAULT);
return;
case Test2Package.RULE__B:
setB(B_EDEFAULT);
return;
}
super.eUnset(featureID);
}
'setB(B_EDEFAULT);' gives an error: 'B_EDEFAULT cannot be resolved to a variable'
This is solved by creating a field in the generated class. Is there any way to solve this without manually fix things?
Thanks.
[Updated on: Thu, 26 July 2012 13:23] Report message to a moderator
|
|
|
|
|
Re: [xcore/OCL] Error in auto generated code [message #898506 is a reply to message #898493] |
Thu, 26 July 2012 13:50 |
Wouter Schaekers Messages: 17 Registered: July 2012 |
Junior Member |
|
|
Ed Willink wrote on Thu, 26 July 2012 09:30Interesting; I had no idea that OCL could be used in this way with Xcore.
Everything that I tried to do with OCL in Xtext can be done in Xcore (or at least the things I tried).
Ed Willink wrote on Thu, 26 July 2012 09:30At another it's rather stupid.
Xcore provides a nice Xtext editor for Java implementations of Ecore
features; use Java with Xcore.
If you want to use OCL, use the OCLinEcore Xtext editor so that you get
syntax checking on the OCL.
That's not what we want to do. We want to develop a DSL, that in the end will be parsed outside of all the Xcore/Xtext tools (So, write a parser ourselves that converts our model/constrains to C++ code.). Xcore is preferred over Xtext, because it's more abstract and less dependent on a lot of stuff. And for the same reason, we think that OCL is preferred over Java.
Ed Willink wrote on Thu, 26 July 2012 09:30You're particular problem is that you need to specify that 'b' is
transient and volatile.
'derived transient volatile Boolean b' doesn't work (the same problem). It's just a minor problem. It would be nice if it can be fixed, but it's not that big a deal.
[Updated on: Thu, 26 July 2012 13:50] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03496 seconds