[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[henshin-dev] Optional EJavaClass Attribute in HenshinTGG
|
Dear Henshin(TGG) developers,
I have a problem in HenshinTGG with an optional (i.e. a cardinality of
0..1) attribute of the type EJavaClass<T>.
The core question is:
How do I match an empty attribute in HenshinTGG? I.e. the value that is
entered when I use the „Restore Default Value“ button in the properties
view on an attribute in a „Sample Reflective Ecore Editor“.
Please let me explain my situation.
I have a meta model for my source model:
Classes:
DataType,
Operation
References:
ownedOperations: DataType -> Operation,
appReturnType: Operation -> DataType
Attributes:
javaReturnType: Operation
I expect Operations to *either* have an appReturnType, or a
javaReturnType. Having both is semantically forbidden.
So I make 2 Transformations. The first one is FW_Operation2SomethingElse:
from
:DataType ++-ownedOperations-> ++[1]:Operation(attr: javaReturnType=jrt)
to
something else
With a NAC No_AppReturnType:
[1]:Operation -appReturnType-> :DataModel
The second one is FW_Operation2SomethingElse_With_AppReturnType:
from
:DataType ++-ownedOperations-> ++:Operation(attr: *no attributes*)
-appReturnType-> :DataType
to
something else
When I execute the FW-Rules on my model I have the following problem.
javaReturnType may be: correct, incorrect, non-existent
appReturnType may be: set, non-existent
1. If I have an operation with a correct javaReturnType (e.g. „int“) an no
appReturnType it is correctly translated.
2. If I have an operation with a correct javaReturnType and an
appReturnType (which is semantically not correct), it is (syntactically)
correctly translated.
3. If I have an operation with an invalid javaReturnType (e.g. „null“ or
„thisShouldReallyBeEmpty“) (this is also semantically not correct), I get
an exception, because the engine tries to set the value in a EJavaClass
attribtue in the target model and cannot (ecore does not allow to set such
values):
org.eclipse.emf.common.util.WrappedException:
java.lang.ClassNotFoundException: null cannot be found by
org.eclipse.emf.ecore_2.9.1.v20130827-0309
at
org.eclipse.emf.ecore.impl.EcoreFactoryImpl.createEJavaClassFromString(Ecor
eFactoryImpl.java:906)
at
org.eclipse.emf.ecore.impl.EcoreFactoryImpl.createFromString(EcoreFactoryIm
pl.java:146)
at
org.eclipse.emf.ecore.util.EcoreUtil.createFromString(EcoreUtil.java:3352)
at
de.tub.tfs.henshin.tggeditor.util.TggHenshinEGraph.henshin2emfGraph(TggHens
hinEGraph.java:107)
[…]
4. If I have an operation with no javaReturnType I get an exception, which
I usually get when a rule checks for an attribute that is not set
(graphNode is null in line 298):
java.lang.NullPointerException
at
de.tub.tfs.henshin.tggeditor.util.RuleUtil.checkAttributeMarker(RuleUtil.ja
va:298)
at
de.tub.tfs.henshin.tggeditor.commands.OpRuleAttributeConstraint.check(OpRul
eAttributeConstraint.java:66)
[…]
I just made a table up for these cases as an overview:
javaReturnType appReturnType Result
correct non-existent correct transformation
correct set correct transformation but semantically forbidden
incorrect * incorrect transformation: javaReturnType is not set on the
other side due to exception
non-existent * incorrect transformation: exception due to non-existent
attribute
All in all I find no possibility to do a correct transformation for the
case that I have an appReturnType in my operation. The problem here is,
that I seem to cannot set any empty javaReturnType.
Thanks for your patience and best regards
Marco
--
Marco Konersmann, né Müller
Research Associate
paluno - The Ruhr Institute for Software Technology
University of Duisburg-Essen * Gerlingstraße 16 * 45127 Essen * Germany
* callto:+49-201-183-4682 * fax:+49-201-183-4698
http://www.paluno.eu * VAT-Nr. DE811272995
PGP/GPG key: http://www.s3.uni-duisburg-essen.de/pub/keys/0x7AE238AC.asc
X.509 cert:
https://pki.pca.dfn.de/uni-duisburg-essen-ca/cgi-bin/pub/pki?cmd=viewCert&k
ey=5639645262406037
Attachment:
smime.p7s
Description: S/MIME cryptographic signature