Bug 85421 - [1.5][search] NPE while searching type parameter reference in workspace
Summary: [1.5][search] NPE while searching type parameter reference in workspace
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-16 10:13 EST by Tom Hofmann CLA
Modified: 2005-03-30 15:56 EST (History)
0 users

See Also:


Attachments
project.zip (61.26 KB, application/x-zip-compressed)
2005-02-16 12:28 EST, Tom Hofmann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hofmann CLA 2005-02-16 10:13:16 EST
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)
Comment 1 Frederic Fusier CLA 2005-02-16 12:05:30 EST
Cannot reproduce. Can you provide entire project?
I suspect there's something special with access restriction in classpath...
Comment 2 Tom Hofmann CLA 2005-02-16 12:28:56 EST
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.
Comment 3 Frederic Fusier CLA 2005-02-16 12:49:17 EST
ok, I got it, thanks
Comment 4 Frederic Fusier CLA 2005-02-17 09:11:05 EST
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...
Comment 5 Frederic Fusier CLA 2005-02-21 12:15:07 EST
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.
Comment 6 Olivier Thomann CLA 2005-03-30 15:56:47 EST
Verified in I20050330-0500