New J2K: implement mutability inference in post-processing
#KT-24293 fixed #KT-19603 fixed
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
import java.io.File
|
||||
|
||||
internal fun foo(file: File?): List<String> {
|
||||
return emptyList()
|
||||
internal fun foo(file: File?): List<String?>? {
|
||||
return emptyList<String>()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.io.File
|
||||
|
||||
class C {
|
||||
private fun memberFun(file: File?) {}
|
||||
private fun memberFun(file: File) {}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package to
|
||||
|
||||
fun foo(): String {
|
||||
fun foo(): String? {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package to
|
||||
|
||||
@SomeAnnotation
|
||||
fun foo(): String {
|
||||
fun foo(): String? {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ class A {
|
||||
return JetRefactoringUtil.formatPsiMethod(element as PsiMethod, true, false)
|
||||
}
|
||||
|
||||
protected fun getDimensionServiceKey(): String {
|
||||
protected fun getDimensionServiceKey(): String? {
|
||||
return "#org.jetbrains.kotlin.idea.refactoring.safeDelete.KotlinOverridingDialog"
|
||||
}
|
||||
|
||||
fun getSelected(): ArrayList<UsageInfo> {
|
||||
val result: ArrayList<UsageInfo> = ArrayList<UsageInfo?>()
|
||||
fun getSelected(): ArrayList<UsageInfo>? {
|
||||
val result: ArrayList<UsageInfo> = ArrayList<UsageInfo>()
|
||||
for (i in 0 until myChecked.length) {
|
||||
if (myChecked.get(i)) {
|
||||
result.add(myOverridingMethods.get(i))
|
||||
|
||||
@@ -3,5 +3,5 @@ import java.util.ArrayList
|
||||
|
||||
|
||||
fun foo() {
|
||||
bar(ArrayList<String?>())
|
||||
bar(ArrayList<String>())
|
||||
}
|
||||
@@ -2,4 +2,4 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
|
||||
fun foo() = ArrayList<String?>()
|
||||
fun foo() = ArrayList<String>()
|
||||
+1
-1
@@ -3,5 +3,5 @@ import java.util.ArrayList
|
||||
|
||||
|
||||
fun foo() {
|
||||
bar(/*comment*/ArrayList<String?>())
|
||||
bar(/*comment*/ArrayList<String>())
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import java.util.ArrayList
|
||||
|
||||
|
||||
class JavaClass {
|
||||
internal fun foo(file: File?, target: List<String?>?) {
|
||||
internal fun foo(file: File?, target: MutableList<String>?) {
|
||||
val list = ArrayList<String>()
|
||||
if (file != null) {
|
||||
list.add(file.name)
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@ fun test() {
|
||||
|
||||
//T0 <: T1 due to 'INITIALIZER'
|
||||
//T2 <: T4 due to 'INITIALIZER'
|
||||
//T3 <: T1 due to 'ASSIGNMENT'
|
||||
//T1 <: T3 due to 'ASSIGNMENT'
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
val x: /*T2@*/List</*T1@*/Int> = ArrayList</*T0@*/Int>()/*ArrayList<T0@Int>*/
|
||||
}
|
||||
|
||||
//T1 := T0 due to 'INITIALIZER'
|
||||
@@ -0,0 +1,8 @@
|
||||
fun a(
|
||||
l0: /*T1@*/MutableIterator</*T0@*/Int>
|
||||
) {
|
||||
l0/*T1@MutableIterator<T0@Int>*/.remove()
|
||||
}
|
||||
|
||||
//T0 <: T0 due to 'RECEIVER_PARAMETER'
|
||||
//T1 := LOWER due to 'USE_AS_RECEIVER'
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
fun a() {
|
||||
val list: /*T2@*/List</*T1@*/Int> = ArrayList</*T0@*/Int>()/*ArrayList<T0@Int>*/
|
||||
}
|
||||
|
||||
//T1 := T0 due to 'INITIALIZER'
|
||||
@@ -0,0 +1,30 @@
|
||||
fun a(
|
||||
l0: /*T1@*/MutableCollection</*T0@*/Int>,
|
||||
l1: /*T3@*/MutableCollection</*T2@*/Int>,
|
||||
l2: /*T5@*/MutableCollection</*T4@*/Int>,
|
||||
l3: /*T7@*/MutableCollection</*T6@*/Int>,
|
||||
l4: /*T9@*/MutableCollection</*T8@*/Int>
|
||||
) {
|
||||
l0/*T1@MutableCollection<T0@Int>*/.add(1/*LIT*/)
|
||||
l1/*T3@MutableCollection<T2@Int>*/.addAll(l1/*T3@MutableCollection<T2@Int>*/)
|
||||
l2/*T5@MutableCollection<T4@Int>*/.clear()
|
||||
l3/*T7@MutableCollection<T6@Int>*/.removeAll(l1/*T3@MutableCollection<T2@Int>*/)
|
||||
l4/*T9@MutableCollection<T8@Int>*/.retainAll(l1/*T3@MutableCollection<T2@Int>*/)
|
||||
}
|
||||
|
||||
//T0 := T0 due to 'RECEIVER_PARAMETER'
|
||||
//T1 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T2 := T2 due to 'RECEIVER_PARAMETER'
|
||||
//T2 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T3 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T4 := T4 due to 'RECEIVER_PARAMETER'
|
||||
//T5 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T6 := T6 due to 'RECEIVER_PARAMETER'
|
||||
//T6 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T7 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T8 := T8 due to 'RECEIVER_PARAMETER'
|
||||
//T8 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T9 := LOWER due to 'USE_AS_RECEIVER'
|
||||
@@ -0,0 +1,8 @@
|
||||
class Nya {
|
||||
private val hashMap: /*T6@*/Map</*T3@*/String, /*T5@*/List</*T4@*/Int>> =
|
||||
HashMap</*T0@*/String, /*T2@*/List</*T1@*/Int>>()/*HashMap<T0@String, T2@MutableList<T1@Int>>*/
|
||||
}
|
||||
|
||||
//T3 := T0 due to 'INITIALIZER'
|
||||
//T4 := T1 due to 'INITIALIZER'
|
||||
//T5 := T2 due to 'INITIALIZER'
|
||||
@@ -0,0 +1,10 @@
|
||||
fun a(l0: /*T1@*/MutableList</*T0@*/Int>) {
|
||||
val iterator: /*T3@*/MutableIterator</*T2@*/Int> = l0/*T1@MutableList<T0@Int>*/.iterator()/*T1@MutableList<T0@Int>*/
|
||||
iterator/*T3@MutableIterator<T2@Int>*/.remove()
|
||||
}
|
||||
|
||||
//T0 := T0 due to 'RECEIVER_PARAMETER'
|
||||
//T2 := T0 due to 'INITIALIZER'
|
||||
//T1 <: T3 due to 'INITIALIZER'
|
||||
//T2 <: T2 due to 'RECEIVER_PARAMETER'
|
||||
//T3 := LOWER due to 'USE_AS_RECEIVER'
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class A {
|
||||
val l: /*T1@*/List</*T0@*/Int>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
fun a(
|
||||
l0: /*T1@*/MutableListIterator</*T0@*/Int>,
|
||||
l1: /*T3@*/MutableListIterator</*T2@*/Int>,
|
||||
l2: /*T5@*/MutableListIterator</*T4@*/Int>
|
||||
) {
|
||||
l0/*T1@MutableListIterator<T0@Int>*/.add(1/*LIT*/)
|
||||
l1/*T3@MutableListIterator<T2@Int>*/.remove()
|
||||
l2/*T5@MutableListIterator<T4@Int>*/.set(1/*LIT*/)
|
||||
}
|
||||
|
||||
//T0 := T0 due to 'RECEIVER_PARAMETER'
|
||||
//T1 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T2 := T2 due to 'RECEIVER_PARAMETER'
|
||||
//T3 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T4 := T4 due to 'RECEIVER_PARAMETER'
|
||||
//T5 := LOWER due to 'USE_AS_RECEIVER'
|
||||
@@ -0,0 +1,46 @@
|
||||
fun a(
|
||||
l0: /*T1@*/MutableList</*T0@*/Int>,
|
||||
l1: /*T3@*/MutableList</*T2@*/Int>,
|
||||
l2: /*T5@*/MutableList</*T4@*/Int>,
|
||||
l3: /*T7@*/MutableList</*T6@*/Int>,
|
||||
l4: /*T9@*/MutableList</*T8@*/Int>,
|
||||
l5: /*T11@*/MutableList</*T10@*/Int>,
|
||||
l6: /*T13@*/MutableList</*T12@*/Int>,
|
||||
l7: /*T15@*/MutableList</*T14@*/Int>
|
||||
) {
|
||||
l0/*T1@MutableList<T0@Int>*/.add(1/*LIT*/)
|
||||
l1/*T3@MutableList<T2@Int>*/.addAll(1/*LIT*/, l1/*T3@MutableList<T2@Int>*/)
|
||||
l2/*T5@MutableList<T4@Int>*/.addAll(l1/*T3@MutableList<T2@Int>*/)
|
||||
l3/*T7@MutableList<T6@Int>*/.clear()
|
||||
l4/*T9@MutableList<T8@Int>*/.remove(1/*LIT*/)
|
||||
l5/*T11@MutableList<T10@Int>*/.removeAll(l1/*T3@MutableList<T2@Int>*/)
|
||||
l5/*T11@MutableList<T10@Int>*/.removeAt(0/*LIT*/)
|
||||
l6/*T13@MutableList<T12@Int>*/.retainAll(l1/*T3@MutableList<T2@Int>*/)
|
||||
l7/*T15@MutableList<T14@Int>*/.set(0/*LIT*/, 0/*LIT*/)
|
||||
}
|
||||
|
||||
//T0 := T0 due to 'RECEIVER_PARAMETER'
|
||||
//T1 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T2 := T2 due to 'RECEIVER_PARAMETER'
|
||||
//T2 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T3 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T4 := T4 due to 'RECEIVER_PARAMETER'
|
||||
//T4 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T5 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T6 := T6 due to 'RECEIVER_PARAMETER'
|
||||
//T7 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T8 := T8 due to 'RECEIVER_PARAMETER'
|
||||
//T9 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T10 := T10 due to 'RECEIVER_PARAMETER'
|
||||
//T10 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T11 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T10 := T10 due to 'RECEIVER_PARAMETER'
|
||||
//T12 := T12 due to 'RECEIVER_PARAMETER'
|
||||
//T12 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T13 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T14 := T14 due to 'RECEIVER_PARAMETER'
|
||||
//T15 := LOWER due to 'USE_AS_RECEIVER'
|
||||
@@ -0,0 +1,15 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
fun test() {
|
||||
val list: /*T4@*/List</*T3@*/MutableList</*T2@*/Int>> = ArrayList</*T1@*/MutableList</*T0@*/Int>>()/*ArrayList<T1@MutableList<T0@Int>>*/
|
||||
for(l: /*T6@*/MutableList</*T5@*/Int> in list/*T4@MutableList<T3@MutableList<T2@Int>>*/) {
|
||||
l/*T6@MutableList<T5@Int>*/.add(42/*LIT*/)
|
||||
}
|
||||
}
|
||||
|
||||
//T2 := T0 due to 'INITIALIZER'
|
||||
//T3 := T1 due to 'INITIALIZER'
|
||||
//T5 := T5 due to 'RECEIVER_PARAMETER'
|
||||
//T6 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T5 := T2 due to 'ASSIGNMENT'
|
||||
//T3 <: T6 due to 'ASSIGNMENT'
|
||||
@@ -0,0 +1,14 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
fun a() {
|
||||
val list: /*T4@*/List</*T3@*/MutableList</*T2@*/Int>> = ArrayList</*T1@*/MutableList</*T0@*/Int>>()/*ArrayList<T1@MutableList<T0@Int>>*/
|
||||
list/*T4@MutableList<T3@MutableList<T2@Int>>*/.get(0/*LIT*/)/*T3@MutableList<T2@Int>*/.add(1/*LIT*/)
|
||||
}
|
||||
|
||||
//T2 := T0 due to 'INITIALIZER'
|
||||
//T3 := T1 due to 'INITIALIZER'
|
||||
//T2 := T2 due to 'RECEIVER_PARAMETER'
|
||||
//T3 := T3 due to 'RECEIVER_PARAMETER'
|
||||
//T4 <: UPPER due to 'RECEIVER_PARAMETER'
|
||||
//T2 := T2 due to 'RECEIVER_PARAMETER'
|
||||
//T3 := LOWER due to 'USE_AS_RECEIVER'
|
||||
@@ -0,0 +1,9 @@
|
||||
fun a(
|
||||
l0: /*T2@*/MutableMap.MutableEntry</*T0@*/Int, /*T1@*/String>
|
||||
) {
|
||||
l0/*T2@MutableEntry<T0@Int, T1@String>*/.setValue(1/*LIT*/, "nya")
|
||||
}
|
||||
|
||||
//T0 := T0 due to 'RECEIVER_PARAMETER'
|
||||
//T1 := T1 due to 'RECEIVER_PARAMETER'
|
||||
//T2 := LOWER due to 'USE_AS_RECEIVER'
|
||||
@@ -0,0 +1,27 @@
|
||||
fun a(
|
||||
l0: /*T2@*/MutableMap</*T0@*/Int, /*T1@*/String>,
|
||||
l1: /*T5@*/MutableMap</*T3@*/Int, /*T4@*/String>,
|
||||
l2: /*T8@*/MutableMap</*T6@*/Int, /*T7@*/String>,
|
||||
l3: /*T11@*/MutableMap</*T9@*/Int, /*T10@*/String>
|
||||
) {
|
||||
l0/*T2@MutableMap<T0@Int, T1@String>*/.put(1)
|
||||
l1/*T5@MutableMap<T3@Int, T4@String>*/.remove(1/*LIT*/, l1)
|
||||
l2/*T8@MutableMap<T6@Int, T7@String>*/.putAll(l1/*T5@MutableMap<T3@Int, T4@String>*/)
|
||||
l3/*T11@MutableMap<T9@Int, T10@String>*/.clear(1)
|
||||
}
|
||||
|
||||
//T0 := T0 due to 'RECEIVER_PARAMETER'
|
||||
//T1 := T1 due to 'RECEIVER_PARAMETER'
|
||||
//T2 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T3 := T3 due to 'RECEIVER_PARAMETER'
|
||||
//T4 := T4 due to 'RECEIVER_PARAMETER'
|
||||
//T5 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T6 := T6 due to 'RECEIVER_PARAMETER'
|
||||
//T7 := T7 due to 'RECEIVER_PARAMETER'
|
||||
//T6 := T3 due to 'PARAMETER'
|
||||
//T7 := T4 due to 'PARAMETER'
|
||||
//T5 <: UPPER due to 'PARAMETER'
|
||||
//T8 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T9 := T9 due to 'RECEIVER_PARAMETER'
|
||||
//T10 := T10 due to 'RECEIVER_PARAMETER'
|
||||
//T11 := LOWER due to 'USE_AS_RECEIVER'
|
||||
@@ -0,0 +1,30 @@
|
||||
fun a(
|
||||
l0: /*T1@*/MutableSet</*T0@*/Int>,
|
||||
l1: /*T3@*/MutableSet</*T2@*/Int>,
|
||||
l2: /*T5@*/MutableSet</*T4@*/Int>,
|
||||
l3: /*T7@*/MutableSet</*T6@*/Int>,
|
||||
l4: /*T9@*/MutableSet</*T8@*/Int>
|
||||
) {
|
||||
l0/*T1@MutableSet<T0@Int>*/.add(1/*LIT*/)
|
||||
l1/*T3@MutableSet<T2@Int>*/.addAll(l1/*T3@MutableSet<T2@Int>*/)
|
||||
l2/*T5@MutableSet<T4@Int>*/.clear()
|
||||
l3/*T7@MutableSet<T6@Int>*/.removeAll(l1/*T3@MutableSet<T2@Int>*/)
|
||||
l4/*T9@MutableSet<T8@Int>*/.retainAll(l1/*T3@MutableSet<T2@Int>*/)
|
||||
}
|
||||
|
||||
//T0 := T0 due to 'RECEIVER_PARAMETER'
|
||||
//T1 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T2 := T2 due to 'RECEIVER_PARAMETER'
|
||||
//T2 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T3 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T4 := T4 due to 'RECEIVER_PARAMETER'
|
||||
//T5 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T6 := T6 due to 'RECEIVER_PARAMETER'
|
||||
//T6 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T7 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T8 := T8 due to 'RECEIVER_PARAMETER'
|
||||
//T8 := T2 due to 'PARAMETER'
|
||||
//T3 <: UPPER due to 'PARAMETER'
|
||||
//T9 := LOWER due to 'USE_AS_RECEIVER'
|
||||
+1
-1
@@ -4,5 +4,5 @@ fun test(a: /*T1@*/List</*T0@*/Int?>) {
|
||||
}
|
||||
}
|
||||
|
||||
//T2 <: T0 due to 'ASSIGNMENT'
|
||||
//T0 <: T2 due to 'ASSIGNMENT'
|
||||
//T1 := LOWER due to 'USE_AS_RECEIVER'
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
fun bar(map: /*T2@*/HashMap</*T0@*/String?, /*T1@*/Int>, list1: /*T4@*/List</*T3@*/Int?>, list2: /*T6@*/List</*T5@*/String?>) {
|
||||
fun bar(map: /*T2@*/HashMap</*T0@*/String?, /*T1@*/Int>, list1: /*T4@*/List</*T3@*/Int>, list2: /*T6@*/List</*T5@*/String?>) {
|
||||
for (entry: /*T9@*/MutableMap.MutableEntry</*T7@*/String?, /*T8@*/Int> in map/*T2@HashMap<T0@String, T1@Int>*/.entries/*MutableSet<MutableEntry<T0@String, T1@Int>>*/) {
|
||||
val value: /*T10@*/Int = entry/*T9@MutableEntry<T7@String, T8@Int>*/.value/*T8@Int*/
|
||||
if (entry/*T9@MutableEntry<T7@String, T8@Int>*/.key/*T7@String*/ == null/*LIT*/) {
|
||||
@@ -21,11 +21,11 @@ fun bar(map: /*T2@*/HashMap</*T0@*/String?, /*T1@*/Int>, list1: /*T4@*/List</*T3
|
||||
//T9 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T7 := UPPER due to 'COMPARE_WITH_NULL'
|
||||
//T10 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T0 := T7 due to 'ASSIGNMENT'
|
||||
//T1 := T8 due to 'ASSIGNMENT'
|
||||
//T7 := T0 due to 'ASSIGNMENT'
|
||||
//T8 := T1 due to 'ASSIGNMENT'
|
||||
//T11 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T11 <: T3 due to 'ASSIGNMENT'
|
||||
//T3 <: T11 due to 'ASSIGNMENT'
|
||||
//T4 := LOWER due to 'USE_AS_RECEIVER'
|
||||
//T12 := UPPER due to 'COMPARE_WITH_NULL'
|
||||
//T12 <: T5 due to 'ASSIGNMENT'
|
||||
//T5 <: T12 due to 'ASSIGNMENT'
|
||||
//T6 := LOWER due to 'USE_AS_RECEIVER'
|
||||
|
||||
+9
-8
@@ -18,19 +18,19 @@ internal open class B {
|
||||
open val fromB1: String
|
||||
get() = ""
|
||||
|
||||
open var fromB2: String
|
||||
open var fromB2: String?
|
||||
get() = ""
|
||||
set(value) {}
|
||||
|
||||
open var fromB3: String
|
||||
open var fromB3: String?
|
||||
get() = ""
|
||||
set(value) {}
|
||||
|
||||
open var fromB4: String
|
||||
open var fromB4: String?
|
||||
get() = ""
|
||||
set(value) {}
|
||||
|
||||
open fun setFromB5(value: String) {}
|
||||
open fun setFromB5(value: String?) {}
|
||||
}
|
||||
|
||||
internal abstract class C(override val something1: Int) : B(), I {
|
||||
@@ -59,19 +59,19 @@ internal abstract class C(override val something1: Int) : B(), I {
|
||||
override val fromB1: String
|
||||
get() = super.fromB1
|
||||
|
||||
override var fromB2: String
|
||||
override var fromB2: String?
|
||||
get() = super.fromB2
|
||||
set(value) {
|
||||
super.fromB2 = value
|
||||
}
|
||||
|
||||
override var fromB3: String
|
||||
override var fromB3: String?
|
||||
get() = super.fromB3
|
||||
set(fromB3) {
|
||||
super.fromB3 = fromB3
|
||||
}
|
||||
|
||||
override var fromB4: String
|
||||
override var fromB4: String?
|
||||
get() = super.fromB4
|
||||
set(value) {
|
||||
super.fromB4 = value
|
||||
@@ -81,7 +81,8 @@ internal abstract class C(override val something1: Int) : B(), I {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun setFromB5(value: String) {
|
||||
override fun setFromB5(value: String?) {
|
||||
super.setFromB5(value)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class Nya {
|
||||
private int i;
|
||||
|
||||
public Nya(int i) {
|
||||
/*comment before*/
|
||||
this/*1*/./*2*/i/*3*/ = /*4*/i /* comment after*/; // and after again
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
class Nya /*comment before*/(/*1*//*3*/ /*4*/private val i: Int)
|
||||
@@ -1,5 +1,5 @@
|
||||
internal class A {
|
||||
var list: List<String?>? = null
|
||||
var list: List<String>? = null
|
||||
fun foo() {
|
||||
for (e in list!!) {
|
||||
println(e)
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@ import java.util.ArrayList
|
||||
internal object A {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
List::class.java.isAssignableFrom(ArrayList::class.java)
|
||||
MutableList::class.java.isAssignableFrom(ArrayList::class.java)
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
internal class X(private val list: MutableList<Y>) {
|
||||
internal class X(private val list: List<Y>) {
|
||||
|
||||
internal inner class Y
|
||||
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// ERROR: Operator call corresponds to a dot-qualified call 'value.plus(1)' which is not allowed on a nullable receiver 'value'.
|
||||
import java.util.HashMap
|
||||
|
||||
internal enum class E { A, B, C }
|
||||
@@ -15,7 +14,7 @@ internal class A {
|
||||
val i = map.entries.iterator().next().key + 1
|
||||
}
|
||||
|
||||
fun bar(list: MutableList<String?>, map: HashMap<String?, Int?>) {
|
||||
fun bar(list: MutableList<String?>, map: HashMap<String, Int>) {
|
||||
val c = "a"[0]
|
||||
val b = 10.toByte()
|
||||
val i = 10.1.toInt()
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import java.util.Iterator;
|
||||
|
||||
public class TestMutableIterator implements Iterator<String> {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String next() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
List<List<Integer>> list = new ArrayList<>();
|
||||
|
||||
public void test() {
|
||||
list.get(0).add(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
class Test {
|
||||
internal var list: List<List<Int>> = ArrayList()
|
||||
fun test() {
|
||||
list[0].add(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Owner {
|
||||
public List<String> list = new ArrayList<>();
|
||||
}
|
||||
|
||||
public class Updater {
|
||||
public void update(Owner owner) {
|
||||
owner.list.add("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
class Owner {
|
||||
var list: MutableList<String> = ArrayList()
|
||||
}
|
||||
|
||||
class Updater {
|
||||
fun update(owner: Owner) {
|
||||
owner.list.add("")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user