Bug 120816 - [search] NullPointerException at ...jdt.internal.compiler.lookup.SourceTypeBinding.getMethods
Summary: [search] NullPointerException at ...jdt.internal.compiler.lookup.SourceTypeBi...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-14 02:51 EST by Wolfgang CLA
Modified: 2006-02-14 11:16 EST (History)
0 users

See Also:


Attachments
search this library to reproduce the problem (702.47 KB, application/zip)
2005-12-14 04:45 EST, Wolfgang CLA
no flags Details
Patch to fix this issue (6.01 KB, patch)
2005-12-14 12:51 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 Wolfgang CLA 2005-12-14 02:51:05 EST
Searched code with compile-errors.
I was trying to find a method by its return type and its parameter(s).
(off-topic: I did not find a way to search a method by its paramters(s).)

Search expression: * String (Collection)
Search options: search for method, limit to declarations

Error 2005-12-14 08:22:47.395 An internal error occurred during: "Java Search".

java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.getMethods(SourceTypeBinding.java:835)
at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.getMethods(ParameterizedTypeBinding.java:486)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.matchOverriddenMethod(MethodLocator.java:287)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.newDeclarationMatch(MethodLocator.java:471)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:1833)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2222)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2023)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:1471)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:958)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:999)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1116)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:208)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:424)
at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:532)
at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run(JavaSearchQuery.java:135)
at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:94)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)

eclipse.buildId=I20050627-1435
Comment 1 Frederic Fusier CLA 2005-12-14 03:06:00 EST
Please provide test case to help us to reproduce, thx
Comment 2 Wolfgang CLA 2005-12-14 04:45:18 EST
Created attachment 31718 [details]
search this library to reproduce the problem

The problem persists when I restrict my working set to 
ca.odell.glazedlists.impl.beans.BeanTableFormat.

Maybe there is a mismatch between binary and source.
Sorry, I have no time to check it.
Comment 3 Wolfgang CLA 2005-12-14 04:46:13 EST
I think the problem is related to the parentheses.
The following search expression fails: * String (Collection)
The following search expression works: * String Collection
Comment 4 Frederic Fusier CLA 2005-12-14 05:55:38 EST
OK, reproduced but string pattern is: "* (Collection) String"

Parameters must be put before return type... See javadoc comment of SearchPattern.createMethodOrConstructorPattern(String,int,int,boolean):
/**
 * Method pattern are formed by:<br>
 * 	[declaringType '.'] ['&lt;' typeArguments '&gt;'] selector ['(' parameterTypes ')'] [returnType]
 *		<br>e.g.<ul>
 *			<li>java.lang.Runnable.run() void</li>
 *			<li>main(*)</li>
 *			<li>&lt;String&gt;toArray(String[])</li>
 *		</ul>
 * Constructor pattern are formed by:<br>
 *		[declaringQualification '.'] ['&lt;' typeArguments '&gt;'] type ['(' parameterTypes ')']
 *		<br>e.g.<ul>
 *			<li>java.lang.Object()</li>
 *			<li>Main(*)</li>
 *			<li>&lt;Exception&gt;Sample(Exception)</li>
 *		</ul>
 * Type arguments have the same pattern that for type patterns
 * @see #createTypePattern(String,int,int,char)
 */

I doubdt this will be fixed in 3.1 maintenance (severity is minor) but will surely be for 3.2...
Comment 5 Frederic Fusier CLA 2005-12-14 12:51:27 EST
Created attachment 31762 [details]
Patch to fix this issue

Specific eclipse patch format including 2 projects:
  - org.eclipse.jdt.core
  - org.eclipse.jdt.core.tests.model
Comment 6 Frederic Fusier CLA 2006-01-04 09:49:37 EST
Fixed and released in HEAD.

Test cases added to JavaSearchBugsTests
Comment 7 David Audel CLA 2006-02-14 11:16:24 EST
Verified for 3.2 M5 using build I20060214-0010