Community
Participate
Working Groups
I 2003-12-18-09:55 1) create a class like so: /* * Created on Dec 18, 2003 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ /** * @author tma * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class Test1 { public static void main(String[] args) { Runnable r= new Runnable() { public void run() { System.out.println("bla"); } }; r.run(); } } 2) select the declaration of run() in the inner class 3) do a search for references in the workpaces 4) observe: you get no matches. By accident, I had a breakpoint on NullPointerException, and I got the following stack trace in the debugger (the exception is eaten silently): Javadoc.resolve(MethodScope) line: 122 FieldDeclaration.resolve(MethodScope) line: 224 TypeDeclaration.resolve() line: 910 TypeDeclaration.resolve(CompilationUnitScope) line: 975 CompilationUnitDeclaration.resolve() line: 271 MatchLocator.process(PossibleMatch, boolean) line: 888 MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int) line: 621 MatchLocator.locateMatches(JavaProject, PossibleMatchSet) line: 658 MatchLocator.locateMatches(SearchDocument[]) line: 749 JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 155 MethodPattern(InternalSearchPattern).findMatches(SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 199 SearchEngine.search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 729 SearchEngine.search(IWorkspace, ISearchPattern, IJavaSearchScope, IJavaSearchResultCollector) line: 697 SearchEngine.search(IWorkspace, IJavaElement, int, IJavaSearchScope, IJavaSearchResultCollector) line: 678 JavaSearchOperation.execute(IProgressMonitor) line: 97 WorkspaceModifyOperation$1.run(IProgressMonitor) line: 91 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1555 JavaSearchOperation(WorkspaceModifyOperation).run(IProgressMonitor) line: 105 ModalContext$ModalContextThread.run() line: 101
Was not working in M5 either. Not critical.
Was not able to reproduce the NPE. However this is not the cause of the failure to find references to anonymous inner methods. Problem is in the SuperTypeNamesCollector that doesn't handle anonymous types correctly.
Created attachment 7250 [details] Proposed patch
Released proposed patch+fix to ASTNodeFinder that didn't find methods with no args. Added regression test JavaSearchTests.testMethodReference5()
Verified for 3.0M7