PsiType (@NotNull PsiExpression call, @NotNull PsiReferenceExpression methodExpression, @NotNull PsiMethod method, @NotNull Condition<? super IElementType> condition, @NotNull LanguageLevel languageLevel) { //JLS3 15.8.2 if (languageLevel.isAtLeast(LanguageLevel.JDK_1_5) && isGetClass(method)) { PsiExpression qualifier = methodExpression.getQualifierExpression(); PsiType qualifierType = null; final Project project = call.getProject(); if (qualifier != null) { qualifierType = TypeConversionUtil.erasure(qualifier.getType()); } else { PsiElement parent = call.getContext(); while (parent != null && condition.value(parent instanceof StubBasedPsiElement ? ((StubBasedPsiElement<?>)parent).getElementType() : parent.getNode().getElementType())) { parent = parent.getContext(); } if (parent != null) { qualifierType = JavaPsiFacade.getElementFactory(project).createType((PsiClass)parent); } } if (PsiTypes.nullType().equals(qualifierType)) { LOG.error("Unexpected null qualifier", new Attachment("expression.txt", call.getText())); } return createJavaLangClassType(methodExpression, qualifierType, true); } return null; }