New J2K: do not save import statements in files as we print fqNames for calls

This may cause conflicts on shortening fq references post-processing step
This commit is contained in:
Ilya Kirillov
2019-09-24 11:52:19 +03:00
parent e3b7b41544
commit f9fac0acf5
54 changed files with 54 additions and 162 deletions
@@ -1,7 +1,6 @@
package to
import java.io.File
import java.util.ArrayList
class JavaClass {
@@ -1,7 +1,5 @@
package to
import java.util.ArrayList
class JavaClass {
internal fun foo() {
+2 -1
View File
@@ -1,3 +1,4 @@
// ERROR: Unresolved reference: Test
// !forceNotNullTypes: false
// !specifyLocalVariableTypeByDefault: true
package test
@@ -19,7 +20,7 @@ class Test(str: String) {
val test: String = "String2"
sout(test)
sout(dummy(test))
Test(test)
test.Test(test)
}
init {
+2 -1
View File
@@ -1,3 +1,4 @@
// ERROR: Unresolved reference: Test
// !specifyLocalVariableTypeByDefault: true
package test
@@ -16,7 +17,7 @@ class Test(str: String?) {
val test: String = "String2"
sout(test)
sout(dummy(test))
Test(test)
test.Test(test)
}
init {
@@ -1,5 +1,3 @@
import java.util.HashSet
internal class Foo {
fun foo(o: HashSet<*>) {
val o2: HashSet<*> = o
@@ -1,5 +1,3 @@
import java.util.HashSet
internal class Foo {
fun foo(o: HashSet<*>) {
var foo = 0
-2
View File
@@ -1,7 +1,5 @@
package demo
import java.util.HashMap
internal class Test {
constructor() {}
constructor(s: String?) {}
+4 -2
View File
@@ -3,10 +3,12 @@ package test
object Test {
@JvmStatic
fun main(args: Array<String>) {
println()// Comment
println()
// Comment
// Comment1
foo()
// Comment1
// Comment2
.indexOf("s")
}
@@ -1,5 +1,3 @@
import A.Nested
internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD)) {
internal class Nested(p: Int) {
companion object {
@@ -9,5 +7,5 @@ internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD
}
internal class B {
var nested: Nested? = null
var nested: A.Nested? = null
}
@@ -1,7 +1,5 @@
package pack
import pack.A.Nested
internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD)) {
internal class Nested(p: Int) {
companion object {
@@ -11,5 +9,5 @@ internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD
}
internal class B {
var nested: Nested? = null
var nested: A.Nested? = null
}
@@ -1,7 +1,5 @@
package pack
import pack.A.Nested
internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD)) {
internal class Nested(p: Int) {
companion object {
@@ -11,5 +9,5 @@ internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD
}
internal class B {
var nested: Nested? = null
var nested: A.Nested? = null
}
-2
View File
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class A {
private val list1 = ArrayList<String>()
private val list2: MutableList<String> = ArrayList()
-2
View File
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class A {
private val field1: List<String> = ArrayList()
val field2: List<String> = ArrayList()
-2
View File
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class C {
fun foo1(list: MutableList<String?>) {
for (i in list.indices) {
-2
View File
@@ -1,5 +1,3 @@
import java.util.HashMap
internal object Test {
@JvmStatic
fun main(args: Array<String>) {
-1
View File
@@ -1 +0,0 @@
import java.util.Arrays
-1
View File
@@ -1,3 +1,2 @@
// ERROR: Unresolved reference: ArrayBlockingQueue
import java.util.Arrays
import java.util.concurrent.ArrayBlockingQueue
-2
View File
@@ -1,8 +1,6 @@
// 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() {
-2
View File
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal object A {
@JvmStatic
fun main(args: Array<String>) {
-2
View File
@@ -1,7 +1,5 @@
package test
import java.util.HashMap
class TestPrimitiveFromMap {
fun foo(map: HashMap<String?, Int?>): Int {
return map["zzz"]!!
-2
View File
@@ -1,5 +1,3 @@
import java.util.HashMap
class TestMethodReference {
private val hashMap = HashMap<String, String>()
fun update(key: String, msg: String) {
-2
View File
@@ -1,5 +1,3 @@
import java.util.HashMap
class TestMethodReference {
private val hashMap = HashMap<String, String>()
fun update(key: String, msg: String) {
-2
View File
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal interface FooInterface {
fun foo(): ArrayList<out Foo.SomeClass?>?
}
-2
View File
@@ -1,5 +1,3 @@
import java.util.HashMap
class TestClass {
private val hashMap: Map<String, List<Int>> = HashMap()
}
-1
View File
@@ -1,4 +1,3 @@
import java.util.ArrayList
import java.util.function.Consumer
internal class Test {
-2
View File
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class A {
var list: List<String> = ArrayList()
}
@@ -1,7 +1,7 @@
import kotlinApi.KotlinClass.Companion.CONST
import kotlinApi.KotlinClass
class C {
internal fun bar() {
println(CONST)
println(KotlinClass.CONST)
}
}
-2
View File
@@ -1,6 +1,4 @@
// ERROR: Unresolved reference: LinkedList
import java.util.ArrayList
class ForEach {
fun test() {
val xs = ArrayList<Any>()
-2
View File
@@ -1,6 +1,4 @@
// ERROR: Unresolved reference: LinkedList
import java.util.ArrayList
class Lists {
fun test() {
val xs: MutableList<Any?> = ArrayList()
@@ -1,5 +1,3 @@
import java.util.HashMap
internal enum class E { A, B, C }
internal class A {
fun foo(list: List<String?>, collection: Collection<Int?>, map: Map<Int, Int?>) {
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class A {
fun createCollection(): MutableCollection<String> {
return ArrayList()
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class A {
private val collection: MutableCollection<String>
fun createCollection(): MutableCollection<String> {
-2
View File
@@ -1,5 +1,3 @@
import java.util.HashMap
internal class IteratorTest {
var mutableMap1: MutableMap<String, String> = HashMap()
var mutableMap2: MutableMap<String, String> = HashMap()
-3
View File
@@ -1,8 +1,5 @@
import java.util.ArrayList
class TestMutableCollection {
val list: MutableList<String> = ArrayList()
fun test() {
val it = list.iterator()
while (it.hasNext()) {
@@ -1,5 +1,3 @@
import java.util.ArrayList
class Test {
internal var list: List<MutableList<Int>> = ArrayList()
fun test() {
@@ -1,5 +1,3 @@
import java.util.ArrayList
class Owner {
var list: MutableList<String> = ArrayList()
}
@@ -8,4 +6,4 @@ class Updater {
fun update(owner: Owner) {
owner.list.add("")
}
}
}
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class User {
fun main() {
val list: List<String> = ArrayList()
@@ -1,7 +1,5 @@
package org.test
import java.util.ArrayList
internal class Member
internal class User {
fun main() {
-2
View File
@@ -1,7 +1,5 @@
package test
import java.util.ArrayList
class Test {
private var myProp: String? = null
private var myIntProp: Int? = null
-1
View File
@@ -1,6 +1,5 @@
import javaApi.JavaClass
import kotlinApi.KotlinClass
import java.util.HashMap
internal class X {
operator fun get(index: Int): Int {
@@ -1,5 +1,3 @@
import java.util.HashMap
internal class Test {
fun test(map: HashMap<String?, String?>) {
map.forEach { (key: String?, value: String?) -> foo(key, value) }
-2
View File
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class C<T> {
fun foo1(src: Collection<T>) {
val t = src.iterator().next()
-2
View File
@@ -1,7 +1,5 @@
package demo
import java.util.HashMap
internal class Test {
fun main() {
val commonMap = HashMap<String, Int>()
-2
View File
@@ -1,7 +1,5 @@
package demo
import java.util.ArrayList
internal class Test {
fun main() {
val common: List<String> = ArrayList()
@@ -1,5 +1,3 @@
import java.util.ArrayList
internal class A {
private val field1: List<String> = ArrayList()
val field2: List<String> = ArrayList()
@@ -1,7 +1,5 @@
package demo
import java.util.ArrayList
class TestJava {
fun f(result: Function1<String?, Unit>) {
result.invoke("a")
+1 -3
View File
@@ -1,4 +1,2 @@
import java.util.ArrayList
internal interface I<T : List<Iterator<String?>?>?>
internal class C : I<ArrayList<Iterator<String?>?>?>
internal class C : I<ArrayList<Iterator<String?>?>?>
-2
View File
@@ -1,5 +1,3 @@
import java.util.HashMap
internal class A {
fun foo() {
val map1 = getMap1<String, Int>()
+1 -2
View File
@@ -2,8 +2,7 @@
// ERROR: Type mismatch: inferred type is (CapturedType(*)!!..Any?) but String? was expected
// ERROR: Type mismatch: inferred type is Any? but String? was expected
// ERROR: Type mismatch: inferred type is (CapturedType(*)!!..Any?) but String? was expected
// ERROR: Type mismatch: inferred type is HashMap<Any?, Any?> but Map<String?, String?> was expected
import java.util.HashMap
// ERROR: Type mismatch: inferred type is kotlin.collections.HashMap<Any?, Any?> /* = java.util.HashMap<Any?, Any?> */ but Map<String?, String?> was expected
import java.util.Properties
internal object A {