Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 235750

Summary: [clean up] 'Save Actions' doesn't add override annotation for interface method implementations (Java6)
Product: [Eclipse Project] JDT Reporter: Cameron Miller <cameron.miller>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r, martinae, michael.fairbank
Version: 3.3.2   
Target Milestone: 3.6 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Fix none

Description Cameron Miller CLA 2008-06-05 00:14:54 EDT
Build ID: M20080221-1800

Steps To Reproduce:
1. Create an interface with a method
2. Manually create an implementation of that interface's method in a class. (Must be manual, because using automatic code generation puts in the annotation.)
3. Save the file.
4. The override annotation isn't added as expected.



More information:
The problem doesn't happen when automatically generating the method stub (cursor in the editor window; using ctrl+<space> and selecting the interface method).

Note: The Java6 API javadoc doesn't mention that interface method implementations can use the override annotation, but it is supported by the compiler.

What is the difference between [Java -> Code Style -> Clean Up] and [Java -> Editor -> Save Actions]?
I'm using the built-in eclipse profile for Clean Up.
Both have the same setting enabled for "Add missing '@Override' annotations"
Comment 1 Jerome Lanneluc CLA 2008-06-05 10:02:07 EDT
Moving to JDT/UI
Comment 2 Benno Baumgartner CLA 2008-06-05 12:04:00 EDT
Clean up does whatever the compiler says: If the compiler says 'no missing annotation' it will not add it, which is allowed. Our code generation does add override annotations if > 1.5, which is allowed as well, but inconsistent.



*** This bug has been marked as a duplicate of bug 163194 ***
Comment 3 Markus Keller CLA 2009-09-23 13:03:03 EDT
*** Bug 271254 has been marked as a duplicate of this bug. ***
Comment 4 Markus Keller CLA 2009-09-23 13:09:07 EDT
Fixed in HEAD.

Since bug 163194 added a new compiler option and a separate problem ID, I also added a separate checkbox to configure this for Clean Up and Save Actions.
Comment 5 Markus Keller CLA 2009-09-23 13:09:35 EDT
Created attachment 147908 [details]
Fix