Fix maven build
Do not create class objects for classes which come from Java.
This commit is contained in:
+10
-3
@@ -114,8 +114,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
||||
}
|
||||
|
||||
this.staticMembers = staticMembers;
|
||||
this.kotlin = psiClass != null &&
|
||||
(new PsiClassWrapper(psiClass).getJetClass().isDefined() || psiClass.getName().equals(JvmAbi.PACKAGE_CLASS));
|
||||
this.kotlin = psiClass != null && isKotlinClass(psiClass);
|
||||
classOrNamespaceDescriptor = descriptor;
|
||||
|
||||
if (fqName != null && fqName.lastSegmentIs(Name.identifier(JvmAbi.PACKAGE_CLASS)) && psiClass != null && kotlin) {
|
||||
@@ -586,6 +585,10 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
||||
return createClassObjectDescriptorForEnum(containing, psiClass);
|
||||
}
|
||||
|
||||
if (!isKotlinClass(psiClass)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If there's at least one inner enum, we need to create a class object (to put this enum into)
|
||||
for (PsiClass innerClass : psiClass.getInnerClasses()) {
|
||||
if (isInnerEnum(innerClass, containing)) {
|
||||
@@ -610,6 +613,10 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
||||
return classObjectDescriptor;
|
||||
}
|
||||
|
||||
private static boolean isKotlinClass(@NotNull PsiClass psiClass) {
|
||||
return new PsiClassWrapper(psiClass).getJetClass().isDefined() || psiClass.getName().equals(JvmAbi.PACKAGE_CLASS);
|
||||
}
|
||||
|
||||
private static boolean isInnerEnum(@NotNull PsiClass innerClass, DeclarationDescriptor owner) {
|
||||
if (!innerClass.isEnum()) return false;
|
||||
if (!(owner instanceof ClassDescriptor)) return false;
|
||||
@@ -679,7 +686,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
||||
if (clazz == null) {
|
||||
throw new IllegalStateException("PsiClass not found by name " + containerFqName + ", required to be container declaration of " + fqName);
|
||||
}
|
||||
if (isInnerEnum(psiClass, clazz)) {
|
||||
if (isInnerEnum(psiClass, clazz) && isKotlinClass(psiClass)) {
|
||||
ClassDescriptor classObjectDescriptor = clazz.getClassObjectDescriptor();
|
||||
if (classObjectDescriptor == null) {
|
||||
throw new IllegalStateException("Class object for a class with inner enum should've been created earlier: " + clazz);
|
||||
|
||||
Reference in New Issue
Block a user