Community
Participate
Working Groups
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.
When searching for erasure matches I get all matches reported, but the one for List<String> has the erasure bit on as well.
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
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...
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
Verified in I20050214-0927 for 3.1M5