Sample for parameterized methods

Assuming that we have following code:
public class Single<T> {
    public <U> void generic(U u) {}
    public void paramTypesArgs(Single<T> gst) {}
}

public class RefSingle {
   void testObject() {
      Single<Object> gs = new Single<Object>();
      gs.<Object>generic(new Object());
      gs.paramTypesArgs(gs);
   }
   void testException() {
      Single<Exception> gs = new Single<Exception>();
      gs.<Exception>generic(new Exception());
      gs.paramTypesArgs(gs);
   }
   void testRuntimeException() {
     Single<RuntimeException>gs = new Single<RuntimeException>();
     gs.<RuntimeException>generic(new RuntimeException());
     gs.paramTypesArgs(gs);
   }
   void testRaw() {
     Single gs = new Single();
     gs.generic(new Exception());
     gs.paramTypesArgs(gs);
   }
}

Search for generic methods

Example of pattern

A sample of pattern to search generic method is: <U>generic(U).

Note: it is not possible to perform this kind of search using dialog. In search dialog string, all types specified between <> are considered as type arguments and not as type parameters.

Declarations

References

Search for parameterized or raw methods

Search pattern mode

R_ERASURE_MATCH R_EQUIVALENT_MATCH R_FULL_MATCH

Declarations

References

String search pattern
Code
SearchMatch
Rule
SearchPattern.R_...
Raw

generic
generic(exc)
R_FULL_MATCH true
<Object>generic(obj) R_FULL_MATCH false
<Exception>generic(exc) R_FULL_MATCH false
<RuntimeException>generic(run) R_FULL_MATCH false




<Exception>generic(Exception) <Exception>generic(exc) R_FULL_MATCH false






<U>generic(U)
generic(exc)
R_EQUIVALENT_MATCH true
<Object>generic(obj) R_FULL_MATCH false
<Exception>generic(exc) R_FULL_MATCH false
<RuntimeException>generic(run) R_FULL_MATCH false




<? extends Exception>generic(Exception) <Exception>generic(exc) R_EQUIVALENT_MATCH false






<? extends Exception>generic(U)
generic(exc)
R_EQUIVALENT_MATCH true
<Object>generic(obj) R_ERASURE_MATCH false
<Exception>generic(exc) R_EQUIVALENT_MATCH false
<RuntimeException>generic(run) R_EQUIVALENT_MATCH false

Note: it is not possible to have extends clause while using IJavaElement search pattern as syntax does not allow it in code.

IJavaElement search pattern

Code
SearchMatch
Rule
SearchPattern.R_...
Raw

generic(null);
generic(exc)
R_FULL_MATCH
true
<Object>generic(obj) R_EQUIVALENT_MATCH false
<Exception>generic(exc) R_EQUIVALENT_MATCH false
<RuntimeException>generic(run) R_EQUIVALENT_MATCH false






<Exception>generic(exc);
generic(exc)
R_EQUIVALENT_MATCH true
<Object>generic(obj) R_ERASURE_MATCH false
<Exception>generic(exc) R_FULL_MATCH false
<RuntimeException>generic(run) R_ERASURE_MATCH false


Search for methods with parameterized (or raw) types parameters and/or parameterized (or raw) return type

Declarations

References

Currently, R_ERASURE_MATCH or R_EQUIVALENT_MATCH modes have no effect on this kind of search (1). If it appears an interesting mode to filter matches, it will be implemented in further version...

String search pattern

Code
SearchMatch
Rule
SearchPattern.R_...
Raw

paramTypesArgs
or
paramTypesArgs(Single)
or
paramTypesArgs(Single<Exception>)
(1)

new Single().
paramTypesArgs(gs);
R_FULL_MATCH true
new Single<Object>().
paramTypesArgs(gs);
R_FULL_MATCH false
new Single<Exception>().
paramTypesArgs(gs);
R_FULL_MATCH false
new Single<RuntimeException>().
paramTypesArgs(gs);
R_FULL_MATCH false





Single.paramTypesArgs
or
Single.paramTypesArgs(Single)
or
Single.paramTypesArgs(Single<Exception>)
(1)
new Single().
paramTypesArgs(gs);
R_FULL_MATCH true
new Single<Object>().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH false
new Single<Exception>().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH false
new Single<RuntimeException>().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH false





Single<Exception>.paramTypesArgs
or
Single<Exception>.paramTypesArgs(Single)
or
Single<Exception>.paramTypesArgs(Single<Exception>)
(1)
new Single().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH true
new Single<Object>().
paramTypesArgs(gs);
R_ERASURE_MATCH false
new Single<Exception>().
paramTypesArgs(gs);
R_FULL_MATCH false
new Single<RuntimeException>().
paramTypesArgs(gs);
R_ERASURE_MATCH false





Single<? extends Exception>.paramTypesArgs
or
Single<? extends Exception>.paramTypesArgs(Single)
or
Single<? extends Exception>.paramTypesArgs(Single<Exception>)
(1)
new Single().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH true
new Single<Object>().
paramTypesArgs(gs);
R_ERASURE_MATCH false
new Single<Exception>().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH false
new Single<RuntimeException>().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH false

Note: it is not possible to have extends clause while using IJavaElement search pattern as syntax does not allow it in code.

IJavaElement search pattern

Code
SearchMatch
Rule
SearchPattern.R_...
Raw

new Single().
paramTypesArgs(null);
new Single().
paramTypesArgs(gs);
R_FULL_MATCH
true
new Single<Object>().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH false
new Single<Exception>().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH false
new Single<RuntimeException>().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH false





new Single<Exception>().
paramTypesArgs(new Single<Exception>());
new Single().
paramTypesArgs(gs);
R_EQUIVALENT_MATCH true
new Single<Object>().
paramTypesArgs(gs);
R_ERASURE_MATCH false
new Single<Exception>().
paramTypesArgs(gs);
R_FULL_MATCH false
new Single<RuntimeException>().
paramTypesArgs(gs);
R_ERASURE_MATCH false