How to get type of any psiElement?



i have problems getting any PsiType or PsiClass info from some psi elements:

PsiLocalVariable: how do i get the resulting type? 

PsiDeclarationStatement: how do i get the type of the declaration?

PsiMethodCallExpression: how do i get the return type of this method call?


I have no idea how to resolve this and the PsiViewer isnt helping at all.


What i need is full qualified name of the class name

1 comment


You can get the type from PSI by calling:

  • PsiLocalVariable.getType(), PsiMethodCallExpression.getMethodExpression().getType() and depending on the result, retrieve the type name (please inspect what inside of returned objects)
  •  PsiDeclarationStatement.getDeclaredElements() and using the above methods for declared elements

Please sign in to leave a comment.