Community
Participate
Working Groups
In RC3. Consider code: public enum Foo { A { tos<<>> }; } Where the cursor is at <<>>. Invoking code assist does not offer to override toString: it only offers class names.
Created attachment 23613 [details] Proposed patch sourceEnd of the enum constant node is at '{' location instead of ')' or name's sourceEnd location. So recovery believe that { is not present.
Created attachment 24375 [details] Better patch sourceEnd of enum constant must not be changed. This patch improve recovery instead.
Fix released and test added EnumCompletionParserTest#test0014()
Reopen. Now I get the completion for toString(), but it fails with: java.lang.ClassCastException: org.eclipse.jdt.core.dom.EnumConstantDeclaration at org.eclipse.jdt.internal.ui.text.java.OverrideCompletionProposal.updateReplacementString(OverrideCompletionProposal.java:109) at org.eclipse.jdt.internal.ui.text.java.JavaTypeCompletionProposal.apply(JavaTypeCompletionProposal.java:95) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal.apply(JavaCompletionProposal.java:565) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:502) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:453) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$23(CompletionProposalPopup.java:449) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$5.widgetDefaultSelected(CompletionProposalPopup.java:390) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:97) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:868) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3137) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2765) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1734) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1698) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952) Move to JDT/UI
Created attachment 25897 [details] Proposed fix The fix is trivial. AnonymousClassDeclaration were considered only with a ClassInstanceCreation as a parent. An EnumConstantDeclaration can also have such child.
Given we addressed this issue in 3.1.1, it would be good that UI fix also gets released for 3.1.1
Tobias, can you please have a look. I opt to fix this for 3.1.1 since it now causes a CCE.
patch looks good to me +1 for 3.1.1 Markus, can you please vote on this one?
+1. The patch looks good (modulo compact assignment and indentation of the case statements:-).
I'll be more careful next time I provide a patch :-). Will this be fixed for 3.2M1?
No, it didn't make it into M1
Fixed in 3.1.1 maintenance stream > 20050811
Fixed in HEAD > 20050815
verifying...
verified the proposal works and there is no CCE