Community
Participate
Working Groups
I20050215-2300 (m5 test pass) in the following code search put the caret on 'E' and search workspace references. ------- package searching; public class Test<E> { } ---------- !ENTRY org.eclipse.core.runtime 4 2 2005-02-16 16:09:56.609 !MESSAGE An internal error occurred during: "Java Search". !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.env.AccessRestriction.equals(AccessRestriction.java:43) at org.eclipse.jdt.internal.core.search.matching.TypeParameterPattern.findIndexMatches(TypeParameterPattern.java:94) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.findIndexMatches(MatchLocator.java:306) at org.eclipse.jdt.internal.core.search.PatternSearchJob.search(PatternSearchJob.java:111) at org.eclipse.jdt.internal.core.search.PatternSearchJob.execute(PatternSearchJob.java:64) at org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob(JobManager.java:260) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:181) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:382) at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:512) at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run(JavaSearchQuery.java:131) at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:93) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:67)
Cannot reproduce. Can you provide entire project? I suspect there's something special with access restriction in classpath...
Created attachment 17998 [details] project.zip The attached project shows the described behavior when searching references to the type variable 'T' in searching.TestGeneric (in searching/Test.java). Cannot reproduce either on a fresh project.
ok, I got it, thanks
A simpler test case is: .classpath: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry excluding="tmp" kind="src" path=""/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path=""/> </classpath> Test.java: public class Test<E> implements In<Test<E>> { E e; } interface In<T> {} NPE occurs while searching reference of E in project...
Fixed. Type parameter references are found even if access restriction is set on classpath. Problem came from comparison of this access restriction with not initialized access restriction from JavaSearchScope... [jdt-core-internal] Change done in findIndexMatches method of TypeParameterPattern and LocalVariablePattern. No test case added but add an access restriction to classpath of JavaSearch15 project in org.eclipse.jdt.core.tests.model to get same context.
Verified in I20050330-0500