Files
openide/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaNullabilityMismatchWithImplicitReceiver.test
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

51 lines
889 B
Plaintext

// FILE: test.before.kt
// "Replace with safe (this?.) call" "true"
// WITH_STDLIB
package p;
fun test(x: Foo) {
with (x.foo()) {
<caret>bar()
}
}
// 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
// "Replace with safe (this?.) call" "true"
// WITH_STDLIB
package p;
fun test(x: Foo) {
with (x.foo()) {
<caret>this?.bar()
}
}