KT-7918 J2K: don't generate jvmOverloads on private declarations
#KT-7918 Fixed
This commit is contained in:
@@ -427,7 +427,7 @@ class Converter private constructor(
|
||||
|
||||
if (function == null) return null
|
||||
|
||||
if (function.parameterList.parameters.any { it.defaultValue != null }) {
|
||||
if (function.parameterList.parameters.any { it.defaultValue != null } && !function.modifiers.isPrivate) {
|
||||
function.annotations += Annotations(
|
||||
listOf(Annotation(Identifier("jvmOverloads").assignNoPrototype(),
|
||||
listOf(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class C jvmOverloads private constructor(arg1: Int, arg2: Int, arg3: Int = 0) {
|
||||
class C private constructor(arg1: Int, arg2: Int, arg3: Int = 0) {
|
||||
|
||||
public constructor(arg1: Int) : this(arg1, 0, 0) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
private int bar(String s) {
|
||||
System.out.println("s = " + s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int bar() {
|
||||
return bar(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
private fun bar(s: String? = null): Int {
|
||||
println("s = " + s!!)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -3520,6 +3520,12 @@ public class JavaToKotlinConverterForWebDemoTestGenerated extends AbstractJavaTo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Private.java")
|
||||
public void testPrivate() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/overloads/Private.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Simple.java")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/overloads/Simple.java");
|
||||
|
||||
@@ -3520,6 +3520,12 @@ public class JavaToKotlinConverterSingleFileTestGenerated extends AbstractJavaTo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Private.java")
|
||||
public void testPrivate() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/overloads/Private.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Simple.java")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/overloads/Simple.java");
|
||||
|
||||
Reference in New Issue
Block a user