Uml 将构造型作为关联结束应用于属性会引发IllegalArgumentException

Uml 将构造型作为关联结束应用于属性会引发IllegalArgumentException,uml,emf,Uml,Emf,同样的问题,我已经问过了 我想将为UML属性定义的原型应用于关联中使用的属性。我遇到的问题是,如果对关联属性使用原型,会抛出IllegalArgumentException。如果我将构造型应用于一个属性,该属性在类中用作属性,那么一切都很好 以下是异常引发部分的代码片段: helper def: getStereotype(name: String): UML!Stereotype = UML!Stereotype.allInstancesFrom('PRO') -> select(p |

同样的问题,我已经问过了

我想将为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: org.eclipse.uml2.uml.internal.impl.StereotypeImpl@21ee05 (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
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: org.eclipse.uml2.uml.internal.impl.StereotypeImpl@580b29 (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