@JvmOverloads-generated overloads of final methods are also final; test to verify that overloads of deprecated methods are deprecated
This commit is contained in:
+4
-1
@@ -121,7 +121,10 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
) {
|
||||
val typeMapper = state.typeMapper
|
||||
val isStatic = AsmUtil.isStaticMethod(contextKind, functionDescriptor)
|
||||
val flags = AsmUtil.getCommonCallableFlags(functionDescriptor) or (if (isStatic) Opcodes.ACC_STATIC else 0)
|
||||
val flags = AsmUtil.getCommonCallableFlags(functionDescriptor) or
|
||||
(if (isStatic) Opcodes.ACC_STATIC else 0) or
|
||||
(if (functionDescriptor.modality == Modality.FINAL && functionDescriptor !is ConstructorDescriptor) Opcodes.ACC_FINAL else 0)
|
||||
|
||||
val remainingParameters = getRemainingParameters(functionDescriptor.original, substituteCount)
|
||||
val signature = typeMapper.mapSignature(functionDescriptor, contextKind, remainingParameters, false)
|
||||
val mv = classBuilder.newMethod(OtherOrigin(methodElement, functionDescriptor), flags,
|
||||
|
||||
+2
-2
@@ -5,11 +5,11 @@ public final class C {
|
||||
|
||||
@kotlin.jvm.JvmOverloads
|
||||
@org.jetbrains.annotations.NotNull
|
||||
public java.lang.String foo(@org.jetbrains.annotations.NotNull java.lang.String o, @org.jetbrains.annotations.NotNull java.lang.String o1, @org.jetbrains.annotations.Nullable java.lang.String o4) { /* compiled code */ }
|
||||
public final java.lang.String foo(@org.jetbrains.annotations.NotNull java.lang.String o, @org.jetbrains.annotations.NotNull java.lang.String o1, @org.jetbrains.annotations.Nullable java.lang.String o4) { /* compiled code */ }
|
||||
|
||||
@kotlin.jvm.JvmOverloads
|
||||
@org.jetbrains.annotations.NotNull
|
||||
public java.lang.String foo(@org.jetbrains.annotations.NotNull java.lang.String o1, @org.jetbrains.annotations.Nullable java.lang.String o4) { /* compiled code */ }
|
||||
public final java.lang.String foo(@org.jetbrains.annotations.NotNull java.lang.String o1, @org.jetbrains.annotations.Nullable java.lang.String o4) { /* compiled code */ }
|
||||
|
||||
public C() { /* compiled code */ }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class Foo {
|
||||
@JvmOverloads @Deprecated(message = "Foo") fun bar(x: String = "") {
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
public method <init>(): void
|
||||
public synthetic deprecated static @kotlin.Deprecated @kotlin.jvm.JvmOverloads method bar$default(p0: Foo, p1: java.lang.String, p2: int, p3: java.lang.Object): void
|
||||
public deprecated final @kotlin.Deprecated @kotlin.jvm.JvmOverloads method bar(): void
|
||||
public deprecated final @kotlin.Deprecated @kotlin.jvm.JvmOverloads method bar(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
@@ -122,6 +122,12 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedJvmOverloads.kt")
|
||||
public void testDeprecatedJvmOverloads() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeListing/annotations/deprecatedJvmOverloads.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JvmSynthetic.kt")
|
||||
public void testJvmSynthetic() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeListing/annotations/JvmSynthetic.kt");
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@ public final class Test {
|
||||
public final void c(int a, java.lang.String b)
|
||||
|
||||
@kotlin.jvm.JvmOverloads
|
||||
public void c(int a)
|
||||
public final void c(int a)
|
||||
|
||||
@kotlin.jvm.JvmOverloads
|
||||
public void c()
|
||||
public final void c()
|
||||
|
||||
@java.lang.Deprecated
|
||||
public final void d()
|
||||
|
||||
Reference in New Issue
Block a user