Load Java parameter names correctly in BinaryJavaMethod

PSI-based implementation (accessible via
`-Xuse-old-class-files-reading`) loads parameter names from the
"MethodParameters" attribute if it's present, so our own implementation
should as well.

This metadata doesn't seem supported in the java.lang.model.element API
though, so SymbolBasedValueParameter (which is used in `-Xuse-javac`)
will continue to have incorrect behavior for now

 #KT-25193 Fixed
This commit is contained in:
Alexander Udalov
2018-07-17 14:55:59 +02:00
parent 0f0602230a
commit 1464a4ac58
13 changed files with 181 additions and 16 deletions
@@ -711,6 +711,11 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
runTest("compiler/testData/codegen/java8/box/parametersMetadata/defaultImpls.kt");
}
@TestMetadata("delegation.kt")
public void testDelegation() throws Exception {
runTest("compiler/testData/codegen/java8/box/parametersMetadata/delegation.kt");
}
@TestMetadata("enum.kt")
public void testEnum() throws Exception {
runTest("compiler/testData/codegen/java8/box/parametersMetadata/enum.kt");
@@ -41,6 +41,11 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
runTest("compiler/testData/loadJava8/compiledJava/MapRemove.java");
}
@TestMetadata("ParameterNames.java")
public void testParameterNames() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/ParameterNames.java");
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
@@ -39,6 +39,11 @@ public class LoadJava8WithFastClassReadingTestGenerated extends AbstractLoadJava
runTest("compiler/testData/loadJava8/compiledJava/MapRemove.java");
}
@TestMetadata("ParameterNames.java")
public void testParameterNames() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/ParameterNames.java");
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
@@ -41,6 +41,11 @@ public class LoadJava8UsingJavacTestGenerated extends AbstractLoadJava8UsingJava
runTest("compiler/testData/loadJava8/compiledJava/MapRemove.java");
}
@TestMetadata("ParameterNames.java")
public void testParameterNames() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/ParameterNames.java");
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");