| Summary: | [clean up] "Remove unnecessary casts" breaks compilation | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Jan Koehnlein <jan> |
| Component: | UI | Assignee: | Noopur Gupta <noopur_gupta> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert |
| Version: | 4.3 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
Tested with Eclipse 4.3M5a on MacOSX 64bit. Noopur, please investigate. My fault. I am using a different target platform than Hudson, and EMF has generified the method in my version, so the cast was really obsolete here. |
In Xtext, we have the following lines in EcoreUtil2: @SuppressWarnings("unchecked") public static <T extends EObject> T clone(T eObject) { return (T) EcoreUtil.copy(eObject); } Where EcoreUtil copy is from EMF and has the signature public static <T extends EObject> T copy(T eObject) When saving our EcoreUtil2, the cast in the return statement is removed by the "Remove unnecessary casts" cleanup action. This results in a compile error on Hudson: Error: file /opt/users/hudsonbuild/.hudson/jobs/xtext.gerrit/workspace/org.eclipse.xtext.git/plugins/org.eclipse.xtext/src/org/eclipse/xtext/EcoreUtil2.java, line 130: Type mismatch: cannot convert from EObject to T