New J2K: fix existing test data
This commit is contained in:
+2
-8
@@ -1,13 +1,7 @@
|
|||||||
// !specifyLocalVariableTypeByDefault: true
|
// !specifyLocalVariableTypeByDefault: true
|
||||||
package test
|
package test
|
||||||
|
|
||||||
class Test(str: String?) {
|
class Test(internal var myStr: String?) {
|
||||||
internal var myStr: String? = "String2"
|
|
||||||
|
|
||||||
init {
|
|
||||||
myStr = str
|
|
||||||
}
|
|
||||||
|
|
||||||
fun sout(str: String?) {
|
fun sout(str: String?) {
|
||||||
println(str)
|
println(str)
|
||||||
}
|
}
|
||||||
@@ -18,7 +12,7 @@ class Test(str: String?) {
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
sout("String")
|
sout("String")
|
||||||
val test: String? = "String2"
|
val test: String = "String2"
|
||||||
sout(test)
|
sout(test)
|
||||||
sout(dummy(test))
|
sout(dummy(test))
|
||||||
|
|
||||||
|
|||||||
-2
@@ -1,5 +1,3 @@
|
|||||||
package demo;
|
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
void test() {
|
void test() {
|
||||||
Integer i = Integer.valueOf(100);
|
Integer i = Integer.valueOf(100);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
for (n in list!!) {
|
for (n in list) {
|
||||||
var i = 1
|
var i = 1
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
for (n in list!!) {
|
for (n in list) {
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
var i = 0
|
var i = 0
|
||||||
for (n in list!!) i++
|
for (n in list) i++
|
||||||
@@ -1 +1 @@
|
|||||||
for (n in list!!) return n
|
for (n in list) return n
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
internal class A {
|
internal class A {
|
||||||
var list: List<String?>? = null
|
var list: List<String>? = null
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
for (e in list!!) {
|
for (e in list!!) {
|
||||||
println(e)
|
println(e)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//file
|
//file
|
||||||
package test;
|
|
||||||
|
|
||||||
class Test extends Base {
|
class Test extends Base {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// ERROR: Unresolved reference: clone
|
// ERROR: Unresolved reference: clone
|
||||||
// ERROR: Unresolved reference: finalize
|
// ERROR: Unresolved reference: finalize
|
||||||
package test
|
internal class Test : Base(), Cloneable {
|
||||||
|
|
||||||
internal class Test : Base() {
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super.hashCode()
|
return super.hashCode()
|
||||||
}
|
}
|
||||||
@@ -26,7 +24,7 @@ internal class Test : Base() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal open class Base {
|
internal open class Base : Cloneable {
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super.hashCode()
|
return super.hashCode()
|
||||||
}
|
}
|
||||||
@@ -36,7 +34,7 @@ internal open class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Throws(CloneNotSupportedException::class)
|
@Throws(CloneNotSupportedException::class)
|
||||||
protected open fun clone(): Any {
|
override fun clone(): Any {
|
||||||
return super.clone()
|
return super.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-32
@@ -1,18 +1,8 @@
|
|||||||
// ERROR: 'return' is not allowed here
|
|
||||||
// ERROR: Type mismatch: inferred type is String but Unit was expected
|
|
||||||
// ERROR: 'return' is not allowed here
|
|
||||||
// ERROR: Type mismatch: inferred type is String but Unit was expected
|
|
||||||
// ERROR: 'return' is not allowed here
|
|
||||||
// ERROR: Type mismatch: inferred type is String but Unit was expected
|
|
||||||
class Java8Class {
|
class Java8Class {
|
||||||
fun foo0(r: Function0<String>) {}
|
fun foo0(r: Function0<String>) {}
|
||||||
|
|
||||||
fun foo1(r: Function1<Int, String?>) {}
|
fun foo1(r: Function1<Int, String?>) {}
|
||||||
|
|
||||||
fun foo2(r: Function2<Int, Int, String>) {}
|
fun foo2(r: Function2<Int, Int, String>) {}
|
||||||
|
|
||||||
fun helper() {}
|
fun helper() {}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
foo0 { "42" }
|
foo0 { "42" }
|
||||||
foo0 { "42" }
|
foo0 { "42" }
|
||||||
@@ -20,62 +10,51 @@ class Java8Class {
|
|||||||
helper()
|
helper()
|
||||||
"42"
|
"42"
|
||||||
}
|
}
|
||||||
|
foo1 { i: Int -> "42" }
|
||||||
foo1 { i -> "42" }
|
foo1 { i: Int -> "42" }
|
||||||
foo1 { i -> "42" }
|
|
||||||
foo1 { i: Int ->
|
foo1 { i: Int ->
|
||||||
helper()
|
helper()
|
||||||
if (i > 1) {
|
if (i > 1) {
|
||||||
return@foo1 "42"
|
return@foo1 null
|
||||||
}
|
}
|
||||||
|
|
||||||
"43"
|
"43"
|
||||||
}
|
}
|
||||||
|
foo2 { i: Int, j: Int -> "42" }
|
||||||
foo2 { i, j -> "42" }
|
|
||||||
foo2 { i: Int, j: Int ->
|
foo2 { i: Int, j: Int ->
|
||||||
helper()
|
helper()
|
||||||
"42"
|
"42"
|
||||||
}
|
}
|
||||||
|
val f = label@{ i: Int, k: Int ->
|
||||||
val f = { i: Int, k: Int ->
|
|
||||||
helper()
|
helper()
|
||||||
if (i > 1) {
|
if (i > 1) {
|
||||||
return "42"
|
return@label "42"
|
||||||
}
|
}
|
||||||
|
|
||||||
"43"
|
"43"
|
||||||
}
|
}
|
||||||
|
val f1 = label@{ i1: Int, k1: Int ->
|
||||||
val f1 = { i1: Int, k1: Int ->
|
val f2 = label@{ i2: Int, k2: Int ->
|
||||||
val f2 = { i2: Int, k2: Int ->
|
|
||||||
helper()
|
helper()
|
||||||
if (i2 > 1) {
|
if (i2 > 1) {
|
||||||
return "42"
|
return@label "42"
|
||||||
}
|
}
|
||||||
|
|
||||||
"43"
|
"43"
|
||||||
}
|
}
|
||||||
if (i1 > 1) {
|
if (i1 > 1) {
|
||||||
return f.invoke(i1, k1)
|
return@label f.invoke(i1, k1)
|
||||||
}
|
}
|
||||||
f.invoke(i1, k1)
|
f.invoke(i1, k1)
|
||||||
}
|
}
|
||||||
|
val runnable = Runnable {}
|
||||||
val runnable = { }
|
|
||||||
|
|
||||||
foo1 { i: Int ->
|
foo1 { i: Int ->
|
||||||
if (i > 1) {
|
if (i > 1) {
|
||||||
return@foo1 "42"
|
return@foo1 "42"
|
||||||
}
|
}
|
||||||
|
|
||||||
foo0 {
|
foo0 {
|
||||||
if (true) {
|
if (true) {
|
||||||
return@foo0 "42"
|
return@foo0 "42"
|
||||||
}
|
}
|
||||||
"43"
|
"43"
|
||||||
}
|
}
|
||||||
|
|
||||||
"43"
|
"43"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,12 +79,13 @@ class Java8Class {
|
|||||||
constructorWithoutParams.invoke();
|
constructorWithoutParams.invoke();
|
||||||
|
|
||||||
Function1<Integer, String> constructorWithParam = Test::testOverloads;
|
Function1<Integer, String> constructorWithParam = Test::testOverloads;
|
||||||
constructorWithParam.invoke(2);
|
constructorWithParam.invoke(2) + 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGenericFunctions() {
|
public void testGenericFunctions() {
|
||||||
Function0<List<String>> emptyList = Collections::emptyList;
|
Function0<List<String>> emptyList = Collections::emptyList;
|
||||||
emptyList.invoke();
|
List<String> list = emptyList.invoke();
|
||||||
|
list.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int staticFun() { return 1; }
|
public static int staticFun() { return 1; }
|
||||||
|
|||||||
+15
-22
@@ -1,8 +1,5 @@
|
|||||||
// ERROR: Type inference failed: Not enough information to infer parameter T in fun <T> emptyList(): List<T> Please specify it explicitly.
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import java.util.Collections
|
|
||||||
|
|
||||||
internal class Test {
|
internal class Test {
|
||||||
fun memberFun(): Int {
|
fun memberFun(): Int {
|
||||||
return 1
|
return 1
|
||||||
@@ -28,10 +25,9 @@ internal class Java8Class {
|
|||||||
private val field = Java8Class()
|
private val field = Java8Class()
|
||||||
|
|
||||||
fun testStaticFunction() {
|
fun testStaticFunction() {
|
||||||
val staticFunFromSameClass = { staticFun() }
|
val staticFunFromSameClass: Function0<*> = { staticFun() }
|
||||||
staticFunFromSameClass.invoke()
|
staticFunFromSameClass.invoke()
|
||||||
|
val staticFunFromAnotherClass: Function0<*> = { Test.staticFun() }
|
||||||
val staticFunFromAnotherClass = { Test.staticFun() }
|
|
||||||
staticFunFromAnotherClass.invoke()
|
staticFunFromAnotherClass.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,32 +38,28 @@ internal class Java8Class {
|
|||||||
|
|
||||||
fun testMemberFunctionThroughObject() {
|
fun testMemberFunctionThroughObject() {
|
||||||
val obj = Java8Class()
|
val obj = Java8Class()
|
||||||
val memberFunFromSameClass = { obj.memberFun() }
|
val memberFunFromSameClass: Function0<*> = { obj.memberFun() }
|
||||||
memberFunFromSameClass.invoke()
|
memberFunFromSameClass.invoke()
|
||||||
|
|
||||||
val anotherObj = Test()
|
val anotherObj = Test()
|
||||||
val memFunFromAnotherClass = { anotherObj.memberFun() }
|
val memFunFromAnotherClass: Function0<*> = { anotherObj.memberFun() }
|
||||||
memFunFromAnotherClass.invoke()
|
memFunFromAnotherClass.invoke()
|
||||||
|
val memberFunThroughObj1: Function0<*> = { field.memberFun() }
|
||||||
val memberFunThroughObj1 = { field.memberFun() }
|
|
||||||
memberFunThroughObj1.invoke()
|
memberFunThroughObj1.invoke()
|
||||||
val memberFunThroughObj2 = { Test.field.memberFun() }
|
val memberFunThroughObj2: Function0<*> = { Test.field.memberFun() }
|
||||||
memberFunThroughObj2.invoke()
|
memberFunThroughObj2.invoke()
|
||||||
val memberFunThroughObj3 = { Test.staticFun().memberFun() }
|
val memberFunThroughObj3: Function0<*> = { Test.staticFun().memberFun() }
|
||||||
memberFunThroughObj3.invoke()
|
memberFunThroughObj3.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testConstructor() {
|
fun testConstructor() {
|
||||||
val constructorSameClass = { Java8Class() }
|
val constructorSameClass: Function0<*> = { Java8Class() }
|
||||||
constructorSameClass.invoke()
|
constructorSameClass.invoke()
|
||||||
|
val qualifiedConstructorSameClass: Function0<*> = { Java8Class() }
|
||||||
val qualifiedConstructorSameClass = { test.Java8Class() }
|
|
||||||
qualifiedConstructorSameClass.invoke()
|
qualifiedConstructorSameClass.invoke()
|
||||||
|
val constructorAnotherClass: Function0<*> = { Test() }
|
||||||
val constructorAnotherClass = { Test() }
|
|
||||||
constructorAnotherClass.invoke()
|
constructorAnotherClass.invoke()
|
||||||
|
val qualifiedConstructorAnotherClass: Function0<*> = { Test() }
|
||||||
val qualifiedConstructorAnotherClass = { test.Test() }
|
|
||||||
qualifiedConstructorAnotherClass.invoke()
|
qualifiedConstructorAnotherClass.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,12 +73,13 @@ internal class Java8Class {
|
|||||||
constructorWithoutParams.invoke()
|
constructorWithoutParams.invoke()
|
||||||
|
|
||||||
val constructorWithParam = { i: Int -> Test.testOverloads(i) }
|
val constructorWithParam = { i: Int -> Test.testOverloads(i) }
|
||||||
constructorWithParam.invoke(2)
|
constructorWithParam.invoke(2) + 42
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testGenericFunctions() {
|
fun testGenericFunctions() {
|
||||||
val emptyList = { emptyList() }
|
val emptyList: Function0<kotlin.collections.List<String>> = { emptyList() }
|
||||||
emptyList.invoke()
|
val list = emptyList.invoke()
|
||||||
|
list[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun memberFun(): Int {
|
fun memberFun(): Int {
|
||||||
|
|||||||
+20
-32
@@ -1,7 +1,6 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import javaApi.*
|
import javaApi.*
|
||||||
import java.util.Collections
|
|
||||||
|
|
||||||
internal class Test {
|
internal class Test {
|
||||||
fun memberFun(): Int {
|
fun memberFun(): Int {
|
||||||
@@ -9,7 +8,6 @@ internal class Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(i: Int) : super() {}
|
constructor(i: Int) : super() {}
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -29,17 +27,14 @@ internal class Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal class Test2
|
internal class Test2
|
||||||
|
|
||||||
internal class Java8Class {
|
internal class Java8Class {
|
||||||
private val field = Java8Class()
|
private val field = Java8Class()
|
||||||
private val h = MethodReferenceHelperClass()
|
private val h = MethodReferenceHelperClass()
|
||||||
|
|
||||||
fun testStaticFunction() {
|
fun testStaticFunction() {
|
||||||
val staticFunFromSameClass = JFunction0 { staticFun() }
|
val staticFunFromSameClass = JFunction0 { staticFun() }
|
||||||
staticFunFromSameClass.foo()
|
staticFunFromSameClass.foo()
|
||||||
MethodReferenceHelperClass.staticFun0 { staticFun() }
|
MethodReferenceHelperClass.staticFun0 { staticFun() }
|
||||||
h.memberFun0 { staticFun() }
|
h.memberFun0 { staticFun() }
|
||||||
|
|
||||||
val staticFunFromAnotherClass = JFunction0 { Test.staticFun() }
|
val staticFunFromAnotherClass = JFunction0 { Test.staticFun() }
|
||||||
staticFunFromAnotherClass.foo()
|
staticFunFromAnotherClass.foo()
|
||||||
MethodReferenceHelperClass.staticFun0 { Test.staticFun() }
|
MethodReferenceHelperClass.staticFun0 { Test.staticFun() }
|
||||||
@@ -47,10 +42,10 @@ internal class Java8Class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testMemberFunctionThroughClass() {
|
fun testMemberFunctionThroughClass() {
|
||||||
val memberFunFromClass = JFunction2<Java8Class, Int> { it.memberFun() }
|
val memberFunFromClass: JFunction2<Java8Class, Int> = JFunction2 { obj: Java8Class -> obj.memberFun() }
|
||||||
memberFunFromClass.foo(Java8Class())
|
memberFunFromClass.foo(Java8Class())
|
||||||
MethodReferenceHelperClass.staticFun2(JFunction2<Java8Class, Int> { it.memberFun() })
|
MethodReferenceHelperClass.staticFun2 { obj: Java8Class -> obj.memberFun() }
|
||||||
h.memberFun2(JFunction2<Java8Class, Int> { it.memberFun() })
|
h.memberFun2 { obj: Java8Class -> obj.memberFun() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testMemberFunctionThroughObject() {
|
fun testMemberFunctionThroughObject() {
|
||||||
@@ -87,27 +82,22 @@ internal class Java8Class {
|
|||||||
constructorSameClass.foo()
|
constructorSameClass.foo()
|
||||||
MethodReferenceHelperClass.staticFun0 { Java8Class() }
|
MethodReferenceHelperClass.staticFun0 { Java8Class() }
|
||||||
h.memberFun0 { Java8Class() }
|
h.memberFun0 { Java8Class() }
|
||||||
|
val qualifiedConstructorSameClass = JFunction0 { Java8Class() }
|
||||||
val qualifiedConstructorSameClass = JFunction0 { test.Java8Class() }
|
|
||||||
qualifiedConstructorSameClass.foo()
|
qualifiedConstructorSameClass.foo()
|
||||||
MethodReferenceHelperClass.staticFun0 { test.Java8Class() }
|
MethodReferenceHelperClass.staticFun0 { Java8Class() }
|
||||||
h.memberFun0 { test.Java8Class() }
|
h.memberFun0 { Java8Class() }
|
||||||
|
|
||||||
val constructorAnotherClass = JFunction0 { Test() }
|
val constructorAnotherClass = JFunction0 { Test() }
|
||||||
constructorAnotherClass.foo()
|
constructorAnotherClass.foo()
|
||||||
MethodReferenceHelperClass.staticFun0 { Test() }
|
MethodReferenceHelperClass.staticFun0 { Test() }
|
||||||
h.memberFun0 { Test() }
|
h.memberFun0 { Test() }
|
||||||
|
val constructorAnotherClassWithParam: JFunction2<Int, Test> = JFunction2 { i: Int -> Test(i) }
|
||||||
val constructorAnotherClassWithParam = JFunction2<Int, Test> { Test(it) }
|
|
||||||
constructorAnotherClassWithParam.foo(1)
|
constructorAnotherClassWithParam.foo(1)
|
||||||
MethodReferenceHelperClass.staticFun2(JFunction2<Int, Test> { Test(it) })
|
MethodReferenceHelperClass.staticFun2 { i: Int -> Test(i) }
|
||||||
h.memberFun2(JFunction2<Int, Test> { Test(it) })
|
h.memberFun2 { i: Int -> Test(i) }
|
||||||
|
val qualifiedConstructorAnotherClass = JFunction0 { Test() }
|
||||||
val qualifiedConstructorAnotherClass = JFunction0 { test.Test() }
|
|
||||||
qualifiedConstructorAnotherClass.foo()
|
qualifiedConstructorAnotherClass.foo()
|
||||||
MethodReferenceHelperClass.staticFun0 { test.Test() }
|
MethodReferenceHelperClass.staticFun0 { Test() }
|
||||||
h.memberFun0 { test.Test() }
|
h.memberFun0 { Test() }
|
||||||
|
|
||||||
val constructorAnotherClassWithoutConstructor = JFunction0 { Test2() }
|
val constructorAnotherClassWithoutConstructor = JFunction0 { Test2() }
|
||||||
constructorAnotherClassWithoutConstructor.foo()
|
constructorAnotherClassWithoutConstructor.foo()
|
||||||
MethodReferenceHelperClass.staticFun0 { Test2() }
|
MethodReferenceHelperClass.staticFun0 { Test2() }
|
||||||
@@ -115,30 +105,28 @@ internal class Java8Class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testLibraryFunctions() {
|
fun testLibraryFunctions() {
|
||||||
val memberFunFromClass = JFunction2<String, Int> { it.length }
|
val memberFunFromClass: JFunction2<String, Int> = JFunction2 { obj: String -> obj.length }
|
||||||
memberFunFromClass.foo("str")
|
memberFunFromClass.foo("str")
|
||||||
|
|
||||||
Thread(Runnable { println() }).start()
|
Thread(Runnable { println() }).start()
|
||||||
Runnable { println() }.run()
|
Runnable { println() }.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testOverloads() {
|
fun testOverloads() {
|
||||||
val constructorWithoutParams = JFunction1 { Test.testOverloads() }
|
val constructorWithoutParams: JFunction1<String> = JFunction1 { Test.testOverloads() }
|
||||||
constructorWithoutParams.foo()
|
constructorWithoutParams.foo()
|
||||||
MethodReferenceHelperClass.staticFun1 { Test.testOverloads() }
|
MethodReferenceHelperClass.staticFun1 { Test.testOverloads() }
|
||||||
h.memberFun1 { Test.testOverloads() }
|
h.memberFun1 { Test.testOverloads() }
|
||||||
|
val constructorWithParam: JFunction2<Int, String> = JFunction2 { i: Int -> Test.testOverloads(i) }
|
||||||
val constructorWithParam = JFunction2<Int, String> { Test.testOverloads(it) }
|
|
||||||
constructorWithParam.foo(2)
|
constructorWithParam.foo(2)
|
||||||
MethodReferenceHelperClass.staticFun2(JFunction2<Int, String> { Test.testOverloads(it) })
|
MethodReferenceHelperClass.staticFun2 { i: Int -> Test.testOverloads(i) }
|
||||||
h.memberFun2(JFunction2<Int, String> { Test.testOverloads(it) })
|
h.memberFun2 { i: Int -> Test.testOverloads(i) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testGenericFunctions() {
|
fun testGenericFunctions() {
|
||||||
val emptyList = JFunction1<List<String>> { emptyList() }
|
val emptyList: JFunction1<kotlin.collections.List<String>> = JFunction1 { emptyList() }
|
||||||
emptyList.foo()
|
emptyList.foo()
|
||||||
MethodReferenceHelperClass.staticFun1(JFunction1<List<String>> { emptyList() })
|
MethodReferenceHelperClass.staticFun1(JFunction1<kotlin.collections.List<String>> { emptyList() })
|
||||||
h.memberFun1(JFunction1<List<String>> { emptyList() })
|
h.memberFun1(JFunction1<kotlin.collections.List<String>> { emptyList() })
|
||||||
}
|
}
|
||||||
|
|
||||||
fun memberFun(): Int {
|
fun memberFun(): Int {
|
||||||
|
|||||||
-2
@@ -1,6 +1,4 @@
|
|||||||
//file
|
//file
|
||||||
package test;
|
|
||||||
|
|
||||||
class Base {
|
class Base {
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|||||||
-2
@@ -1,5 +1,3 @@
|
|||||||
package test
|
|
||||||
|
|
||||||
internal open class Base {
|
internal open class Base {
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return super.hashCode()
|
return super.hashCode()
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
fun foo(i: Int?) {
|
fun foo(i: Int) {
|
||||||
var i1 = i!!
|
var i1 = i
|
||||||
i1++
|
i1++
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import java.util.*
|
||||||
|
|
||||||
internal class A {
|
internal class A {
|
||||||
fun foo(): Map<String?, String?> {
|
fun foo(): Map<String, String> {
|
||||||
val list1: List<String?> = emptyList()
|
val list1: List<String> = emptyList()
|
||||||
val list2: List<Int?> = listOf(1)
|
val list2 = listOf(1)
|
||||||
val set1: Set<String?> = emptySet()
|
val set1: Set<String> = emptySet()
|
||||||
val set2: Set<String?> = setOf("a")
|
val set2 = setOf("a")
|
||||||
return emptyMap()
|
return emptyMap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import java.util.*
|
||||||
|
|
||||||
internal class A {
|
internal class A {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val list: List<String?> = listOf(null)
|
val list = listOf<String?>(null)
|
||||||
val set: Set<String?> = setOf(null)
|
val set = setOf<String?>(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,10 +11,14 @@ class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String zoo(Object o){ return ""; }
|
public String zoo(Object o){ return ""; }
|
||||||
|
|
||||||
|
public String nya(String s) { return s; }
|
||||||
}
|
}
|
||||||
|
|
||||||
interface I {
|
interface I {
|
||||||
@Nullable String zoo(@Nullable Object o);
|
@Nullable String zoo(@Nullable Object o);
|
||||||
|
|
||||||
|
public String nya(String s) { return ""; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class C extends Base implements I {
|
class C extends Base implements I {
|
||||||
@@ -23,4 +27,6 @@ class C extends Base implements I {
|
|||||||
public String bar(String s) { return ""; }
|
public String bar(String s) { return ""; }
|
||||||
|
|
||||||
public String zoo(Object o) { return ""; }
|
public String zoo(Object o) { return ""; }
|
||||||
|
|
||||||
|
public String nya(String s) { return ""; }
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-2
@@ -7,13 +7,20 @@ internal open class Base {
|
|||||||
return if (s != null) s + 1 else null
|
return if (s != null) s + 1 else null
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun zoo(o: Any?): String {
|
open fun zoo(o: Any?): String? {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun nya(s: String): String {
|
||||||
|
return s
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal interface I {
|
internal interface I {
|
||||||
fun zoo(o: Any?): String?
|
fun zoo(o: Any?): String?
|
||||||
|
fun nya(s: String): String {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class C : Base(), I {
|
internal class C : Base(), I {
|
||||||
@@ -25,7 +32,11 @@ internal class C : Base(), I {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun zoo(o: Any?): String {
|
override fun zoo(o: Any?): String? {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun nya(s: String): String {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// !specifyLocalVariableTypeByDefault: true
|
// !specifyLocalVariableTypeByDefault: true
|
||||||
fun foo(list: List<String?>?) {
|
|
||||||
|
fun foo(list: List<String>) {
|
||||||
val array: IntArray = IntArray(10)
|
val array: IntArray = IntArray(10)
|
||||||
for (i: Int in 0..9) {
|
for (i: Int in 0..9) {
|
||||||
array[i] = i
|
array[i] = i
|
||||||
}
|
}
|
||||||
for (s: String? in list!!) print(s)
|
for (s: String in list) print(s)
|
||||||
}
|
}
|
||||||
+2
-2
@@ -2,8 +2,8 @@ import java.util.Arrays
|
|||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
fun test() {
|
fun test() {
|
||||||
val list: List<String?> = Arrays.asList("a", "b")
|
val list: List<String> = Arrays.asList("a", "b")
|
||||||
val array1: Array<Any> = list.toTypedArray()
|
val array1: Array<Any> = list.toTypedArray()
|
||||||
val array2: Array<Any> = list.toTypedArray()
|
val array2: Array<Any> = list.toTypedArray<String>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ class TestJava {
|
|||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val x: List<String> = ArrayList()
|
val x: List<String> = ArrayList()
|
||||||
x.filter { o: String -> o == "a" }
|
x.filter { o: String -> o == "a" }
|
||||||
val lazy: Lazy<String?> = lazy(LazyThreadSafetyMode.NONE) { "aaa" }
|
val lazy = lazy(LazyThreadSafetyMode.NONE) { "aaa" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
list as List<String?>?
|
list as List<String>?
|
||||||
@@ -1 +1 @@
|
|||||||
list as List<in String?>?
|
list as List<in String>?
|
||||||
+2
-4
@@ -1,10 +1,8 @@
|
|||||||
// ERROR: Type inference failed. Expected type mismatch: inferred type is HashMap<Any?, Any?> but Map<String?, String?> was expected
|
import java.util.*
|
||||||
import java.util.HashMap
|
|
||||||
import java.util.Properties
|
|
||||||
|
|
||||||
internal object A {
|
internal object A {
|
||||||
fun foo(): Map<String?, String?> {
|
fun foo(): Map<String?, String?> {
|
||||||
val props = Properties()
|
val props = Properties()
|
||||||
return HashMap<Any, Any?>(props as Map<*, *>)
|
return HashMap<Any?, Any?>(props as Map<*, *>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -6,7 +6,7 @@ open class A () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class B : A() {
|
class B : A() {
|
||||||
override fun foo(x: Int?): Int? {
|
override fun foo(x: Int?): Int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+17
-17
@@ -52,7 +52,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("annotationFromConstructorParamToProperty.java")
|
@TestMetadata("annotationFromConstructorParamToProperty.java")
|
||||||
public void testAnnotationFromConstructorParamToProperty() throws Exception {
|
public void ignoreTestAnnotationFromConstructorParamToProperty() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/annotations/annotationFromConstructorParamToProperty.java");
|
runTest("nj2k/testData/newJ2k/annotations/annotationFromConstructorParamToProperty.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("jetbrainsNullable.java")
|
@TestMetadata("jetbrainsNullable.java")
|
||||||
public void ignoreTestJetbrainsNullable() throws Exception {
|
public void testJetbrainsNullable() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/annotations/jetbrainsNullable.java");
|
runTest("nj2k/testData/newJ2k/annotations/jetbrainsNullable.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,7 +1007,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("fieldsInitializedFromParams.java")
|
@TestMetadata("fieldsInitializedFromParams.java")
|
||||||
public void testFieldsInitializedFromParams() throws Exception {
|
public void ignoreTestFieldsInitializedFromParams() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/comments/fieldsInitializedFromParams.java");
|
runTest("nj2k/testData/newJ2k/comments/fieldsInitializedFromParams.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1382,7 +1382,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("DataClassWithAnnotations.java")
|
@TestMetadata("DataClassWithAnnotations.java")
|
||||||
public void testDataClassWithAnnotations() throws Exception {
|
public void ignoreTestDataClassWithAnnotations() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/detectProperties/DataClassWithAnnotations.java");
|
runTest("nj2k/testData/newJ2k/detectProperties/DataClassWithAnnotations.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2269,7 +2269,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("extendsBaseWhichExtendsObject.java")
|
@TestMetadata("extendsBaseWhichExtendsObject.java")
|
||||||
public void ignoreTestExtendsBaseWhichExtendsObject() throws Exception {
|
public void testExtendsBaseWhichExtendsObject() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/function/extendsBaseWhichExtendsObject.java");
|
runTest("nj2k/testData/newJ2k/function/extendsBaseWhichExtendsObject.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2289,17 +2289,17 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("java8Lambdas.java")
|
@TestMetadata("java8Lambdas.java")
|
||||||
public void ignoreTestJava8Lambdas() throws Exception {
|
public void testJava8Lambdas() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/function/java8Lambdas.java");
|
runTest("nj2k/testData/newJ2k/function/java8Lambdas.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("java8MRKFunctionExpectedType.java")
|
@TestMetadata("java8MRKFunctionExpectedType.java")
|
||||||
public void ignoreTestJava8MRKFunctionExpectedType() throws Exception {
|
public void testJava8MRKFunctionExpectedType() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/function/java8MRKFunctionExpectedType.java");
|
runTest("nj2k/testData/newJ2k/function/java8MRKFunctionExpectedType.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("java8MRSamConstructor.java")
|
@TestMetadata("java8MRSamConstructor.java")
|
||||||
public void ignoreTestJava8MRSamConstructor() throws Exception {
|
public void testJava8MRSamConstructor() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/function/java8MRSamConstructor.java");
|
runTest("nj2k/testData/newJ2k/function/java8MRSamConstructor.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3311,7 +3311,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("Overrides.java")
|
@TestMetadata("Overrides.java")
|
||||||
public void ignoreTestOverrides() throws Exception {
|
public void testOverrides() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/mutableCollections/Overrides.java");
|
runTest("nj2k/testData/newJ2k/mutableCollections/Overrides.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3374,7 +3374,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("newAnonymousClass.java")
|
@TestMetadata("newAnonymousClass.java")
|
||||||
public void testNewAnonymousClass() throws Exception {
|
public void ignoreTestNewAnonymousClass() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/newClassExpression/newAnonymousClass.java");
|
runTest("nj2k/testData/newJ2k/newClassExpression/newAnonymousClass.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3577,7 +3577,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("Overrides.java")
|
@TestMetadata("Overrides.java")
|
||||||
public void ignoreTestOverrides() throws Exception {
|
public void testOverrides() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/nullability/Overrides.java");
|
runTest("nj2k/testData/newJ2k/nullability/Overrides.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3770,7 +3770,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("AnonymousObject.java")
|
@TestMetadata("AnonymousObject.java")
|
||||||
public void testAnonymousObject() throws Exception {
|
public void ignoreTestAnonymousObject() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/postProcessing/AnonymousObject.java");
|
runTest("nj2k/testData/newJ2k/postProcessing/AnonymousObject.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3780,7 +3780,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("IfNullReturnToElvis.java")
|
@TestMetadata("IfNullReturnToElvis.java")
|
||||||
public void ignoreTestIfNullReturnToElvis() throws Exception {
|
public void testIfNullReturnToElvis() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/postProcessing/IfNullReturnToElvis.java");
|
runTest("nj2k/testData/newJ2k/postProcessing/IfNullReturnToElvis.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3985,7 +3985,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("rawGenericMethod.java")
|
@TestMetadata("rawGenericMethod.java")
|
||||||
public void ignoreTestRawGenericMethod() throws Exception {
|
public void testRawGenericMethod() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/rawGenerics/rawGenericMethod.java");
|
runTest("nj2k/testData/newJ2k/rawGenerics/rawGenericMethod.java");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4320,7 +4320,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("toArray.java")
|
@TestMetadata("toArray.java")
|
||||||
public void ignoreTestToArray() throws Exception {
|
public void testToArray() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/toArray/toArray.java");
|
runTest("nj2k/testData/newJ2k/toArray/toArray.java");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4668,7 +4668,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("rawTypeCast.java")
|
@TestMetadata("rawTypeCast.java")
|
||||||
public void ignoreTestRawTypeCast() throws Exception {
|
public void testRawTypeCast() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/typeParameters/rawTypeCast.java");
|
runTest("nj2k/testData/newJ2k/typeParameters/rawTypeCast.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4678,7 +4678,7 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("typeFromOtherFile.java")
|
@TestMetadata("typeFromOtherFile.java")
|
||||||
public void ignoreTestTypeFromOtherFile() throws Exception {
|
public void testTypeFromOtherFile() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/typeParameters/typeFromOtherFile.java");
|
runTest("nj2k/testData/newJ2k/typeParameters/typeFromOtherFile.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user