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

45 lines
890 B
Plaintext

// FILE: test.before.kt
// "Replace scope function with safe (?.) call" "true"
// WITH_STDLIB
package p;
fun test(x: Foo) {
x.findAvailable().also {
it<caret>.foo()
}
}
// 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/Foo.java
package p;
import org.jspecify.nullness.Nullable;
public class Foo {
public void foo() {}
public @Nullable Foo findAvailable() { return this; }
}
// FILE: test.after.kt
// "Replace scope function with safe (?.) call" "true"
// WITH_STDLIB
package p;
fun test(x: Foo) {
x.findAvailable()?.also {
it<caret>.foo()
}
}