Test that primitives, arrays, enums are implicitly serializable on jvm and not js

Specifically test calling java function that accepts java.io.Serializable
This commit is contained in:
Pavel V. Talanov
2015-09-30 19:29:11 +03:00
parent 7b49baf8c3
commit a3fbf2fabc
8 changed files with 315 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
fun use(<!UNUSED_PARAMETER!>s<!>: java.io.Serializable) {
}
fun useList(<!UNUSED_PARAMETER!>s<!>: List<java.io.Serializable>) {
}
fun testPrimitives(b: Byte, ss: Short, i: Int, l: Long, d: Double, s: String, f: Float, bool: Boolean) {
use(b)
use(ss)
use(i)
use(l)
use(s)
use(f)
use(d)
use(bool)
}
class N
class S: java.io.Serializable
fun testArrays(ia: IntArray, ai: Array<Int>, an: Array<N>, a: Array<S>) {
use(ia)
use(ai)
use(an)
use(a)
}
fun testLiterals() {
use(1)
use(1.0)
use(11111111111111)
use("Asdsd")
use(true)
}
fun testNotSerializable(l: List<Int>) {
use(<!TYPE_MISMATCH!>l<!>)
use(<!TYPE_MISMATCH!>N()<!>)
}
enum class C {
E, E2
}
fun testEnums(a: Enum<*>) {
use(C.E)
use(C.E2)
use(a)
}
fun testLists(a: List<Int>) {
useList(a)
}
+43
View File
@@ -0,0 +1,43 @@
package
public fun testArrays(/*0*/ ia: kotlin.IntArray, /*1*/ ai: kotlin.Array<kotlin.Int>, /*2*/ an: kotlin.Array<N>, /*3*/ a: kotlin.Array<S>): kotlin.Unit
public fun testEnums(/*0*/ a: kotlin.Enum<*>): kotlin.Unit
public fun testLists(/*0*/ a: kotlin.List<kotlin.Int>): kotlin.Unit
public fun testLiterals(): kotlin.Unit
public fun testNotSerializable(/*0*/ l: kotlin.List<kotlin.Int>): kotlin.Unit
public fun testPrimitives(/*0*/ b: kotlin.Byte, /*1*/ ss: kotlin.Short, /*2*/ i: kotlin.Int, /*3*/ l: kotlin.Long, /*4*/ d: kotlin.Double, /*5*/ s: kotlin.String, /*6*/ f: kotlin.Float, /*7*/ bool: kotlin.Boolean): kotlin.Unit
public fun use(/*0*/ s: java.io.Serializable): kotlin.Unit
public fun useList(/*0*/ s: kotlin.List<java.io.Serializable>): kotlin.Unit
public final enum class C : kotlin.Enum<C> {
enum entry E
enum entry E2
private constructor C()
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: C): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): C
public final /*synthesized*/ fun values(): kotlin.Array<C>
}
public final class N {
public constructor N()
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
}
public final class S : java.io.Serializable {
public constructor S()
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
}
+60
View File
@@ -0,0 +1,60 @@
// FILE: B.kt
import aa.A.use
import aa.A.useList
fun testPrimitives(b: Byte, ss: Short, i: Int, l: Long, d: Double, s: String, f: Float, bool: Boolean) {
use(b)
use(ss)
use(i)
use(l)
use(s)
use(f)
use(d)
use(bool)
}
class N
class S: java.io.Serializable
fun testArrays(ia: IntArray, ai: Array<Int>, an: Array<N>, a: Array<S>) {
use(ia)
use(ai)
use(an)
use(a)
}
fun testLiterals() {
use(1)
use(1.0)
use(11111111111111)
use("Asdsd")
use(true)
}
fun testNotSerializable(l: List<Int>) {
use(<!TYPE_MISMATCH!>l<!>)
use(<!TYPE_MISMATCH!>N()<!>)
}
enum class C {
E, E2
}
fun testEnums(a: Enum<*>) {
use(C.E)
use(C.E2)
use(a)
}
fun testLists(a: List<Int>) {
useList(a)
}
// FILE: aa/A.java
package aa;
public class A {
public static void use(java.io.Serializable s) { }
public static void useList(java.util.List<? extends java.io.Serializable> s) { }
}
@@ -0,0 +1,41 @@
package
public fun testArrays(/*0*/ ia: kotlin.IntArray, /*1*/ ai: kotlin.Array<kotlin.Int>, /*2*/ an: kotlin.Array<N>, /*3*/ a: kotlin.Array<S>): kotlin.Unit
public fun testEnums(/*0*/ a: kotlin.Enum<*>): kotlin.Unit
public fun testLists(/*0*/ a: kotlin.List<kotlin.Int>): kotlin.Unit
public fun testLiterals(): kotlin.Unit
public fun testNotSerializable(/*0*/ l: kotlin.List<kotlin.Int>): kotlin.Unit
public fun testPrimitives(/*0*/ b: kotlin.Byte, /*1*/ ss: kotlin.Short, /*2*/ i: kotlin.Int, /*3*/ l: kotlin.Long, /*4*/ d: kotlin.Double, /*5*/ s: kotlin.String, /*6*/ f: kotlin.Float, /*7*/ bool: kotlin.Boolean): kotlin.Unit
public final enum class C : kotlin.Enum<C> {
enum entry E
enum entry E2
private constructor C()
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: C): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): C
public final /*synthesized*/ fun values(): kotlin.Array<C>
}
public final class N {
public constructor N()
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
}
public final class S : java.io.Serializable {
public constructor S()
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
}
@@ -0,0 +1,55 @@
fun use(<!UNUSED_PARAMETER!>s<!>: java.io.Serializable) {
}
fun useList(<!UNUSED_PARAMETER!>s<!>: List<java.io.Serializable>) {
}
fun testPrimitives(b: Byte, ss: Short, i: Int, l: Long, d: Double, s: String, f: Float, bool: Boolean) {
use(<!TYPE_MISMATCH!>b<!>)
use(<!TYPE_MISMATCH!>ss<!>)
use(<!TYPE_MISMATCH!>i<!>)
use(<!TYPE_MISMATCH!>l<!>)
use(<!TYPE_MISMATCH!>s<!>)
use(<!TYPE_MISMATCH!>f<!>)
use(<!TYPE_MISMATCH!>d<!>)
use(<!TYPE_MISMATCH!>bool<!>)
}
class N
class S: java.io.Serializable
fun testArrays(ia: IntArray, ai: Array<Int>, an: Array<N>, a: Array<S>) {
use(<!TYPE_MISMATCH!>ia<!>)
use(<!TYPE_MISMATCH!>ai<!>)
use(<!TYPE_MISMATCH!>an<!>)
use(<!TYPE_MISMATCH!>a<!>)
}
fun testLiterals() {
use(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
use(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1.0<!>)
use(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>11111111111111<!>)
use(<!TYPE_MISMATCH!>"Asdsd"<!>)
use(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>true<!>)
}
fun testNotSerializable(l: List<Int>) {
use(<!TYPE_MISMATCH!>l<!>)
use(<!TYPE_MISMATCH!>N()<!>)
}
enum class C {
E, E2
}
fun testEnums(a: Enum<*>) {
use(<!TYPE_MISMATCH!>C.E<!>)
use(<!TYPE_MISMATCH!>C.E2<!>)
use(<!TYPE_MISMATCH!>a<!>)
}
fun testLists(a: List<Int>) {
useList(<!TYPE_MISMATCH!>a<!>)
}
@@ -0,0 +1,43 @@
package
public fun testArrays(/*0*/ ia: kotlin.IntArray, /*1*/ ai: kotlin.Array<kotlin.Int>, /*2*/ an: kotlin.Array<N>, /*3*/ a: kotlin.Array<S>): kotlin.Unit
public fun testEnums(/*0*/ a: kotlin.Enum<*>): kotlin.Unit
public fun testLists(/*0*/ a: kotlin.List<kotlin.Int>): kotlin.Unit
public fun testLiterals(): kotlin.Unit
public fun testNotSerializable(/*0*/ l: kotlin.List<kotlin.Int>): kotlin.Unit
public fun testPrimitives(/*0*/ b: kotlin.Byte, /*1*/ ss: kotlin.Short, /*2*/ i: kotlin.Int, /*3*/ l: kotlin.Long, /*4*/ d: kotlin.Double, /*5*/ s: kotlin.String, /*6*/ f: kotlin.Float, /*7*/ bool: kotlin.Boolean): kotlin.Unit
public fun use(/*0*/ s: java.io.Serializable): kotlin.Unit
public fun useList(/*0*/ s: kotlin.List<java.io.Serializable>): kotlin.Unit
public final enum class C : kotlin.Enum<C> {
enum entry E
enum entry E2
private constructor C()
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: C): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): C
public final /*synthesized*/ fun values(): kotlin.Array<C>
}
public final class N {
public constructor N()
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
}
public final class S : java.io.Serializable {
public constructor S()
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
}
@@ -493,6 +493,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("Serializable.kt")
public void testSerializable() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/Serializable.kt");
doTest(fileName);
}
@TestMetadata("ShiftFunctionTypes.kt")
public void testShiftFunctionTypes() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/ShiftFunctionTypes.kt");
@@ -8898,6 +8904,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("serializable.kt")
public void testSerializable() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/serializable.kt");
doTest(fileName);
}
@TestMetadata("Simple.kt")
public void testSimple() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/Simple.kt");
@@ -35,6 +35,12 @@ public class JetDiagnosticsTestWithJsStdLibGenerated extends AbstractJetDiagnost
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("Serializable.kt")
public void testSerializable() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/Serializable.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)