同樣的問題我也問過在http://www.eclipse.org/forums/index.php/t/367608/應用的刻板印象財產關聯端拋出:IllegalArgumentException -
我想申請這對UML的屬性定義爲在關聯使用的物業的刻板印象。我遇到的問題是,在爲關聯關聯的屬性使用原型時會引發IllegalArgumentException。如果我將構造型應用於在類中用作屬性的屬性,那麼一切都很好。
下面是從異常拋出部分的代碼片段:
helper def: getStereotype(name: String): UML!Stereotype =
UML!Stereotype.allInstancesFrom('PRO') -> select(p | p.name = name) -> first();
-- ...
p1: UML!Property(
upper <-a.associationEnds.first().conformance.upperBound,
lower <- a.associationEnds.first().conformance.lowerBound,
name <- a.associationEnds.first().name,
type <- firstMemberType,
opposite <- p2,
isComposite <- true
),
p2: UML!Property(
upper <-a.associationEnds.last().conformance.upperBound,
lower <- a.associationEnds.last().conformance.lowerBound,
name <- a.associationEnds.last().name,
type <- secondMemberType,
opposite <- p1
),
as:UML!Association(
name <- a.name,
ownedEnd <- Set{p2}
navigableOwnedEnd <- Set{p1}
)
do {
p1.applyStereotype(thisModule.getStereotype('xsdElement')); -- here an exception is thrown: see below
}
以下則拋出。
Here appear some other resulting stacktraces.
......
Caused by: java.lang.IllegalArgumentException: [email protected] (name: xsdElement, visibility: <unset>) (isLeaf: false, isAbstract: false) (isActive: false)
at org.eclipse.uml2.uml.internal.operations.ElementOperations.applyStereotype(ElementOperations.java:1413)
at org.eclipse.uml2.uml.internal.impl.ElementImpl.applyStereotype(ElementImpl.java:510)
... 18 more
我用UML=http://www.eclipse.org/uml2/3.0.0/UML
。
看來p1不再是屬性了。任何人的想法?會很好。謝謝, 馬丁
EDIT1:
做一些調試後,我發現,在流動的方法的調用是第一個成功。在調用finalizeModel方法之前,everthing很好。當ATL UML2ModelAdapter中的方法finalizeModel被稱爲堆棧跟蹤被拋出時:
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException
at org.eclipse.m2m.atl.engine.emfvm.adapter.UML2ModelAdapter.finalizeModel(UML2ModelAdapter.java:51)
at org.eclipse.m2m.atl.engine.emfvm.lib.ExecEnv.terminated(ExecEnv.java:2557)
at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:210)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(EMFVMUILauncher.java:46)
at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:937)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1141)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.m2m.atl.engine.emfvm.adapter.UML2ModelAdapter.applyDelayedInvocations(UML2ModelAdapter.java:136)
at org.eclipse.m2m.atl.engine.emfvm.adapter.UML2ModelAdapter.finalizeModel(UML2ModelAdapter.java:49)
... 12 more
Caused by: java.lang.IllegalArgumentException: [email protected] (name: xsdElement, visibility: <unset>) (isLeaf: false, isAbstract: false) (isActive: false)
at org.eclipse.uml2.uml.internal.operations.ElementOperations.applyStereotype(ElementOperations.java:1413)
at org.eclipse.uml2.uml.internal.impl.ElementImpl.applyStereotype(ElementImpl.java:510)
... 17 more