Use manual type mapping in reflection for members from built-ins
There are cases when members deserialized from JVM classes have no JVM signature in the proto. For example, if a member is inherited from a built-in class (such as Map.getOrDefault in some Map implementations), or if a member is synthesized in the compiler front-end and back-end separately (such as enum values/valueOf). In these cases, we'll use the naive type mapping to try to recover the signature. #KT-16616 Fixed #KT-17542 Fixed
This commit is contained in:
+38
-18
@@ -16408,6 +16408,34 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/builtins")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Builtins extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInBuiltins() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/builtins"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("collections.kt")
|
||||
public void testCollections() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/builtins/collections.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enumNameOrdinal.kt")
|
||||
public void testEnumNameOrdinal() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/builtins/enumNameOrdinal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("stringLength.kt")
|
||||
public void testStringLength() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/builtins/stringLength.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/call")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -17129,6 +17157,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/reflection/functions/declaredVsInheritedFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enumValuesValueOf.kt")
|
||||
public void testEnumValuesValueOf() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/functions/enumValuesValueOf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionFromStdlib.kt")
|
||||
public void testFunctionFromStdlib() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/functions/functionFromStdlib.kt");
|
||||
@@ -17581,6 +17614,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/methodsFromAny"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("builtinFunctionsToString.kt")
|
||||
public void testBuiltinFunctionsToString() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/methodsFromAny/builtinFunctionsToString.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferencesEqualToCallablesFromAPI.kt")
|
||||
public void testCallableReferencesEqualToCallablesFromAPI() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt");
|
||||
@@ -18224,24 +18262,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/specialBuiltIns")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SpecialBuiltIns extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSpecialBuiltIns() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/specialBuiltIns"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("getMembersOfStandardJavaClasses.kt")
|
||||
public void testGetMembersOfStandardJavaClasses() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/supertypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user