Bug 81152 - [model] Get "Operation not supported for specified element type" in Override/Implement Methods
Summary: [model] Get "Operation not supported for specified element type" in Override/...
Status: RESOLVED DUPLICATE of bug 43483
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-15 09:47 EST by Tom Weissinger CLA
Modified: 2005-01-19 12:31 EST (History)
0 users

See Also:


Attachments
Screenshot of error (14.47 KB, image/jpeg)
2004-12-15 09:48 EST, Tom Weissinger CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Weissinger CLA 2004-12-15 09:47:19 EST
In Eclipse, you can right-click on a class and choose "Source -> 
Override/implement methods" and then check the methods you want to override.  
It works fine for the normal case.  But if you want to override methods in a 
class contained within a method's body, Eclipse throws an error dialog.  See 
attachment for a screenshot.

"Operation not supported for specified element type"

To reproduce:
1. Create a class like the following.

package com.avaya.ic.vesp;
public class DummyClass {
   public void myTest() {
      class Blah extends Object {
         
      }
   }
}

2. Right-click on "Blah" and choose Source --> Override/Implement methods.
3. Choose a method to override (i.e. "hashCode")
4. Get an error dialog.
Comment 1 Tom Weissinger CLA 2004-12-15 09:48:35 EST
Created attachment 16641 [details]
Screenshot of error
Comment 2 Jerome Lanneluc CLA 2004-12-15 10:43:43 EST
Can you please specify the build number you are you using ?
Comment 3 Olivier Thomann CLA 2004-12-15 11:03:13 EST
Reproduced with 200412142000.
Move to JDT/UI for investigation.
Comment 4 Olivier Thomann CLA 2004-12-15 11:08:59 EST
Move back to JDT/Core since the problem seems to come from the underlying operation.
!ENTRY org.eclipse.jdt.ui 4 10001 2004-12-15 11:02:35.748
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Java Model Status [Operation not supported for specified
element type(s):Blah [in myTest() [in DummyClass [in [Working copy]
DummyClass.java [in <default> [in src [in P]]]]]]]
	at
org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:735)
	at org.eclipse.jdt.internal.core.SourceType.createMethod(SourceType.java:140)
	at
org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedMethodsOperation.run(AddUnimplementedMethodsOperation.java:82)
	at
org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:34)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:700)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1674)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3672)
	at
org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:65)
	at
org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:322)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:269)
	at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:624)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:621)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1949)
	at
org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1061)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1057)
	at
org.eclipse.jdt.ui.actions.OverrideMethodsAction.run(OverrideMethodsAction.java:239)
	at
org.eclipse.jdt.ui.actions.OverrideMethodsAction.run(OverrideMethodsAction.java:153)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:212)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:188)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:989)
	at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555)
	at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505)
	at
org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:419)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
	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.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:684)
	at org.eclipse.core.launcher.Main.main(Main.java:668)
!SUBENTRY 1 org.eclipse.jdt.core 4 967 2004-12-15 11:02:35.748
!MESSAGE Operation not supported for specified element type(s):Blah [in myTest()
[in DummyClass [in [Working copy] DummyClass.java [in <default> [in src [in P]]]]]]
Comment 5 Olivier Thomann CLA 2004-12-15 11:18:14 EST
This kind of operation is not supported for local and anonymous class.
Comment 6 Jerome Lanneluc CLA 2004-12-16 05:32:00 EST
Java model operations are to be rewritten using AST rewrite.
Comment 7 Jerome Lanneluc CLA 2005-01-19 12:31:37 EST

*** This bug has been marked as a duplicate of 43483 ***