Fix exception from backend in light classes mode for null passed as annotation argument
This commit is contained in:
@@ -389,7 +389,15 @@ public abstract class AnnotationCodegen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Void visitUnsupportedValue(ConstantValue<?> value) {
|
private Void visitUnsupportedValue(ConstantValue<?> value) {
|
||||||
throw new IllegalStateException("Don't know how to compile annotation value " + value);
|
ClassBuilderMode mode = typeMapper.getClassBuilderMode();
|
||||||
|
switch (mode) {
|
||||||
|
case FULL:
|
||||||
|
throw new IllegalStateException("Don't know how to compile annotation value " + value);
|
||||||
|
case LIGHT_CLASSES:
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unknown builder mode: " + mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// test for KT-5337
|
||||||
|
package test
|
||||||
|
|
||||||
|
annotation class A(val value: String)
|
||||||
|
|
||||||
|
@A(<error>null</error>)
|
||||||
|
fun foo() {}
|
||||||
|
|
||||||
|
@A(<error>null</error>)
|
||||||
|
class B
|
||||||
@@ -187,6 +187,12 @@ public class PsiCheckerTestGenerated extends AbstractPsiCheckerTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("NullAsAnnotationArgument.kt")
|
||||||
|
public void testNullAsAnnotationArgument() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/NullAsAnnotationArgument.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("Nullability.kt")
|
@TestMetadata("Nullability.kt")
|
||||||
public void testNullability() throws Exception {
|
public void testNullability() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/Nullability.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/Nullability.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user