KT-8206 java.lang.NoSuchFieldError: $kotlinClass for deprecated::class
Instantiate class literals for annotation classes as foreign.
This commit is contained in:
committed by
Alexander Udalov
parent
95f5d24988
commit
d540ff8890
@@ -2795,7 +2795,10 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
|
ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
ModuleDescriptor module = DescriptorUtils.getContainingModule(descriptor);
|
ModuleDescriptor module = DescriptorUtils.getContainingModule(descriptor);
|
||||||
if (descriptor instanceof JavaClassDescriptor || module == module.getBuiltIns().getBuiltInsModule()) {
|
// Instantiate annotation classes as foreign due to bug in JDK 6 and 7:
|
||||||
|
// http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6857918
|
||||||
|
if (descriptor instanceof JavaClassDescriptor || module == module.getBuiltIns().getBuiltInsModule() ||
|
||||||
|
DescriptorUtils.isAnnotationClass(descriptor)) {
|
||||||
putJavaLangClassInstance(v, classAsmType);
|
putJavaLangClassInstance(v, classAsmType);
|
||||||
wrapJavaClassIntoKClass(v);
|
wrapJavaClassIntoKClass(v);
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals("deprecated", deprecated::class.simpleName)
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+6
@@ -2751,6 +2751,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/reflection/classLiterals"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/reflection/classLiterals"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("annotationClassLiteral.kt")
|
||||||
|
public void testAnnotationClassLiteral() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/classLiterals/annotationClassLiteral.kt");
|
||||||
|
doTestWithStdlib(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("arrays.kt")
|
@TestMetadata("arrays.kt")
|
||||||
public void testArrays() throws Exception {
|
public void testArrays() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/classLiterals/arrays.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/classLiterals/arrays.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user