diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java index 745c16b1fc1..52ed957800e 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java @@ -578,6 +578,7 @@ public class FunctionCodegen { int flags = getVisibilityAccessFlag(functionDescriptor) | getDeprecatedAccessFlag(functionDescriptor) | + ACC_SYNTHETIC | (functionDescriptor instanceof ConstructorDescriptor ? 0 : ACC_STATIC); Method defaultMethod = typeMapper.mapDefaultMethod(functionDescriptor, kind, owner); diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.java b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.java index ec5327372d0..595d9c8dbe4 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.java +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.java @@ -2,8 +2,6 @@ public final class C { @org.jetbrains.annotations.NotNull public final java.lang.String foo(@org.jetbrains.annotations.NotNull java.lang.String o, @org.jetbrains.annotations.NotNull java.lang.String s1, @org.jetbrains.annotations.NotNull java.lang.String k, @org.jetbrains.annotations.Nullable java.lang.String s2) { /* compiled code */ } - public static java.lang.String foo$default(C p, java.lang.String p1, java.lang.String p2, java.lang.String p3, java.lang.String p4, int p5) { /* compiled code */ } - @org.jetbrains.annotations.NotNull public java.lang.String foo(@org.jetbrains.annotations.NotNull java.lang.String p, @org.jetbrains.annotations.NotNull java.lang.String p1, @org.jetbrains.annotations.Nullable java.lang.String p2) { /* compiled code */ } diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.java b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.java index 155cc497e70..1734b589a48 100644 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.java +++ b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.java @@ -2,9 +2,6 @@ class WithoutPrimary { public static A test1() { return new A("123", "abc"); } - public static A test2() { - return new A(null, 1, 3, null); - } public static A test3() { return new A("123", 456); } diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.kt b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.kt index d8f88d7dce2..eb3431a45a0 100644 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.kt +++ b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.kt @@ -14,9 +14,6 @@ fun box(): String { val test1 = WithoutPrimary.test1().toString() if (test1 != "123#abc") return "fail1: $test1" - val test2 = WithoutPrimary.test2().toString() - if (test2 != "def_x#1") return "fail2: $test2" - val test3 = WithoutPrimary.test3().toString() if (test3 != "123#456") return "fail3: $test3" diff --git a/compiler/testData/codegen/boxWithStdlib/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt b/compiler/testData/codegen/boxWithStdlib/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt new file mode 100644 index 00000000000..75dba0cc9d6 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt @@ -0,0 +1,6 @@ +class A(value: Int = 1) + +fun box(): String { + val constructors = javaClass().getConstructors().filter { !it.isSynthetic() } + return if (constructors.size() == 2) "OK" else constructors.size().toString() +} diff --git a/compiler/testData/compileJavaAgainstKotlin/method/DefaultMethod.java b/compiler/testData/compileJavaAgainstKotlin/method/DefaultMethod.java deleted file mode 100644 index e579193ce5d..00000000000 --- a/compiler/testData/compileJavaAgainstKotlin/method/DefaultMethod.java +++ /dev/null @@ -1,8 +0,0 @@ -package test; - -class JavaClass { - public static void main(String[] args) { - TestPackage.foo$default(1, 0); - } - -} diff --git a/compiler/testData/compileJavaAgainstKotlin/method/DefaultMethod.kt b/compiler/testData/compileJavaAgainstKotlin/method/DefaultMethod.kt deleted file mode 100644 index e1eaa706bd6..00000000000 --- a/compiler/testData/compileJavaAgainstKotlin/method/DefaultMethod.kt +++ /dev/null @@ -1,3 +0,0 @@ -package test - -fun foo(a: Int = 1) {} \ No newline at end of file diff --git a/compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.java b/compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.java index 634b2cd5f52..0a439117e6d 100644 --- a/compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.java +++ b/compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.java @@ -7,28 +7,18 @@ class JavaClass { } catch (E1 e) {} - try { - new One(1, 0, null); - } - catch (E1 e) {} - try { new One(); } catch (E1 e) {} - try { - One.one$default(instance, 1, 1); - } - catch (E1 e) {} - try { TestPackage.one(1); } catch (E1 e) {} try { - TestPackage.one$default(1, 0); + TestPackage.one(); } catch (E1 e) {} } diff --git a/compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.kt b/compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.kt index e2d115e4efa..ee669eadd51 100644 --- a/compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.kt +++ b/compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.kt @@ -2,7 +2,7 @@ package test class E1: Exception() -throws(javaClass()) +throws(javaClass()) overloads fun one(a: Int = 1) {} class One [throws(javaClass())] (a: Int = 1) { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java index 3ca6b824dbc..dd93ba61562 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java @@ -1260,6 +1260,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/defaultArguments/constructor"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("checkIfConstructorIsSynthetic.kt") + public void testCheckIfConstructorIsSynthetic() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt"); + doTestWithStdlib(fileName); + } + @TestMetadata("manyArgs.kt") public void testManyArgs() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/defaultArguments/constructor/manyArgs.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java index 439ba6685a5..bba19e38f59 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java @@ -160,12 +160,6 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg doTest(fileName); } - @TestMetadata("DefaultMethod.kt") - public void testDefaultMethod() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/method/DefaultMethod.kt"); - doTest(fileName); - } - @TestMetadata("Delegation.kt") public void testDelegation() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/method/Delegation.kt");