Don't fail on requesting members of Java collection classes

RuntimeTypeMapper assumed that JavaPropertyDescriptor was necessarily backed by
JavaField, which has changed when we started to load Java method (or a pair of
methods) overriding a Kotlin property as a property, not as a method. Another
example of this situation is special built-in properties which are mapped to
Java methods, e.g. java.util.Collection#size() <-> kotlin.Collection#size. This
change adds support for the case of a property backed by a JavaMethod.

Note that callable references or usage of any reflection API related to
built-in members is not supported anyway and will currently fail with errors

 #KT-11258 Fixed
This commit is contained in:
Alexander Udalov
2016-03-02 13:47:47 +03:00
parent 6429dd4b04
commit 14b1a3a048
5 changed files with 65 additions and 14 deletions
@@ -4428,6 +4428,21 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
}
}
}
@TestMetadata("compiler/testData/codegen/boxWithStdlib/reflection/specialBuiltIns")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SpecialBuiltIns extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInSpecialBuiltIns() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/reflection/specialBuiltIns"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("getMembersOfStandardJavaClasses.kt")
public void testGetMembersOfStandardJavaClasses() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt");
doTestWithStdlib(fileName);
}
}
}
@TestMetadata("compiler/testData/codegen/boxWithStdlib/regressions")