Light Classes: Do not add "final" modifier to enum light classes
This commit is contained in:
@@ -142,7 +142,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jetClass.hasModifier(JetTokens.OPEN_KEYWORD) && !isAbstract) {
|
if (!jetClass.hasModifier(JetTokens.OPEN_KEYWORD) && !isAbstract) {
|
||||||
isFinal = true;
|
// Light-class mode: Do not make enum classes final since PsiClass corresponding to enum is expected to be inheritable from
|
||||||
|
isFinal = !(jetClass.isEnum() && state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES);
|
||||||
}
|
}
|
||||||
isStatic = !jetClass.isInner();
|
isStatic = !jetClass.isInner();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -431,7 +431,7 @@ public class KotlinLightClassForExplicitDeclaration extends KotlinWrappingLightC
|
|||||||
if (isAbstract(classOrObject)) {
|
if (isAbstract(classOrObject)) {
|
||||||
psiModifiers.add(PsiModifier.ABSTRACT);
|
psiModifiers.add(PsiModifier.ABSTRACT);
|
||||||
}
|
}
|
||||||
else if (!classOrObject.hasModifier(OPEN_KEYWORD)) {
|
else if (!(classOrObject.hasModifier(OPEN_KEYWORD) || (classOrObject instanceof JetClass && ((JetClass) classOrObject).isEnum()))) {
|
||||||
psiModifiers.add(PsiModifier.FINAL);
|
psiModifiers.add(PsiModifier.FINAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public abstract class KotlinLightClassStructureTest extends KotlinAsJavaTestBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testEnum() {
|
public void testEnum() {
|
||||||
checkModifiers("test.Enum", PUBLIC, FINAL, ENUM);
|
checkModifiers("test.Enum", PUBLIC, ENUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTrait() {
|
public void testTrait() {
|
||||||
|
|||||||
Reference in New Issue
Block a user