Bug 69028 - Anonymous type in argument of super() is not in type hierarchy
Summary: Anonymous type in argument of super() is not in type hierarchy
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-30 11:54 EDT by Markus Keller CLA
Modified: 2004-09-06 10:26 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2004-06-30 11:54:34 EDT
Eclipse 3.0

The anonymous type in B.B() does not appear in the type hierarchy of Top:

class A {
	A(Top t) {	}
}

class B extends A {
	B() {
		super(new Top() {}); //not in type hierarchy
	}
	
	void method() {
		new Top() {};
	}
}

class Top { }
Comment 1 Markus Keller CLA 2004-07-06 07:15:21 EDT
Addition: when searching for references to class Top, the reference in B's
constructor is reported, but selecting the element leads to this exception:

Error Jul 06, 2004 13:06:43.168 An error occurred while accessing a Java element
Java Model Exception: Java Model Status [<anonymous #1> [in B() [in B [in
[Working copy] Top.java [in top [in src [in zzz]]]]]] does not exist]
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.Throwable.<init>(Throwable.java)
	at org.eclipse.core.runtime.CoreException.<init>(CoreException.java)
	at org.eclipse.jdt.core.JavaModelException.<init>(JavaModelException.java)
	at
org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java)
	at org.eclipse.jdt.internal.core.SourceType.isInterface(SourceType.java)
	at
org.eclipse.jdt.ui.actions.FindImplementorsAction.canOperateOn(FindImplementorsAction.java)
	at
org.eclipse.jdt.ui.actions.WorkingSetFindAction.canOperateOn(WorkingSetFindAction.java:70)
	at org.eclipse.jdt.ui.actions.FindAction.canOperateOn(FindAction.java)
	at org.eclipse.jdt.ui.actions.FindAction.selectionChanged(FindAction.java)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged(SelectionDispatchAction.java)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.update(SelectionDispatchAction.java)
	at
org.eclipse.jdt.ui.actions.ImplementorsSearchGroup.getActions(ImplementorsSearchGroup.java:127)
	at
org.eclipse.jdt.ui.actions.ImplementorsSearchGroup.fillContextMenu(ImplementorsSearchGroup.java:139)
	at
org.eclipse.jdt.ui.actions.JavaSearchActionGroup.fillContextMenu(JavaSearchActionGroup.java:144)
	at
org.eclipse.jdt.internal.ui.actions.CompositeActionGroup.fillContextMenu(CompositeActionGroup.java:77)
	at
org.eclipse.jdt.internal.ui.search.JavaSearchResultPage.fillContextMenu(JavaSearchResultPage.java:198)
	at
org.eclipse.search.ui.text.AbstractTextSearchViewPage$2.menuAboutToShow(AbstractTextSearchViewPage.java:437)
	at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:286)
	at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:370)
	at org.eclipse.jface.action.MenuManager.access$0(MenuManager.java:367)
	at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:383)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java)
	at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:3320)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java)
	at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
	at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:222)
	at org.eclipse.swt.widgets.Display.runPopups(Display.java)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
	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:84)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:59)
	at java.lang.reflect.Method.invoke(Method.java:390)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
	at org.eclipse.core.launcher.Main.run(Main.java:644)
	at org.eclipse.core.launcher.Main.main(Main.java:628)
Comment 2 Jerome Lanneluc CLA 2004-07-08 06:29:00 EDT
Problem is that the anonymous in B() is not in the Java model. You can see 
that it is not in the outline.

Changed SourceElementParser.visitIfNeed(AbtractMethodDeclaration) to visit the 
constructor call if the method is a constructor. This affects the indexes 
(references in the constructor call are not indexed). Incremented 
DiskIndex.SIGNATURE to force the reindexing.

Added regression test LocalElementTests.testAnonymous5().

Released fix and test in both R3_0_maintenance and HEAD streams.
Comment 3 David Audel CLA 2004-09-06 10:26:07 EDT
Verified for 3.0.1 RC1