Bug 83304 - [1.5][search] Erasure match doesn't work for binary parameterized types
Summary: [1.5][search] Erasure match doesn't work for binary parameterized types
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-20 08:57 EST by Dirk Baeumer CLA
Modified: 2005-02-15 05:56 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2005-01-20 08:57:07 EST
I have the following example:

public class C {
	void foo() {
		List<? extends Number> l1= null;
		List<Integer> l2= null;
		
		List<String> string_list;
		
	}
}

Now I select List<String> and do a reference in workspace scope. The search
engine reports zero matches.

Please note that if you test this using JDT/UI search you first have to remove
SearchPattern.R_ERASURE_MATCH from SearchUtils#GENERICS_AGNOSTIC_MATCH_RULE.

I wanted to check how we best add the filters and therefore wanted to try some
non erasure matches first.
Comment 1 Dirk Baeumer CLA 2005-01-20 09:04:34 EST
When searching for erasure matches I get all matches reported, but the one for
List<String> has the erasure bit on as well.
Comment 2 Dirk Baeumer CLA 2005-01-20 09:19:53 EST
I tested it a little bit more with the following example:

import java.util.List;

public class C {
	void foo() {
		List<? extends Number> l1= null;
		List<Integer> l2= null;
	}
}

and get the following result when searching for List<Integer>:

import java.util.List;  : ERASURE and EQUIVALENT
List<? extends Number> : ERASURE
List<Integer>: ERASURE

IMO the result should be as follows:

import java.util.List;  : ERASURE
List<? extends Number> : EQUIVALENT
List<Integer>: EXACT
Comment 3 Frederic Fusier CLA 2005-01-20 09:26:38 EST
This is due to the fact that List<String> is a ParameterizedBinaryType.
Shame on me as I missed ParameterizedBinary* java model elements while
implementing generic search...
Comment 4 Frederic Fusier CLA 2005-01-21 05:00:28 EST
Fixed and released in HEAD.

Now search found match for binary parameterized types. I've also verified it
works for binary paremeterized methods/constructors.

[jdt-core-internal]
Changes done in ConstructorPattern and MethodPattern contructor. Also modified
extractMethodArguments and storeTypeSignaturesAndArguments methods in
JavaSearchPattern.
Test cases added in JavaSearchBugs:
  - testBug83304
  - testBug83304_TypeParameterizedElementPattern
  - testBug83304_TypeGenericElementPattern
  - testBug83304_TypeStringPattern
  - testBug83304_MethodParameterizedElementPattern
  - testBug83304_MethodGenericElementPattern
  - testBug83304_MethodStringPattern
  - testBug83304_ConstructorGenericElementPattern
  - testBug83304_ConstructorParameterizedElementPattern
  - testBug83304_ConstructorStringPattern
Comment 5 David Audel CLA 2005-02-15 05:56:48 EST
Verified in  I20050214-0927 for 3.1M5