ClassCastException: org.eclipse.uml2.impl.GeneralizationImpl with EMF-UML2 model --------------------------------------------------------------------------------
Key: UMLMETA-83 URL: http://jira.andromda.org/browse/UMLMETA-83 Project: UML Metafacades Type: Bug Environment: Using 3.3-SNAPSHOT but involved code is unchanged since 3.2 final. Reporter: Jerome Leclercq Assigned to: Wouter Zoons Happens when using meta-cartridge with a EMF/UML2 metamodel : java.lang.ClassCastException: org.eclipse.uml2.impl.GeneralizationImpl at org.andromda.metafacades.emf.uml2.ModelElementFacadeLogicImpl.handleGetTaggedValues(ModelElementFacadeLogicImpl.java:599) at org.andromda.metafacades.emf.uml2.ModelElementFacadeLogic.getTaggedValues(ModelElementFacadeLogic.java:991) ... Now let's take a look at the code : protected java.util.Collection handleGetTaggedValues() { return UmlUtilities.getTaggedValue((NamedElement)this.metaObject); } Which is incorrect, because Generalizations aren't Sub-interfaces of NamedElement, but Element. Looking at "UmlUtilities.getTaggedValue(NamedElement)" shows that code that needs NamedElements are only debug logs. Correction diffs : metafacades/uml/emf/uml2/src/main/java/org/andromda/metafacades/emf/uml2/ModelElementFacadeLogicImpl.java 599c599 < return UmlUtilities.getTaggedValue((NamedElement)this.metaObject); --- > return UmlUtilities.getTaggedValue(this.metaObject); metafacades/uml/emf/uml2/src/main/java/org/andromda/metafacades/emf/uml2/UmlUtilities.java 575c575 < public static Collection getTaggedValue(final NamedElement element) --- > public static Collection getTaggedValue(final Element element) 579c579,582 < logger.debug("Searching Tagged Values for " + element.getName()); --- > if(element instanceof NamedElement) > logger.debug("Searching Tagged Values for " + > ((NamedElement)element).getName()); > else > logger.debug("Searching Tagged Values for " + element); 664c666,669 < logger.debug("Found " + tags.size() + " tagged values for " + element.getName()); --- > if(element instanceof NamedElement) > logger.debug("Found " + tags.size() + " tagged values for " + > ((NamedElement)element).getName()); > else > logger.debug("Found " + tags.size() + " tagged values for " + > element); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.andromda.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV