Community
Participate
Working Groups
I have a class like this: --cut-- import javax.swing.*; public class Foo extends AbstractAction {} --cut-- If I now use Override Methods... from the Outline view to add the actionPerformed() method, I get this result: --cut-- import java.awt.event.ActionEvent; import javax.swing.*; public class DET extends AbstractAction /** * @see java.awt.event.ActionListener#actionPerformed(ActionEvent) */ public void actionPerformed(ActionEvent e) { } {} --cut-- I'd have expected to see the generated method inside the class' braces. (The problem is replicable only if the class' braces are as {}, and stand on their own line.)
JDT Core IType.createMethod is used
This is still a problem in 2.1 RC1.
I might have a fix for this one.
Ok if not too much risky.
The problem comes from the normalize method in DOMType. The test is: if (fInsertionPosition < openBodyEnd) { fInsertionPosition = getCloseBodyPosition(); } instead of: if (fInsertionPosition <= openBodyEnd) { fInsertionPosition = getCloseBodyPosition(); } The reason is that the fInsertion position is inclusive. If it is equal to openBodyEnd, it means that this is not a good position for insertion. This would result with the new method outside of the class braces. Changing < for <= means that in this case the new method is inserted before the closing brace.
Fixed and released in 2.1 stream. Regression tests added.
Verified.