Community
Participate
Working Groups
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 { }
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)
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.
Verified for 3.0.1 RC1