KT-5112 Generic signature lost for a field copied from class object to containing class
#KT-5112 Fixed
This commit is contained in:
@@ -1030,7 +1030,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
PropertyDescriptor property = info.descriptor;
|
||||
|
||||
FieldVisitor fv = v.newField(null, ACC_STATIC | ACC_FINAL | ACC_PUBLIC, context.getFieldName(property, false),
|
||||
typeMapper.mapType(property).getDescriptor(), null, info.defaultValue);
|
||||
typeMapper.mapType(property).getDescriptor(), typeMapper.mapFieldSignature(property.getType()),
|
||||
info.defaultValue);
|
||||
|
||||
AnnotationCodegen.forField(fv, typeMapper).genAnnotations(property);
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package test
|
||||
|
||||
class G<T>(val s: T) {
|
||||
|
||||
}
|
||||
|
||||
public trait ErrorsJvmTrait {
|
||||
class object {
|
||||
public val param : G<String> = G("STRING")
|
||||
}
|
||||
}
|
||||
|
||||
public class ErrorsJvmClass {
|
||||
class object {
|
||||
public val param : G<String> = G("STRING")
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val genericType = javaClass<ErrorsJvmTrait>().getField("param").getGenericType()
|
||||
if (genericType.toString() != "test.G<java.lang.String>") return "fail1: $genericType"
|
||||
|
||||
val genericType2 = javaClass<ErrorsJvmClass>().getField("param").getGenericType()
|
||||
if (genericType2.toString() != "test.G<java.lang.String>") return "fail1: genericType2"
|
||||
return "OK"
|
||||
}
|
||||
+5
@@ -1222,6 +1222,11 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithStdlib/reflection"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5112.kt")
|
||||
public void testKt5112() throws Exception {
|
||||
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/reflection/kt5112.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/reflection/insideLambda")
|
||||
public static class InsideLambda extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInInsideLambda() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user