[FIR] do not treat external ide annotations as real one
Such annotations are supposed to affect only diagnostic warnings ^KT-62310 Fixed
This commit is contained in:
committed by
Space Team
parent
2cac922cd0
commit
b2c8d7e777
+2
-2
@@ -18,7 +18,7 @@ public class ClassWithExternalAnnotatedMembers {
|
||||
// FILE: usage.kt
|
||||
fun test() {
|
||||
val i: Int? = null
|
||||
<!NONE_APPLICABLE!>ClassWithExternalAnnotatedMembers<!>(i)
|
||||
ClassWithExternalAnnotatedMembers(i)
|
||||
|
||||
val s: String? = null
|
||||
<!NONE_APPLICABLE!>ClassWithExternalAnnotatedMembers<!>(s)
|
||||
@@ -26,7 +26,7 @@ fun test() {
|
||||
val b: Boolean? = null
|
||||
ClassWithExternalAnnotatedMembers(b)
|
||||
|
||||
ClassWithExternalAnnotatedMembers(null)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>ClassWithExternalAnnotatedMembers<!>(null)
|
||||
}
|
||||
|
||||
// FILE: annotations.xml
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ public class ClassWithExternalAnnotatedMembers {
|
||||
// FILE: usage.kt
|
||||
fun test() {
|
||||
val i: Int? = null
|
||||
<!NONE_APPLICABLE!>ClassWithExternalAnnotatedMembers<!>(i)
|
||||
ClassWithExternalAnnotatedMembers(i)
|
||||
|
||||
val s: String? = null
|
||||
<!NONE_APPLICABLE!>ClassWithExternalAnnotatedMembers<!>(s)
|
||||
@@ -22,7 +22,7 @@ fun test() {
|
||||
val b: Boolean? = null
|
||||
<!NONE_APPLICABLE!>ClassWithExternalAnnotatedMembers<!>(b)
|
||||
|
||||
<!NONE_APPLICABLE!>ClassWithExternalAnnotatedMembers<!>(null)
|
||||
ClassWithExternalAnnotatedMembers(null)
|
||||
}
|
||||
|
||||
// FILE: annotations.xml
|
||||
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// FILE: ClassWithExternalAnnotatedMembers.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ClassWithExternalAnnotatedMembers {
|
||||
public String externalNotNullField;
|
||||
|
||||
@NotNull
|
||||
public String explicitNotNullField;
|
||||
|
||||
public static String staticExternalNotNullField;
|
||||
|
||||
@NotNull
|
||||
public static String staticExplicitNotNullField;
|
||||
}
|
||||
|
||||
// FILE: usage.kt
|
||||
fun test() {
|
||||
val x = ClassWithExternalAnnotatedMembers()
|
||||
x.externalNotNullField?.foo()
|
||||
x.explicitNotNullField<!UNNECESSARY_SAFE_CALL!>?.<!>foo()
|
||||
|
||||
ClassWithExternalAnnotatedMembers.staticExternalNotNullField?.foo()
|
||||
ClassWithExternalAnnotatedMembers.staticExplicitNotNullField<!UNNECESSARY_SAFE_CALL!>?.<!>foo()
|
||||
}
|
||||
|
||||
fun String.foo() {
|
||||
|
||||
}
|
||||
|
||||
// FILE: annotations.xml
|
||||
<root>
|
||||
<item name='ClassWithExternalAnnotatedMembers externalNotNullField'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='ClassWithExternalAnnotatedMembers staticExternalNotNullField'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: ClassWithExternalAnnotatedMembers.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// FILE: one/two/ClassWithExternalAnnotatedMembers.java
|
||||
package one.two;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ClassWithExternalAnnotatedMembers {
|
||||
public String externalNotNullField;
|
||||
|
||||
@NotNull
|
||||
public String explicitNotNullField;
|
||||
|
||||
public static String staticExternalNotNullField;
|
||||
|
||||
@NotNull
|
||||
public static String staticExplicitNotNullField;
|
||||
}
|
||||
|
||||
// FILE: one/usage.kt
|
||||
package one
|
||||
|
||||
import one.two.ClassWithExternalAnnotatedMembers
|
||||
|
||||
fun test() {
|
||||
val x = ClassWithExternalAnnotatedMembers()
|
||||
x.externalNotNullField?.foo()
|
||||
x.explicitNotNullField<!UNNECESSARY_SAFE_CALL!>?.<!>foo()
|
||||
|
||||
ClassWithExternalAnnotatedMembers.staticExternalNotNullField?.foo()
|
||||
ClassWithExternalAnnotatedMembers.staticExplicitNotNullField<!UNNECESSARY_SAFE_CALL!>?.<!>foo()
|
||||
}
|
||||
|
||||
fun String.foo() {
|
||||
|
||||
}
|
||||
|
||||
// FILE: one/two/annotations.xml
|
||||
<root>
|
||||
<item name='one.two.ClassWithExternalAnnotatedMembers externalNotNullField'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='one.two.ClassWithExternalAnnotatedMembers staticExternalNotNullField'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: one/two/ClassWithExternalAnnotatedMembers.java
|
||||
package one.two;
|
||||
|
||||
|
||||
compiler/testData/diagnostics/foreignAnnotationsTests/tests/externalAnnotations/methodNotNull.fir.kt
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
// FILE: ClassWithExternalAnnotatedMembers.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ClassWithExternalAnnotatedMembers {
|
||||
public String externalNotNullMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String explicitNotNullMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String staticExternalNotNullMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String staticExplicitNotNullMethod() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: usage.kt
|
||||
fun test() {
|
||||
val x = ClassWithExternalAnnotatedMembers()
|
||||
x.externalNotNullMethod()?.foo()
|
||||
x.explicitNotNullMethod()<!UNNECESSARY_SAFE_CALL!>?.<!>foo()
|
||||
|
||||
ClassWithExternalAnnotatedMembers.staticExternalNotNullMethod()?.foo()
|
||||
ClassWithExternalAnnotatedMembers.staticExplicitNotNullMethod()<!UNNECESSARY_SAFE_CALL!>?.<!>foo()
|
||||
}
|
||||
|
||||
fun String.foo() {
|
||||
|
||||
}
|
||||
|
||||
// FILE: annotations.xml
|
||||
<root>
|
||||
<item name='ClassWithExternalAnnotatedMembers java.lang.String externalNotNullMethod()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='ClassWithExternalAnnotatedMembers java.lang.String staticExternalNotNullMethod()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: ClassWithExternalAnnotatedMembers.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
// MODULE: javaModule
|
||||
// FILE: one/two/FirstModuleClass.java
|
||||
package one.two;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FirstModuleClass {
|
||||
public String externalNotNullMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String explicitNotNullMethod() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// FILE: one/two/annotations.xml
|
||||
<root>
|
||||
<item name='one.two.FirstModuleClass java.lang.String externalNotNullMethod()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
// FILE: usage.kt
|
||||
package usage1
|
||||
|
||||
import one.two.FirstModuleClass
|
||||
|
||||
fun test() {
|
||||
val x = FirstModuleClass()
|
||||
x.externalNotNullMethod()?.foo()
|
||||
x.explicitNotNullMethod()<!UNNECESSARY_SAFE_CALL!>?.<!>foo()
|
||||
}
|
||||
|
||||
fun String.foo() {
|
||||
|
||||
}
|
||||
// MODULE: javaModule2
|
||||
// FILE: three/SecondModuleClass.java
|
||||
package three;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SecondModuleClass {
|
||||
public static String staticExternalNotNullMethod() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String staticExplicitNotNullMethod() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// FILE: three/annotations.xml
|
||||
<root>
|
||||
<item name='three.SecondModuleClass java.lang.String staticExternalNotNullMethod()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
// FILE: my/pack/usage.kt
|
||||
package my.pack
|
||||
|
||||
import three.SecondModuleClass
|
||||
|
||||
fun test() {
|
||||
SecondModuleClass.staticExternalNotNullMethod()?.foo()
|
||||
SecondModuleClass.staticExplicitNotNullMethod()<!UNNECESSARY_SAFE_CALL!>?.<!>foo()
|
||||
}
|
||||
|
||||
fun String.foo() {
|
||||
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: javaModule
|
||||
// FILE: one/two/FirstModuleClass.java
|
||||
package one.two;
|
||||
|
||||
+2
-2
@@ -16,12 +16,12 @@ fun test() {
|
||||
instance.<!NONE_APPLICABLE!>method<!>(i)
|
||||
|
||||
val s: String? = null
|
||||
instance.<!NONE_APPLICABLE!>method<!>(s)
|
||||
instance.method(s)
|
||||
|
||||
val b: Boolean? = null
|
||||
instance.<!NONE_APPLICABLE!>method<!>(b)
|
||||
|
||||
instance.<!NONE_APPLICABLE!>method<!>(null)
|
||||
instance.method(null)
|
||||
}
|
||||
|
||||
// FILE: annotations.xml
|
||||
|
||||
+2
-2
@@ -19,12 +19,12 @@ fun test() {
|
||||
instance.<!NONE_APPLICABLE!>method<!>(i)
|
||||
|
||||
val s: String? = null
|
||||
instance.<!NONE_APPLICABLE!>method<!>(s)
|
||||
instance.method(s)
|
||||
|
||||
val b: Boolean? = null
|
||||
instance.method(b)
|
||||
|
||||
instance.method(null)
|
||||
instance.<!OVERLOAD_RESOLUTION_AMBIGUITY!>method<!>(null)
|
||||
}
|
||||
|
||||
// FILE: annotations.xml
|
||||
|
||||
Reference in New Issue
Block a user