void () { final PsiManager manager = PsiManager.getInstance(myProject); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(manager.getProject()); final PsiClass classFromText = factory.createClassFromText("class X extends Y<Z, W> {}", null); final PsiClass classX = classFromText.getInnerClasses()[0]; final PsiJavaCodeReferenceElement[] extendsOfX = classX.getExtendsList().getReferenceElements(); assertEquals(1, extendsOfX.length); final PsiJavaCodeReferenceElement ref = extendsOfX[0]; assertEquals("Y<Z,W>", ref.getCanonicalText()); assertEquals("Y", ref.getReferenceName()); final PsiTypeElement[] refParams = ref.getParameterList().getTypeParameterElements(); assertEquals(2, refParams.length); assertEquals("Z", refParams[0].getType().getCanonicalText()); assertEquals("W", refParams[1].getType().getCanonicalText()); final PsiType refType = factory.createType(ref); assertEquals("Y<Z,W>", refType.getCanonicalText()); final PsiJavaCodeReferenceElement reference = ((PsiClassReferenceType) refType).getReference(); assertEquals("Y<Z,W>", reference.getCanonicalText()); }