void () { @Language("JAVA") String text = """ class Foo { Test<String> test = new Test<>(); }"""; PsiFile file = configureByText(JavaFileType.INSTANCE, text); PsiJavaCodeReferenceElement ref = PsiTreeUtil.findElementOfClassAtOffset(file, file.getText().indexOf("<>"), PsiJavaCodeReferenceElement.class, false); SmartPointerEx pointer = createPointer(ref.getParameterList().getTypeParameterElements()[0]); //noinspection UnusedAssignment ref = null; gcPointerCache(pointer); assertInstanceOf(pointer.getElement(), PsiTypeElement.class); }