Support named arguments for Java constructors annotated with KotlinSignature
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public class genericConstructor<T extends Number> {
|
||||
public genericConstructor(T number) {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import test.genericConstructor
|
||||
|
||||
class Subclass : genericConstructor<Int>(42) {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
Subclass()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// FILE: A.java
|
||||
|
||||
public @interface A {
|
||||
int x();
|
||||
|
||||
String y();
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
A(x = 1, y = "2")
|
||||
fun test() {}
|
||||
@@ -0,0 +1,9 @@
|
||||
// FILE: A.java
|
||||
|
||||
public class A {
|
||||
public A(int x, String y) {}
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
val test = A(<!NAMED_ARGUMENTS_NOT_ALLOWED!>x<!> = 1, <!NAMED_ARGUMENTS_NOT_ALLOWED!>y<!> = "2")
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// FILE: A.java
|
||||
|
||||
import kotlin.jvm.KotlinSignature;
|
||||
|
||||
public class A {
|
||||
@KotlinSignature("fun A(x: Int, y: String)")
|
||||
public A(int x, String y) {}
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
val test = A(x = 1, y = "2")
|
||||
@@ -4766,6 +4766,16 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/tests/namedArguments"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("allowForJavaAnnotation.kt")
|
||||
public void testAllowForJavaAnnotation() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/namedArguments/allowForJavaAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("disallowForJavaConstructor.kt")
|
||||
public void testDisallowForJavaConstructor() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/namedArguments/disallowForJavaConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("disallowForJavaMethods.kt")
|
||||
public void testDisallowForJavaMethods() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt");
|
||||
|
||||
@@ -99,6 +99,11 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/testsWithStdLib/kotlinSignature"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorNamedArguments.kt")
|
||||
public void testConstructorNamedArguments() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/testsWithStdLib/kotlinSignature/constructorNamedArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parameterNames.kt")
|
||||
public void testParameterNames() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/testsWithStdLib/kotlinSignature/parameterNames.kt");
|
||||
|
||||
+15
-1
@@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/boxWithJava")
|
||||
@InnerTestClasses({BlackBoxWithJavaCodegenTestGenerated.Annotations.class, BlackBoxWithJavaCodegenTestGenerated.CallableReference.class, BlackBoxWithJavaCodegenTestGenerated.Enum.class, BlackBoxWithJavaCodegenTestGenerated.Functions.class, BlackBoxWithJavaCodegenTestGenerated.InnerClass.class, BlackBoxWithJavaCodegenTestGenerated.Property.class, BlackBoxWithJavaCodegenTestGenerated.Sam.class, BlackBoxWithJavaCodegenTestGenerated.StaticFun.class, BlackBoxWithJavaCodegenTestGenerated.Visibility.class})
|
||||
@InnerTestClasses({BlackBoxWithJavaCodegenTestGenerated.Annotations.class, BlackBoxWithJavaCodegenTestGenerated.CallableReference.class, BlackBoxWithJavaCodegenTestGenerated.Constructor.class, BlackBoxWithJavaCodegenTestGenerated.Enum.class, BlackBoxWithJavaCodegenTestGenerated.Functions.class, BlackBoxWithJavaCodegenTestGenerated.InnerClass.class, BlackBoxWithJavaCodegenTestGenerated.Property.class, BlackBoxWithJavaCodegenTestGenerated.Sam.class, BlackBoxWithJavaCodegenTestGenerated.StaticFun.class, BlackBoxWithJavaCodegenTestGenerated.Visibility.class})
|
||||
public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInBoxWithJava() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@@ -88,6 +88,19 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithJava/constructor")
|
||||
public static class Constructor extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInConstructor() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithJava/constructor"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("genericConstructor.kt")
|
||||
public void testGenericConstructor() throws Exception {
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/constructor/genericConstructor.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithJava/enum")
|
||||
public static class Enum extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInEnum() throws Exception {
|
||||
@@ -552,6 +565,7 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
||||
suite.addTestSuite(BlackBoxWithJavaCodegenTestGenerated.class);
|
||||
suite.addTestSuite(Annotations.class);
|
||||
suite.addTestSuite(CallableReference.class);
|
||||
suite.addTestSuite(Constructor.class);
|
||||
suite.addTestSuite(Enum.class);
|
||||
suite.addTestSuite(Functions.class);
|
||||
suite.addTestSuite(InnerClass.class);
|
||||
|
||||
Reference in New Issue
Block a user