Add tests for publicField
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
public final class C {
|
||||
@kotlin.jvm.publicField
|
||||
public final java.lang.String foo = "A";
|
||||
|
||||
public C() { /* compiled code */ }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// C
|
||||
|
||||
class C {
|
||||
@[kotlin.jvm.publicField] private val foo: String = "A"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
public class Test {
|
||||
public static String invokeMethodWithPublicField() {
|
||||
C c = new C();
|
||||
return c.foo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
@publicField private val foo: String = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Test.invokeMethodWithPublicField()
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
class C {
|
||||
|
||||
<!INAPPLICABLE_PUBLIC_FIELD!>@kotlin.jvm.publicField<!> constructor(s: String) {
|
||||
|
||||
}
|
||||
|
||||
<!INAPPLICABLE_PUBLIC_FIELD!>@kotlin.jvm.publicField<!> private fun foo(s: String = "OK") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
<!INAPPLICABLE_PUBLIC_FIELD!>@kotlin.jvm.publicField<!>
|
||||
fun foo() {
|
||||
<!INAPPLICABLE_PUBLIC_FIELD!>@kotlin.jvm.publicField<!> val <!UNUSED_VARIABLE!>x<!> = "A"
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
kotlin.jvm.publicField() internal fun foo(): kotlin.Unit
|
||||
|
||||
internal final class C {
|
||||
kotlin.jvm.publicField() public constructor C(/*0*/ s: kotlin.String)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.jvm.publicField() private final fun foo(/*0*/ s: kotlin.String = ...): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
private <!INAPPLICABLE_PUBLIC_FIELD!>@publicField<!> val a: String by lazy { "A" }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package
|
||||
|
||||
internal final class C {
|
||||
public constructor C()
|
||||
kotlin.jvm.publicField() private final val a: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -148,6 +148,12 @@ public class KotlinLightClassTestGenerated extends AbstractKotlinLightClassTest
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PublicField.kt")
|
||||
public void testPublicField() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/PublicField.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Synthetic.kt")
|
||||
public void testSynthetic() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Synthetic.kt");
|
||||
|
||||
+21
@@ -429,6 +429,27 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/publicField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PublicField extends AbstractJetDiagnosticsTestWithStdLib {
|
||||
public void testAllFilesPresentInPublicField() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations/publicField"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("publicFieldNotOnProperty.kt")
|
||||
public void testPublicFieldNotOnProperty() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldNotOnProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("publicFieldOnDelegatedProperty.kt")
|
||||
public void testPublicFieldOnDelegatedProperty() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/publicField/publicFieldOnDelegatedProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature")
|
||||
|
||||
+16
@@ -249,6 +249,22 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithJava/publicField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PublicField extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInPublicField() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/publicField"), Pattern.compile("^([^\\.]+)$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("simple")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/publicField/simple/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithJava/reflection")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user