mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Registered quick fixes for warnings that are mostly related to Java nullability mismatch. ^KTIJ-20827 Fixed (cherry picked from commit 7d5bbcd3aa9b16a6a60bab0f1e3f7978622b7c49) GitOrigin-RevId: c79a1e985970792a932371e7c1b57354fa2575d5
45 lines
890 B
Plaintext
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()
|
|
}
|
|
}
|