How to get PsiArrayType to PsiType

46 views
Skip to first unread message

dehao wang

unread,
Nov 15, 2021, 8:45:41 AM11/15/21
to lint-dev
I'm having trouble getting the PsiType from a PsiArrayType, as I want to make sure that the class object in the array of classes extends from specific interfaces.

e.g i have this
>>>>>>>>>>>>>>>>
Class[] classes = {
   TestClass1.class,
   Object.class
};

new TestClass1().registerServices(classes); //classes = PsiArrayType
<<<<<<<<<<<<<<<<<<

Is there a way to get my PsiType<Class> from PsiArrayType<Class[]> ?


Tor Norbye

unread,
Nov 24, 2021, 2:23:38 PM11/24/21
to lint-dev
Try PsiType.getDeepComponentType() (or if you just want the type of the array, PsiArrayType.getComponentType)

-- Tor

Reply all
Reply to author
Forward
0 new messages