Move Closeable to its usage, move internal Serializable to kotlin package in JS, introduce internal typealias in kotlin.io in JVM.

This commit is contained in:
Ilya Gorbunov
2016-10-05 21:48:38 +03:00
parent a895702730
commit 660dc94f7c
13 changed files with 28 additions and 123 deletions
@@ -1,55 +0,0 @@
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<!>)
}
@@ -1,43 +0,0 @@
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.collections.List<kotlin.Int>): kotlin.Unit
public fun testLiterals(): kotlin.Unit
public fun testNotSerializable(/*0*/ l: kotlin.collections.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.collections.List<java.io.Serializable>): kotlin.Unit
public final enum class C : kotlin.Enum<C> {
enum entry E
enum entry E2
private constructor C()
public final override /*1*/ /*fake_override*/ val name: kotlin.String
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
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 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
}
@@ -35,12 +35,6 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("Serializable.kt")
public void testSerializable() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/Serializable.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
-8
View File
@@ -1,8 +0,0 @@
package java.io
@library
public interface Closeable {
public fun close(): Unit
}
internal interface Serializable
+4 -1
View File
@@ -101,4 +101,7 @@ internal inline fun <T> Array<out T>.copyToArrayOfAny(isVarargs: Boolean): Array
// no need to copy vararg array in JS
this
else
this.copyOf()
this.copyOf()
// temporary for shared code, until we have an annotation like JvmSerializable
internal interface Serializable
+4 -1
View File
@@ -1,6 +1,5 @@
package kotlin.dom
import java.io.Closeable
import org.w3c.dom.*
import org.w3c.dom.events.*
@@ -26,6 +25,10 @@ public fun mouseEventHandler(handler: (MouseEvent) -> Unit): EventListener {
}
}
public interface Closeable {
public open fun close(): Unit
}
/**
* Registers a handler on the named event
*/
-4
View File
@@ -340,10 +340,6 @@
append: throwAbstractFunctionInvocationError("Appendable#append")
});
Kotlin.Closeable = Kotlin.createTraitNow(null, null, {
close: throwAbstractFunctionInvocationError("Closeable#close")
});
Kotlin.safeParseInt = function (str) {
var r = parseInt(str, 10);
return isNaN(r) ? null : r;
@@ -19,7 +19,6 @@
package kotlin.collections
import java.io.Serializable
import java.util.*
import kotlin.comparisons.compareValues
@@ -3,7 +3,6 @@
package kotlin.collections
import java.io.Serializable
import java.util.*
private object EmptyMap : Map<Any?, Nothing>, Serializable {
@@ -3,7 +3,6 @@
package kotlin.collections
import java.io.Serializable
import java.util.*
@@ -0,0 +1,20 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:JvmVersion
package kotlin.io
// to use in shared code without imports
internal typealias Serializable = java.io.Serializable
-1
View File
@@ -2,7 +2,6 @@
package kotlin
import java.io.Serializable
import kotlin.reflect.KProperty
/**
@@ -1,7 +1,6 @@
@file:kotlin.jvm.JvmName("TuplesKt")
package kotlin
import java.io.Serializable
/**
* Represents a generic pair of two values.