Java generic method call

Answered

Hello,

 

this is probably a basic question but I'm having a hard time finding an answer.

 

Let's say I have a generic method in Java:

public <T> SomeClass<T> someMethod();

 

Which is then called with:

UtilityClass.<MyClass1>someMethod();

UtilityClass.<MyClass2>someMethod();

 

Is there a way to get those type arguments from a PsiMethod instance?

 

Best regards

 

 

 

 

 

0
1 comment

Hi,

What about PsiMethod.getTypeParameters()?

If you need to resolve actual types, take a look at:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000132250-resolve-generic-types

0

Please sign in to leave a comment.