Fix for KT-10110: ClassReader$BadClassFile undeclared type variable: E
#KT-10110 Fixed
This commit is contained in:
+2
-2
@@ -263,13 +263,13 @@ public class BothSignatureWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JvmMethodSignature makeJvmMethodSignature(@NotNull String name) {
|
public JvmMethodSignature makeJvmMethodSignature(@NotNull String name, boolean skipGenericSignature) {
|
||||||
List<Type> types = new ArrayList<Type>(kotlinParameterTypes.size());
|
List<Type> types = new ArrayList<Type>(kotlinParameterTypes.size());
|
||||||
for (JvmMethodParameterSignature parameter : kotlinParameterTypes) {
|
for (JvmMethodParameterSignature parameter : kotlinParameterTypes) {
|
||||||
types.add(parameter.getAsmType());
|
types.add(parameter.getAsmType());
|
||||||
}
|
}
|
||||||
Method asmMethod = new Method(name, jvmReturnType, types.toArray(new Type[types.size()]));
|
Method asmMethod = new Method(name, jvmReturnType, types.toArray(new Type[types.size()]));
|
||||||
return new JvmMethodSignature(asmMethod, makeJavaGenericSignature(), kotlinParameterTypes);
|
return new JvmMethodSignature(asmMethod, !skipGenericSignature ? makeJavaGenericSignature() : null, kotlinParameterTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentSignatureSize() {
|
public int getCurrentSignatureSize() {
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ public class JetTypeMapper {
|
|||||||
sw.writeReturnType();
|
sw.writeReturnType();
|
||||||
mapType(descriptor.getType(), sw, JetTypeMapperMode.VALUE_FOR_ANNOTATION);
|
mapType(descriptor.getType(), sw, JetTypeMapperMode.VALUE_FOR_ANNOTATION);
|
||||||
sw.writeReturnTypeEnd();
|
sw.writeReturnTypeEnd();
|
||||||
return sw.makeJvmMethodSignature(descriptor.getName().asString());
|
return sw.makeJvmMethodSignature(descriptor.getName().asString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -1071,8 +1071,7 @@ public class JetTypeMapper {
|
|||||||
sw.writeReturnTypeEnd();
|
sw.writeReturnTypeEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
JvmMethodSignature signature = sw.makeJvmMethodSignature(mapFunctionName(f));
|
JvmMethodSignature signature = sw.makeJvmMethodSignature(mapFunctionName(f), f instanceof AccessorForCallableDescriptor);
|
||||||
|
|
||||||
|
|
||||||
if (kind != OwnerKind.DEFAULT_IMPLS) {
|
if (kind != OwnerKind.DEFAULT_IMPLS) {
|
||||||
SpecialSignatureInfo specialSignatureInfo = BuiltinMethodsWithSpecialGenericSignature.getSpecialSignatureInfo(f);
|
SpecialSignatureInfo specialSignatureInfo = BuiltinMethodsWithSpecialGenericSignature.getSpecialSignatureInfo(f);
|
||||||
@@ -1394,7 +1393,7 @@ public class JetTypeMapper {
|
|||||||
|
|
||||||
writeVoidReturn(sw);
|
writeVoidReturn(sw);
|
||||||
|
|
||||||
return sw.makeJvmMethodSignature("<init>");
|
return sw.makeJvmMethodSignature("<init>", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type getSharedVarType(DeclarationDescriptor descriptor) {
|
public Type getSharedVarType(DeclarationDescriptor descriptor) {
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
class MyList<T> {
|
||||||
|
|
||||||
|
private fun noSignature(): T? = null
|
||||||
|
|
||||||
|
fun withSignature(): T? = null
|
||||||
|
|
||||||
|
fun removeHeader() {
|
||||||
|
fun a () {
|
||||||
|
noSignature()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Class signature,
|
||||||
|
local fun class signature,
|
||||||
|
'noSignature' and 'withSignature' fun signatures
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 4 signature
|
||||||
|
// 2 signature \(\)TT\;
|
||||||
|
// 1 signature Lkotlin/jvm/internal/Lambda\;Lkotlin/jvm/functions/Function0<Lkotlin/Unit\;>\;
|
||||||
|
// 1 signature <T:Ljava/lang/Object\;>Ljava/lang/Object\;
|
||||||
|
// 1 public final static synthetic access\$noSignature\(LMyList\;\)Ljava/lang/Object
|
||||||
@@ -800,6 +800,21 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/bytecodeText/signature")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Signature extends AbstractBytecodeTextTest {
|
||||||
|
public void testAllFilesPresentInSignature() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/signature"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noSignatureInSyntheticAccessor.kt")
|
||||||
|
public void testNoSignatureInSyntheticAccessor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/signature/noSignatureInSyntheticAccessor.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/bytecodeText/statements")
|
@TestMetadata("compiler/testData/codegen/bytecodeText/statements")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user