[FIR] Preserve enhanced mutability when nullability was enhanced for warning
#KT-56989
This commit is contained in:
committed by
Space Team
parent
a63ec9efdc
commit
2005446296
+27
@@ -0,0 +1,27 @@
|
||||
// NULLABILITY_ANNOTATIONS: @org.jetbrains.annotations:warn
|
||||
// DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// FILE: ReadOnly.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
public @interface ReadOnly {}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
|
||||
public class J {
|
||||
@ReadOnly
|
||||
@Nullable
|
||||
public static List<String> foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
takeMutable(<!ARGUMENT_TYPE_MISMATCH!>J.foo()<!>)
|
||||
}
|
||||
|
||||
fun takeMutable(l: MutableList<String>) {}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// NULLABILITY_ANNOTATIONS: @org.jetbrains.annotations:warn
|
||||
// DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// FILE: ReadOnly.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
public @interface ReadOnly {}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
|
||||
public class J {
|
||||
@ReadOnly
|
||||
@Nullable
|
||||
public static List<String> foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
takeMutable(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>J.foo()<!>)
|
||||
}
|
||||
|
||||
fun takeMutable(l: MutableList<String>) {}
|
||||
Reference in New Issue
Block a user