mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-14 08:31:29 +00:00
Generate annotations in proper order in DefaultImpls
This commit is contained in:
@@ -223,8 +223,7 @@ public class FunctionCodegen {
|
||||
|
||||
generateMethodAnnotations(functionDescriptor, asmMethod, mv);
|
||||
|
||||
JvmMethodSignature signature = typeMapper.mapSignatureSkipGeneric(functionDescriptor);
|
||||
generateParameterAnnotations(functionDescriptor, mv, signature);
|
||||
generateParameterAnnotations(functionDescriptor, mv, jvmSignature);
|
||||
GenerateJava8ParameterNamesKt.generateParameterNames(functionDescriptor, mv, jvmSignature, state, (flags & ACC_SYNTHETIC) != 0);
|
||||
|
||||
generateBridges(functionDescriptor);
|
||||
|
||||
20
compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt
vendored
Normal file
20
compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// FULL_JDK
|
||||
// WITH_REFLECT
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
annotation class Anno(val value: String)
|
||||
|
||||
interface Test {
|
||||
fun foo(@Anno("OK") a: String) = "123"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testMethod = Class.forName("Test\$DefaultImpls").declaredMethods.single()
|
||||
//return (::test.parameters.single().annotations.single() as Simple).value
|
||||
val receiverAnnotations = (testMethod.parameters[0]).annotations
|
||||
if (receiverAnnotations.isNotEmpty()) return "fail: receiver parameter should not have any annotations, but: ${receiverAnnotations.joinToString()}"
|
||||
|
||||
val value2 = ((testMethod.parameters[1]).annotations.single() as Anno).value
|
||||
|
||||
return value2
|
||||
}
|
||||
@@ -128,6 +128,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterAnnotationInDefaultImpls.kt")
|
||||
public void testParameterAnnotationInDefaultImpls() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterWithPrimitiveType.kt")
|
||||
public void testParameterWithPrimitiveType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterWithPrimitiveType.kt");
|
||||
|
||||
@@ -128,6 +128,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterAnnotationInDefaultImpls.kt")
|
||||
public void testParameterAnnotationInDefaultImpls() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterWithPrimitiveType.kt")
|
||||
public void testParameterWithPrimitiveType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterWithPrimitiveType.kt");
|
||||
|
||||
@@ -140,6 +140,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterAnnotationInDefaultImpls.kt")
|
||||
public void testParameterAnnotationInDefaultImpls() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterWithPrimitiveType.kt")
|
||||
public void testParameterWithPrimitiveType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterWithPrimitiveType.kt");
|
||||
|
||||
@@ -212,6 +212,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("parameterAnnotationInDefaultImpls.kt")
|
||||
public void testParameterAnnotationInDefaultImpls() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("parameterWithPrimitiveType.kt")
|
||||
public void testParameterWithPrimitiveType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterWithPrimitiveType.kt");
|
||||
|
||||
Reference in New Issue
Block a user