Community
Participate
Working Groups
Build Identifier: M20110210-1200 If I press Ctrl-Space in a class that implements an interface and choose to implement a method, the generated method sometimes has the following problems: - My formatting preferences are not respected: Both open- and closing braces are on the same line even though each of them should be on a new line - The generated method is ended with a semicolon (;). So after the closing brace a semicolon is appended - There's no @Override annotation added to the generated method. This immediately generates a warning with my compiler warning settings. I'll add an attachment with an example. Reproducible: Sometimes Steps to Reproduce: 1. Create a new class 2. Add 'implements' and choose some interface 3. Press Ctrl-Space in the class body and choose to implement some method This doesn't happen every time. I noticed that it happens more frequently if: - the subclass is an anonymous inner class - the subclass is still completely empty
Here's an example of such a generated method: Thread thread = new Thread() { public void run() {}; } Note that both braces are on the same line even though my code formatter specifies that each of them should be on a new line. Sometimes the code generator does this correctly, and sometimes the code looks like this.
Self-contained snippet: class Y { public void foo() { } } public class Snippet extends Y { foo(); foo } Content assist after "foo" inserts: public void foo() {}; If the foo() call removed or commented out, then it works fine. The bug is in OverrideCompletionProposal.java. See also bug 317497.
I can't reproduce comment 2 (inserts a correct overriding method), but comment 1 is due to a bad AST recovery, see bug 377176.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.