New J2K: do not find import usages in AST building phase
It is a rather heavy operation and it increases conversion time Related to #KT-31848
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// !forceNotNullTypes: false
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
|
||||
import java.util.HashSet
|
||||
|
||||
internal class Foo {
|
||||
fun foo(o: HashSet<*>) {
|
||||
val o2: HashSet<*> = o
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.HashSet
|
||||
|
||||
internal class Foo {
|
||||
fun foo(o: HashSet<*>) {
|
||||
var foo = 0
|
||||
|
||||
Vendored
+2
@@ -2,6 +2,8 @@
|
||||
// ERROR: Type inference failed: Not enough information to infer parameter K in constructor HashMap<K : Any!, V : Any!>(initialCapacity: Int) Please specify it explicitly.
|
||||
package demo
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
internal class Test {
|
||||
constructor() {}
|
||||
constructor(s: String?) {}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import A.Nested
|
||||
|
||||
internal class A @JvmOverloads constructor(nested: Nested = Nested(Nested.FIELD)) {
|
||||
internal class Nested(p: Int) {
|
||||
companion object {
|
||||
@@ -7,5 +9,5 @@ internal class A @JvmOverloads constructor(nested: Nested = Nested(Nested.FIELD)
|
||||
}
|
||||
|
||||
internal class B {
|
||||
var nested: A.Nested? = null
|
||||
var nested: Nested? = null
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package pack
|
||||
|
||||
import pack.A.Nested
|
||||
|
||||
internal class A @JvmOverloads constructor(nested: Nested = Nested(Nested.FIELD)) {
|
||||
internal class Nested(p: Int) {
|
||||
companion object {
|
||||
@@ -9,5 +11,5 @@ internal class A @JvmOverloads constructor(nested: Nested = Nested(Nested.FIELD)
|
||||
}
|
||||
|
||||
internal class B {
|
||||
var nested: A.Nested? = null
|
||||
var nested: Nested? = null
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
internal class A {
|
||||
private val list1: ArrayList<String> = ArrayList()
|
||||
private val list2: MutableList<String> = ArrayList()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
internal class C {
|
||||
fun foo1(list: MutableList<String>) {
|
||||
for (i in list.indices) {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import java.util.HashMap
|
||||
|
||||
internal object Test {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
@@ -77,7 +77,7 @@ internal class Java8Class {
|
||||
}
|
||||
|
||||
fun testGenericFunctions() {
|
||||
val emptyList: Function0<kotlin.collections.List<String>> = { emptyList() }
|
||||
val emptyList: Function0<List<String>> = { emptyList() }
|
||||
val list = emptyList.invoke()
|
||||
list[0]
|
||||
}
|
||||
|
||||
+3
-3
@@ -122,10 +122,10 @@ internal class Java8Class {
|
||||
}
|
||||
|
||||
fun testGenericFunctions() {
|
||||
val emptyList: JFunction1<kotlin.collections.List<String>> = JFunction1 { emptyList() }
|
||||
val emptyList: JFunction1<List<String>> = JFunction1 { emptyList() }
|
||||
emptyList.foo()
|
||||
MethodReferenceHelperClass.staticFun1(JFunction1<kotlin.collections.List<String>> { emptyList() })
|
||||
h.memberFun1(JFunction1<kotlin.collections.List<String>> { emptyList() })
|
||||
MethodReferenceHelperClass.staticFun1(JFunction1<List<String>> { emptyList() })
|
||||
h.memberFun1(JFunction1<List<String>> { emptyList() })
|
||||
}
|
||||
|
||||
fun memberFun(): Int {
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
// ERROR: The integer literal does not conform to the expected type CapturedType(*)
|
||||
// ERROR: The integer literal does not conform to the expected type CapturedType(*)
|
||||
// ERROR: Type argument is not within its bounds: should be subtype of 'String?'
|
||||
import java.util.HashMap
|
||||
|
||||
internal class G<T : String?>(t: T?)
|
||||
class Java {
|
||||
internal fun test() {
|
||||
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
import kotlin.collections.Map.Entry
|
||||
|
||||
class A {
|
||||
internal fun foo(o: Entry<Any?, Any?>?) {}
|
||||
internal fun foo(o: Map.Entry<Any?, Any?>?) {}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import kotlinApi.KotlinClass
|
||||
import kotlinApi.KotlinClass.Companion.CONST
|
||||
|
||||
class C {
|
||||
internal fun bar() {
|
||||
println(KotlinClass.CONST)
|
||||
println(CONST)
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
class TestMutableCollection {
|
||||
val list: MutableList<String> = ArrayList()
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
internal class User {
|
||||
fun main() {
|
||||
val list: List<String> = ArrayList()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.test
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
internal class Member
|
||||
internal class User {
|
||||
fun main() {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package test
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Test {
|
||||
private var myProp: String? = null
|
||||
private var myIntProp: Int? = null
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import javaApi.JavaClass
|
||||
import kotlinApi.KotlinClass
|
||||
import java.util.HashMap
|
||||
|
||||
internal class X {
|
||||
operator fun get(index: Int): Int {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.HashMap
|
||||
|
||||
internal class Test {
|
||||
fun test(map: HashMap<String, String>) {
|
||||
map.forEach { (key: String, value: String) -> foo(key, value) }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
internal class C<T> {
|
||||
fun foo1(src: Collection<T>) {
|
||||
val t = src.iterator().next()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package demo
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
internal class Test {
|
||||
fun main() {
|
||||
val commonMap: HashMap<String, Int> = HashMap()
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
package demo
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
internal class Test {
|
||||
fun main() {
|
||||
val common: List<String> = ArrayList()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package demo
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class TestJava {
|
||||
fun f(result: Function1<String, Unit?>) {
|
||||
result.invoke("a")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.HashMap
|
||||
|
||||
internal class A {
|
||||
fun foo() {
|
||||
val map1: Map<String, Int> = getMap1()
|
||||
|
||||
Reference in New Issue
Block a user