Project: JDT
Bug 250621 [hashcode/equals] Wizard should allow to specify that blocks should always be used
Reported: 2008-10-13 05:54:47 | Status: verified fixed

Build ID: I20080617-2000 Steps To Reproduce: Hi, The code convension tool checkstyle complains about missing curly braces in the generated Eclipse equals method. I suggest to use {} in your template. Example: Now @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Test other = (Test) obj; if (test == null) { if (other.test != null) return false; } else if (!test.equals(other.test)) return false; return true; } Example: Should be: @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Test other = (Test) obj; if (test == null) { if (other.test != null) { return false; } } else if (!test.equals(other.test)) { return false; } return true; } Best regards, Lars More information:

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaUIMessages.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/GenerateHashCodeEqualsDialog.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/GenerateHashCodeEqualsAction.java