Search in sources :

Example 1 with JavaClassImpl

use of org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl in project kotlin by JetBrains.

the class JavaClassFinderImpl method findClass.

@Nullable
@Override
public JavaClass findClass(@NotNull ClassId classId) {
    PsiClass psiClass = javaFacade.findClass(classId, javaSearchScope);
    if (psiClass == null)
        return null;
    JavaClassImpl javaClass = new JavaClassImpl(psiClass);
    FqName fqName = classId.asSingleFqName();
    if (!fqName.equals(javaClass.getFqName())) {
        throw new IllegalStateException("Requested " + fqName + ", got " + javaClass.getFqName());
    }
    if (psiClass instanceof KtLightClassMarker) {
        throw new IllegalStateException("Kotlin light classes should not be found by JavaPsiFacade, resolving: " + fqName);
    }
    return javaClass;
}
Also used : JavaClassImpl(org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl) KtLightClassMarker(org.jetbrains.kotlin.asJava.KtLightClassMarker) FqName(org.jetbrains.kotlin.name.FqName) PsiClass(com.intellij.psi.PsiClass) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

PsiClass (com.intellij.psi.PsiClass)1 Nullable (org.jetbrains.annotations.Nullable)1 KtLightClassMarker (org.jetbrains.kotlin.asJava.KtLightClassMarker)1 JavaClassImpl (org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl)1 FqName (org.jetbrains.kotlin.name.FqName)1