Bug 144044 - [search] NPE when trying to find references to field variable
Summary: [search] NPE when trying to find references to field variable
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-26 16:53 EDT by Sehyo Chang CLA
Modified: 2007-02-06 01:48 EST (History)
2 users (show)

See Also:


Attachments
Proposed patch (4.04 KB, patch)
2007-01-12 14:20 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sehyo Chang CLA 2006-05-26 16:53:55 EDT
Eclipse: 3.2RC5

I was trying to find references to variable in SWT class CBanner, when
this happened.  Note that this worked initially but after while it kept
producing null pointer.  This problem occurred even after workbench restart
and closing and reopening of files.

!ENTRY org.eclipse.core.jobs 4 2 2006-05-26 13:52:40.854
!MESSAGE An internal error occurred during: "Java Search".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.core.search.matching.FieldLocator.matchReportReference(FieldLocator.java:221)
	at org.eclipse.jdt.internal.core.search.matching.PatternLocator.matchReportReference(PatternLocator.java:398)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2034)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2440)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2187)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:1548)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1033)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1074)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1180)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:212)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:503)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:538)
	at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run(JavaSearchQuery.java:143)
	at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:93)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Comment 1 Frederic Fusier CLA 2006-05-29 06:42:31 EDT
I cannot reproduce your problem using either 3.2 RC6 or 3.2 RC5.
It works also using either a 1.4.2 VM (build 1.4.2_12-b02) or a 1.5.0 one (build 1.5.0_07-b02), what VM were you using? Has your workspace something special or are you able to reproduce in a fresh new one?
Comment 2 Sehyo Chang CLA 2006-05-29 20:12:37 EDT
My JVM is 1.5b06
Comment 3 Frederic Fusier CLA 2006-05-30 04:04:21 EDT
And about reproduce this issue in a new workspace?
Comment 4 Frederic Fusier CLA 2006-07-05 06:28:25 EDT
Please reopen if you get this NPE again using 3.2 GA.

If you cannot reproduce in a brand new workspace, then let me know where I can get your corrupted workpsace in order to help me to reproduce this issue, thanks
Comment 5 Frederic Fusier CLA 2007-01-12 11:21:43 EST
Reopen as David got this NPE.
Here's a simple test case based on his workspace's example:
X.java:
    package q;
    public class X {
	String str;
    }
Test.java:
    package p;
    import q.X;
    public class Test {
	String foo(X x) {
	    return x.str;
	}
    }


Search reference to field X.str => NPE!
Comment 6 Frederic Fusier CLA 2007-01-12 11:23:32 EST
The important point is that reference to 'str' field is flagged by compiler as not visible... Binding seems to be missing and explains the NPE!
Comment 7 Frederic Fusier CLA 2007-01-12 14:20:17 EST
Created attachment 56845 [details]
Proposed patch
Comment 8 Frederic Fusier CLA 2007-01-13 11:39:14 EST
Released for 3.3 M5 in HEAD stream.
Comment 9 Maxime Daniel CLA 2007-02-06 01:48:26 EST
Verified for 3.3 M5 using build I20070205-1824.