2012-02-17 6 views
0

최근까지는 이전 버전의 Eclipse UML2 (2.4)를 사용하고있었습니다. Eclipse UML2.3.1로 업데이트 한 후 다른 스테레오 타입에서 일반화 된 스테레오 타입을 적절한 확장 메타 클래스의 요소에 적용하려고하면 IllegalArgumentException을 수신한다. 이클립스 uml 소스를 살펴보면 스테레오 타입의 기본 Ecore 모델에 "base_Class"속성이 없다는 것을 알 수 있습니다.Eclipse UML2 3.1에서 스테레오 타입 B가 스테레오 타입 A의 일반화 인 경우 B는 A의 메타 클래스 확장을 상속합니까?

자바 테스트 코드 :

// Init a resource set to load the standard UML profiles 
ResourceSet rset = null; 
{ 
    rset = new ResourceSetImpl(); 

    rset.getPackageRegistry().put("http://www.eclipse.org/uml2/3.0.0/UML", UMLPackage.eINSTANCE);  

    // Register the UML resource factory 
    rset.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE); 

    // Get one of the standard profiles to build a jar path 
    final URL url = ClassLoader.getSystemResource("profiles/UML2.profile.uml"); 
    if(url == null) { 
    throw new RuntimeException("Could not load 'profiles/UML2.profile.uml' from class path"); 
    } 

    // Need the jarfile path so chop off the file specific stuff 
    final String path = url.toExternalForm().split("!")[0] + "!/"; 

    // Build a uri for this path 
    final URI baseURI = URI.createURI(path); 


    // Build mappings from 'pathmap://UML_PROFILES' (or metamodels or libraries) to the point at the jarfile path 
    final Map<URI,URI> uriMap = rset.getURIConverter().getURIMap(); 
    // pathmap://UML_PROFILES 
    uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), baseURI.appendSegment("libraries").appendSegment("")); 
    // pathmap://UML_LIBRARIES 
    uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), baseURI.appendSegment("metamodels").appendSegment("")); 
    // pathmap://UML_PROFILES 
    uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), baseURI.appendSegment("profiles").appendSegment("")); 
} 

// Load the test profile 
Profile test = null; 
{ 
    final URL url = ClassLoader.getSystemResource("profiles/test.profile.uml"); 
    if(url == null) { 
    throw new RuntimeException("Could not load 'profiles/test.profile.uml' from class path"); 
    } 

    final Resource r = rset.createResource(URI.createURI(url.toExternalForm())); 

    r.load(null); 

    test = (Profile)EcoreUtil.getObjectByType(r.getContents(), UMLPackage.Literals.PROFILE); 
    if(test == null) { 
    throw new RuntimeException("Could not load 'profiles/test.profile.uml'"); 
    } 
} 

Stereotype A = test.getOwnedStereotype("A"); 
Stereotype B = test.getOwnedStereotype("B"); 

Model m = UMLFactory.eINSTANCE.createModel(); 

org.eclipse.uml2.uml.Package pkg = m.createNestedPackage("pkg"); 

org.eclipse.uml2.uml.Class c1 = pkg.createOwnedClass("c1", false); 
org.eclipse.uml2.uml.Class c2 = pkg.createOwnedClass("c2", false); 

pkg.applyProfile(test); 

c1.applyStereotype(A); 
c2.applyStereotype(B); // throws IllegalArgumentException 

테스트 프로필 :

<?xml version="1.0" encoding="UTF-8"?> 
<uml:Profile xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_17_0_1_1_57a01e4_1329493254282_739829_1797" name="test" metamodelReference="_17_0_1_1_57a01e4_1329493254285_456691_1798"> 
    <eAnnotations xmi:id="_RgZgwVl-EeG_l9KiXhjXuA" source="http://www.eclipse.org/uml2/2.0.0/UML"> 
    <contents xmi:type="ecore:EPackage" xmi:id="_RgZgwll-EeG_l9KiXhjXuA" name="test" nsURI="http:///schemas/test/_RgUBMFl-EeG_l9KiXhjXuA/0" nsPrefix="test"> 
     <eClassifiers xmi:type="ecore:EClass" xmi:id="_RgZgw1l-EeG_l9KiXhjXuA" name="A"> 
     <eAnnotations xmi:id="_RgZgxFl-EeG_l9KiXhjXuA" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_17_0_1_1_57a01e4_1329493260539_647682_1799"/> 
     <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_RgZgxVl-EeG_l9KiXhjXuA" name="base_Class" ordered="false" lowerBound="1"> 
      <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/3.0.0/UML#//Class"/> 
     </eStructuralFeatures> 
     </eClassifiers> 
     <eClassifiers xmi:type="ecore:EClass" xmi:id="_RgZgx1l-EeG_l9KiXhjXuA" name="B" eSuperTypes="_RgZgw1l-EeG_l9KiXhjXuA"> 
     <eAnnotations xmi:id="_RgZgyFl-EeG_l9KiXhjXuA" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_17_0_1_1_57a01e4_1329493272173_447751_1805"/> 
     </eClassifiers> 
    </contents> 
    </eAnnotations> 
    <packageImport xmi:id="_17_0_1_1_57a01e4_1329493254285_456691_1798"> 
    <importedPackage xmi:type="uml:Model" href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/> 
    </packageImport> 
    <packageImport xmi:id="_0primitiveTypestest"> 
    <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> 
    </packageImport> 
    <packageImport xmi:id="_0javaPrimitiveTypestest"> 
    <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/> 
    </packageImport> 
    <packagedElement xmi:type="uml:Stereotype" xmi:id="_17_0_1_1_57a01e4_1329493260539_647682_1799" name="A"> 
    <ownedAttribute xmi:id="_17_0_1_1_57a01e4_1329493385577_849191_1812" name="base_Class" visibility="private" association="_17_0_1_1_57a01e4_1329493385577_76750_1811"> 
     <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/> 
    </ownedAttribute> 
    </packagedElement> 
    <packagedElement xmi:type="uml:Stereotype" xmi:id="_17_0_1_1_57a01e4_1329493272173_447751_1805" name="B"> 
    <generalization xmi:id="_17_0_1_1_57a01e4_1329493436355_971859_1821" general="_17_0_1_1_57a01e4_1329493260539_647682_1799"/> 
    </packagedElement> 
    <packagedElement xmi:type="uml:Extension" xmi:id="_17_0_1_1_57a01e4_1329493385577_76750_1811" name="" memberEnd="_17_0_1_1_57a01e4_1329493385578_204693_1813 _17_0_1_1_57a01e4_1329493385577_849191_1812" navigableOwnedEnd="_17_0_1_1_57a01e4_1329493385578_204693_1813"> 
    <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_17_0_1_1_57a01e4_1329493385578_204693_1813" name="extension_A" visibility="private" type="_17_0_1_1_57a01e4_1329493260539_647682_1799" aggregation="composite" association="_17_0_1_1_57a01e4_1329493385577_76750_1811"> 
     <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_17_0_1_1_57a01e4_1329493385578_803186_1815" name="" value="1"/> 
     <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_17_0_1_1_57a01e4_1329493385578_297198_1814" name=""/> 
    </ownedEnd> 
    </packagedElement> 
</uml:Profile> 

답변

0

이 그냥 버그입니다. 신고하고 신이 당신을 도울 것인가 :-)