Community
Participate
Working Groups
Build ID: M20080911-1700 Steps To Reproduce: Using 2.4.1 of EMF... Create an ABSTRACT, INTERFACE EClass node inside an ECore file, and name it "JComparableObject". Set the "Instance Type Name" to "Comparable<Object>". Create another EClass node with an ESuperType of "JComparableObject" (i.e. thatt corresponds to the first created node). Open up the corresponding genmodel and generate model code. The generation will produce incorrect code for two generated methods: eBaseStructuralFeatureID(int, Class<?>), and eDerivedStructuralFeatureID(int, Class<?>) The offending code in each will be: "if (baseClass == Comparable<Object>.class)" The correct solution is to have the generator drop the parameterization, producing this instead: "if (baseClass == Comparable.class)" which will, of course, compile. More information:
BTW, the Instance Type Name should be: "java.lang.Comparable<java.lang.Object>" and not the shorthand I wrote in the summary.
OK, scratch that. I must have missed the "Show Generics" features in the Ecore editor. The correct solution is to paramaterize the first eclass object, and then select the EJavaObject as the Generic Type Argument. Easy peasy.
Although what you've sketched out is a better way, what you did originally should have worked properly. I'll attach an example model that reproduces your problem.
Created attachment 115586 [details] Model illustrating the problem Note that it takes multiple inheritance to reproduce the problem.
Created attachment 115587 [details] Patches to improve the behavior Note that I looked in the templates for anywhere we generated <something>.class and ensured that we use the raw type there. Does this look okay to you Dave?
Looks good Ed. This looks like a good candidate to fix in 3.4.2 to me, as well. Do you think so?
Dave, Not no much because who's generating RCP without Java 5.0 in EMF 2.4?
The changes have been committed to CVS for 2.5. I confused this with the RCP editor bug. This seems a little more important to fix in 2.4.x, though not crucial, but we may as well. Kenn, This bug affects UML's templates.
Fix available in HEAD: 2.5.0M3 (S200811032126).
Fix available in HEAD: 2.5.0 (R200906151043).