ClassFormatError because of initializing variable with Any type with primitive value
#KT-3524 Fixed
This commit is contained in:
@@ -122,9 +122,9 @@ public class PropertyCodegen extends GenerationStateAware {
|
||||
|
||||
private FieldVisitor generateBackingFieldAccess(PsiElement p, PropertyDescriptor propertyDescriptor) {
|
||||
Object value = null;
|
||||
JetExpression initializer = p instanceof JetProperty ? ((JetProperty) p).getInitializer() : null;
|
||||
if (initializer != null) {
|
||||
if (initializer instanceof JetConstantExpression && !propertyDescriptor.getType().isNullable()) {
|
||||
if (p instanceof JetProperty && !ImplementationBodyCodegen.shouldInitializeProperty((JetProperty) p, typeMapper)) {
|
||||
JetExpression initializer = ((JetProperty) p).getInitializer();
|
||||
if (initializer != null) {
|
||||
CompileTimeConstant<?> compileTimeValue = bindingContext.get(BindingContext.COMPILE_TIME_VALUE, initializer);
|
||||
value = compileTimeValue != null ? compileTimeValue.getValue() : null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
val i: Any = 12
|
||||
|
||||
fun box(): String {
|
||||
return if (i == 12) "OK" else "fail"
|
||||
}
|
||||
@@ -3534,6 +3534,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest("compiler/testData/codegen/box/properties/kt3118.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3524.kt")
|
||||
public void testKt3524() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/properties/kt3524.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3551.kt")
|
||||
public void testKt3551() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/properties/kt3551.kt");
|
||||
|
||||
Reference in New Issue
Block a user