Generated field for classObject is now final
EA-38323 Fixed - Illegal field modifiers in class
This commit is contained in:
@@ -596,7 +596,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
final ClassDescriptor descriptor1 = bindingContext.get(BindingContext.CLASS, classObject.getObjectDeclaration());
|
final ClassDescriptor descriptor1 = bindingContext.get(BindingContext.CLASS, classObject.getObjectDeclaration());
|
||||||
assert descriptor1 != null;
|
assert descriptor1 != null;
|
||||||
Type type = Type.getObjectType(typeMapper.mapType(descriptor1).getInternalName());
|
Type type = Type.getObjectType(typeMapper.mapType(descriptor1).getInternalName());
|
||||||
v.newField(classObject, ACC_PUBLIC | ACC_STATIC, "$classobj", type.getDescriptor(), null, null);
|
v.newField(classObject, ACC_PUBLIC | ACC_STATIC | ACC_FINAL, "$classobj", type.getDescriptor(), null, null);
|
||||||
|
|
||||||
staticInitializerChunks.add(new CodeChunk() {
|
staticInitializerChunks.add(new CodeChunk() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// EA-38323 - Illegal field modifiers in class: classObject field in C must be static and final
|
||||||
|
|
||||||
|
trait C {
|
||||||
|
class object {
|
||||||
|
public val FOO: String = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return C.FOO
|
||||||
|
}
|
||||||
|
|
||||||
@@ -217,6 +217,11 @@ public class ClassGenTest extends CodegenTestCase {
|
|||||||
blackBoxFile("classes/classObject.jet");
|
blackBoxFile("classes/classObject.jet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testClassObjectInTrait() throws Exception {
|
||||||
|
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||||
|
blackBoxFile("classes/classObjectInTrait.jet");
|
||||||
|
}
|
||||||
|
|
||||||
public void testClassObjectMethod() throws Exception {
|
public void testClassObjectMethod() throws Exception {
|
||||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||||
// todo to be implemented after removal of type info
|
// todo to be implemented after removal of type info
|
||||||
|
|||||||
Reference in New Issue
Block a user