Community
Participate
Working Groups
Build Identifier: 2.0.0 If you export to Java source a project which has an inheritance relationship with class indicator types of java.lang.Byte, java.lang.Short, java.lang.Long, java.lang.Double, etc. the exported Java code will not compile due to an unrecognized constructor. In the exported code the argument to the constructor for these classes is passed as a primitive type, i.e. int rather than as a String value. For example if java.lang.Byte is the type for the indicator value the MW generates: descriptor.getInheritancePolicy().addClassIndicator(model.LargeProject.class, new java.lang.Byte(1)); which fails compilation because Byte(int) is not a java.lang.Byte constructor. To fix this change this line in org.eclipse.persistence.sessions.factories.ProjectClassGenerator printString: return "new " + value.getClass().getName() + "(" + value + ")"; to: return "new " + value.getClass().getName() + "(\"" + value.toString() + "\")"; so the consructor which takes the String value is invoked. Reproducible: Always Steps to Reproduce: 1. Export to Java source a project which has an inheritance relationship and uses a class indicator value of type java.lang.Byte for that inheritance. 2. View the generated source and note the "new java.lang.Byte(1)" described above. 3. Try to compile this source file and see the error related to this constructor not being found.
Reassigning because org.eclipse.persistence.sessions.factories.ProjectClassGenerator actually resides in the foundation runtime.
Created attachment 156867 [details] patch fix and test
Created attachment 156880 [details] patch fix and test
Created attachment 156971 [details] Minor comment and whitespace changes to previous patch
Fix contributed by: John Vandale EL IPLog updated Reviewed: Guy Pelletier, David Minsky Checked in: trunk (r6366 - http://fisheye2.atlassian.com/changelog/eclipselink/?cs=6366) Code will be checked into 2.0
Checked into 2.0 in revision 6367 http://fisheye2.atlassian.com/changelog/eclipselink/?cs=6367
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink