Files
Dmitry Timofeev 3f52503ac3 [kotlin] Added quick fixes for warnings introduced in 1.6.20 or earlier
Registered quick fixes for warnings that are mostly related to Java
nullability mismatch.

^KTIJ-20827 Fixed

(cherry picked from commit 7d5bbcd3aa9b16a6a60bab0f1e3f7978622b7c49)

GitOrigin-RevId: c79a1e985970792a932371e7c1b57354fa2575d5
2022-02-08 08:52:56 +00:00

53 lines
878 B
Plaintext

// FILE: test.before.kt
// "Surround with null check" "true"
package p;
fun f(x: A) {}
fun test(x: Foo) {
val y = x.foo()
f(y<caret>)
}
// FILE: org/jspecify/nullness/Nullable.java
package org.jspecify.nullness;
import static java.lang.annotation.ElementType.TYPE_USE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Target(TYPE_USE)
@Retention(RUNTIME)
public @interface Nullable {}
// FILE: p/A.java
package p;
public class A {
public void bar() {}
}
// FILE: p/Foo.java
package p;
import org.jspecify.nullness.Nullable;
public class Foo {
public @Nullable A foo() { return null; }
}
// FILE: test.after.kt
// "Surround with null check" "true"
package p;
fun f(x: A) {}
fun test(x: Foo) {
val y = x.foo()
if <caret>(y != null) {
f(y)
}
}