JetDiagnosticsTest for using java enum in kotlin.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// FILE: test.kt
|
||||
|
||||
package test
|
||||
|
||||
import java.util.concurrent.TimeUnit.*
|
||||
|
||||
val c = SECONDS
|
||||
@@ -0,0 +1,11 @@
|
||||
// FILE: A.java
|
||||
public enum A {
|
||||
ENTRY;
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
package test
|
||||
|
||||
fun main() {
|
||||
A.valueOf("ENTRY"): A
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// FILE: A.java
|
||||
public enum A {
|
||||
ENTRY,
|
||||
ANOTHER;
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
package vvv
|
||||
|
||||
fun main() {
|
||||
A.values(): Array<A>
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// FILE: A.java
|
||||
public enum A {
|
||||
ENTRY,
|
||||
ANOTHER;
|
||||
|
||||
public String s() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
package vvv
|
||||
|
||||
fun main() {
|
||||
val c = A.ENTRY
|
||||
c.s()
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// FILE: A.java
|
||||
public enum A {
|
||||
ENTRY,
|
||||
ANOTHER;
|
||||
|
||||
public String ENTRY = "";
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
package vvv
|
||||
|
||||
fun main() {
|
||||
val c: A = A.ENTRY
|
||||
val <!UNUSED_VARIABLE!>c2<!>: String? = c.ENTRY
|
||||
val <!UNUSED_VARIABLE!>c3<!>: String? = A.ANOTHER.ENTRY
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// FILE: A.java
|
||||
public enum A {
|
||||
ENTRY("1"),
|
||||
ANOTHER("2");
|
||||
|
||||
public String s;
|
||||
|
||||
private A(String s) {
|
||||
this.s = s;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
package vvv
|
||||
|
||||
fun main() {
|
||||
val c = A.ENTRY
|
||||
c.s
|
||||
A.ANOTHER.s
|
||||
}
|
||||
@@ -1169,6 +1169,44 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/enum")
|
||||
public static class Enum extends AbstractDiagnosticsTestWithEagerResolve {
|
||||
public void testAllFilesPresentInEnum() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve", new File("compiler/testData/diagnostics/tests/enum"), "kt", false);
|
||||
}
|
||||
|
||||
@TestMetadata("importEnumFromJava.kt")
|
||||
public void testImportEnumFromJava() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/enum/importEnumFromJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaEnumValueOfMethod.kt")
|
||||
public void testJavaEnumValueOfMethod() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/enum/javaEnumValueOfMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaEnumValuesMethod.kt")
|
||||
public void testJavaEnumValuesMethod() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/enum/javaEnumValuesMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaEnumWithFuns.kt")
|
||||
public void testJavaEnumWithFuns() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/enum/javaEnumWithFuns.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaEnumWithNameClashing.kt")
|
||||
public void testJavaEnumWithNameClashing() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/enum/javaEnumWithNameClashing.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaEnumWithProperty.kt")
|
||||
public void testJavaEnumWithProperty() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/enum/javaEnumWithProperty.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/extensions")
|
||||
public static class Extensions extends AbstractDiagnosticsTestWithEagerResolve {
|
||||
public void testAllFilesPresentInExtensions() throws Exception {
|
||||
@@ -3027,6 +3065,8 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
suite.addTestSuite(DataFlow.class);
|
||||
suite.addTestSuite(DataFlowInfoTraversal.class);
|
||||
suite.addTest(DeclarationChecks.innerSuite());
|
||||
suite.addTestSuite(DeclarationChecks.class);
|
||||
suite.addTestSuite(Enum.class);
|
||||
suite.addTestSuite(Extensions.class);
|
||||
suite.addTestSuite(Generics.class);
|
||||
suite.addTest(IncompleteCode.innerSuite());
|
||||
|
||||
Reference in New Issue
Block a user