Community
Participate
Working Groups
If a toString operation is defined in eCore as an operation the resulting generated java class contains two toString operations. On each subsequent run of the generator a further toString method is generated on top of those already present. The extra toString operations have the form produced by the emf toString template as shown below. /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @model annotation="http://www.eclipse.org/emf/2002/GenModel body='java.lang.String result = null;\n\n\n\nreturn result;'" * @generated */ public String toString(){ java.lang.String result = null; return result; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String toString(){ if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (value: "); result.append(value); result.append(')'); return result.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String toString(){ if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (value: "); result.append(value); result.append(')'); return result.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String toString(){ ... etc
Created attachment 101030 [details] Guard the generation of the toString method.
The best way to fix this is to add a guard. Does this look okay?
This looks good to me.
A fix has been committed to CVS for 2.4. (Kenn, this affects your compiled Class.java.)
Fix available in HEAD: 2.4.0RC1 (S200805201049).