Refine diagnostics for nullability migration warnings
#KT-24911 Fixed
This commit is contained in:
+33
-24
@@ -45,8 +45,8 @@ class JavaNullabilityChecker : AdditionalTypeChecker {
|
|||||||
c.expectedType,
|
c.expectedType,
|
||||||
{ c.dataFlowValueFactory.createDataFlowValue(expression, expressionType, c) } ,
|
{ c.dataFlowValueFactory.createDataFlowValue(expression, expressionType, c) } ,
|
||||||
c.dataFlowInfo
|
c.dataFlowInfo
|
||||||
) { expectedMustNotBeNull, actualMayBeNull ->
|
) { expectedType, actualType ->
|
||||||
c.trace.report(ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS.on(expression, expectedMustNotBeNull, actualMayBeNull))
|
c.trace.report(ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS.on(expression, expectedType, actualType))
|
||||||
}
|
}
|
||||||
|
|
||||||
when (expression) {
|
when (expression) {
|
||||||
@@ -121,12 +121,15 @@ class JavaNullabilityChecker : AdditionalTypeChecker {
|
|||||||
receiverParameter.type,
|
receiverParameter.type,
|
||||||
{ dataFlowValue },
|
{ dataFlowValue },
|
||||||
c.dataFlowInfo
|
c.dataFlowInfo
|
||||||
) { expectedMustNotBeNull,
|
) { expectedType,
|
||||||
actualMayBeNull ->
|
actualType ->
|
||||||
val reportOn = (receiverArgument as? ExpressionReceiver)?.expression ?: (c.call.calleeExpression ?: c.call.callElement)
|
val receiverExpression = (receiverArgument as? ExpressionReceiver)?.expression
|
||||||
c.trace.report(ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS.on(
|
if (receiverExpression != null) {
|
||||||
reportOn, expectedMustNotBeNull, actualMayBeNull
|
c.trace.report(ErrorsJvm.RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS.on(receiverExpression, actualType))
|
||||||
))
|
} else {
|
||||||
|
val reportOn = c.call.calleeExpression ?: c.call.callElement
|
||||||
|
c.trace.report(ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS.on(reportOn, expectedType, actualType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,22 +138,21 @@ class JavaNullabilityChecker : AdditionalTypeChecker {
|
|||||||
expectedType: KotlinType,
|
expectedType: KotlinType,
|
||||||
dataFlowValue: () -> DataFlowValue,
|
dataFlowValue: () -> DataFlowValue,
|
||||||
dataFlowInfo: DataFlowInfo,
|
dataFlowInfo: DataFlowInfo,
|
||||||
reportWarning: (expectedMustNotBeNull: ErrorsJvm.NullabilityInformationSource, actualMayBeNull: ErrorsJvm.NullabilityInformationSource) -> Unit
|
reportWarning: (expectedType: KotlinType, actualType: KotlinType) -> Unit
|
||||||
) {
|
) {
|
||||||
if (TypeUtils.noExpectedType(expectedType)) {
|
if (TypeUtils.noExpectedType(expectedType)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val expectedMustNotBeNull = expectedType.mustNotBeNull()
|
val expectedMustNotBeNull = expectedType.mustNotBeNull() ?: return
|
||||||
val actualMayBeNull = expressionType.mayBeNull()
|
val actualMayBeNull = expressionType.mayBeNull() ?: return
|
||||||
if (expectedMustNotBeNull == ErrorsJvm.NullabilityInformationSource.KOTLIN && actualMayBeNull == ErrorsJvm.NullabilityInformationSource.KOTLIN) {
|
if (expectedMustNotBeNull.isFromKotlin && actualMayBeNull.isFromKotlin) {
|
||||||
// a type mismatch error will be reported elsewhere
|
// a type mismatch error will be reported elsewhere
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expectedMustNotBeNull != null && actualMayBeNull != null &&
|
if (dataFlowInfo.getStableNullability(dataFlowValue()) != Nullability.NOT_NULL) {
|
||||||
dataFlowInfo.getStableNullability(dataFlowValue()) != Nullability.NOT_NULL) {
|
reportWarning(expectedMustNotBeNull.enhancedType, actualMayBeNull.enhancedType)
|
||||||
reportWarning(expectedMustNotBeNull, actualMayBeNull)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,23 +161,30 @@ class JavaNullabilityChecker : AdditionalTypeChecker {
|
|||||||
dataFlowValue: () -> DataFlowValue,
|
dataFlowValue: () -> DataFlowValue,
|
||||||
c: ResolutionContext<*>,
|
c: ResolutionContext<*>,
|
||||||
body: () -> T
|
body: () -> T
|
||||||
) = if (type.mustNotBeNull() == ErrorsJvm.NullabilityInformationSource.JAVA &&
|
) = if (type.mustNotBeNull()?.isFromJava == true &&
|
||||||
c.dataFlowInfo.getStableNullability(dataFlowValue()).canBeNull())
|
c.dataFlowInfo.getStableNullability(dataFlowValue()).canBeNull())
|
||||||
body()
|
body()
|
||||||
else
|
else
|
||||||
null
|
null
|
||||||
|
|
||||||
private fun KotlinType.mustNotBeNull(): ErrorsJvm.NullabilityInformationSource? = when {
|
private class EnhancedNullabilityInfo(val enhancedType: KotlinType, val isFromJava: Boolean) {
|
||||||
!isError && !isFlexible() && !TypeUtils.acceptsNullable(this) -> ErrorsJvm.NullabilityInformationSource.KOTLIN
|
val isFromKotlin get() = !isFromJava
|
||||||
isFlexible() && !TypeUtils.acceptsNullable(asFlexibleType().upperBound) -> ErrorsJvm.NullabilityInformationSource.KOTLIN
|
}
|
||||||
this is TypeWithEnhancement && enhancement.mustNotBeNull() != null -> ErrorsJvm.NullabilityInformationSource.JAVA
|
|
||||||
|
private fun KotlinType.enhancementFromKotlin() = EnhancedNullabilityInfo(this, isFromJava = false)
|
||||||
|
private fun TypeWithEnhancement.enhancementFromJava() = EnhancedNullabilityInfo(enhancement, isFromJava = true)
|
||||||
|
|
||||||
|
private fun KotlinType.mustNotBeNull(): EnhancedNullabilityInfo? = when {
|
||||||
|
!isError && !isFlexible() && !TypeUtils.acceptsNullable(this) -> enhancementFromKotlin()
|
||||||
|
isFlexible() && !TypeUtils.acceptsNullable(asFlexibleType().upperBound) -> enhancementFromKotlin()
|
||||||
|
this is TypeWithEnhancement && enhancement.mustNotBeNull() != null -> enhancementFromJava()
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun KotlinType.mayBeNull(): ErrorsJvm.NullabilityInformationSource? = when {
|
private fun KotlinType.mayBeNull(): EnhancedNullabilityInfo? = when {
|
||||||
!isError && !isFlexible() && TypeUtils.acceptsNullable(this) -> ErrorsJvm.NullabilityInformationSource.KOTLIN
|
!isError && !isFlexible() && TypeUtils.acceptsNullable(this) -> enhancementFromKotlin()
|
||||||
isFlexible() && TypeUtils.acceptsNullable(asFlexibleType().lowerBound) -> ErrorsJvm.NullabilityInformationSource.KOTLIN
|
isFlexible() && TypeUtils.acceptsNullable(asFlexibleType().lowerBound) -> enhancementFromKotlin()
|
||||||
this is TypeWithEnhancement && enhancement.mayBeNull() != null -> ErrorsJvm.NullabilityInformationSource.JAVA
|
this is TypeWithEnhancement && enhancement.mayBeNull() != null -> enhancementFromJava()
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -87,8 +87,10 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
|||||||
MAP.put(INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER, "Interfaces can call default methods via super only within @JvmDefault members. Please annotate the containing interface member with @JvmDefault");
|
MAP.put(INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER, "Interfaces can call default methods via super only within @JvmDefault members. Please annotate the containing interface member with @JvmDefault");
|
||||||
MAP.put(SUBCLASS_CANT_CALL_COMPANION_PROTECTED_NON_STATIC, "Using non-JVM static members protected in the superclass companion is unsupported yet");
|
MAP.put(SUBCLASS_CANT_CALL_COMPANION_PROTECTED_NON_STATIC, "Using non-JVM static members protected in the superclass companion is unsupported yet");
|
||||||
|
|
||||||
MAP.put(ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS,
|
MAP.put(NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, "Type mismatch: inferred type is {1} but {0} was expected", RENDER_TYPE, RENDER_TYPE);
|
||||||
"Expected type does not accept nulls in {0}, but the value may be null in {1}", Renderers.TO_STRING, Renderers.TO_STRING);
|
MAP.put(RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS,
|
||||||
|
"Unsafe use of a nullable receiver of type {0}", RENDER_TYPE);
|
||||||
|
|
||||||
MAP.put(WHEN_ENUM_CAN_BE_NULL_IN_JAVA, "Enum argument can be null in Java, but exhaustive when contains no null branch");
|
MAP.put(WHEN_ENUM_CAN_BE_NULL_IN_JAVA, "Enum argument can be null in Java, but exhaustive when contains no null branch");
|
||||||
|
|
||||||
MAP.put(JAVA_CLASS_ON_COMPANION,
|
MAP.put(JAVA_CLASS_ON_COMPANION,
|
||||||
|
|||||||
+4
-19
@@ -17,7 +17,6 @@
|
|||||||
package org.jetbrains.kotlin.resolve.jvm.diagnostics;
|
package org.jetbrains.kotlin.resolve.jvm.diagnostics;
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.kotlin.diagnostics.*;
|
import org.jetbrains.kotlin.diagnostics.*;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
@@ -125,26 +124,12 @@ public interface ErrorsJvm {
|
|||||||
|
|
||||||
DiagnosticFactory0<KtAnnotationEntry> EXPLICIT_METADATA_IS_DISALLOWED = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<KtAnnotationEntry> EXPLICIT_METADATA_IS_DISALLOWED = DiagnosticFactory0.create(ERROR);
|
||||||
|
|
||||||
enum NullabilityInformationSource {
|
DiagnosticFactory2<KtElement, KotlinType, KotlinType> NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS
|
||||||
KOTLIN {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Kotlin";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
JAVA {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Java";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DiagnosticFactory2<KtElement, NullabilityInformationSource, NullabilityInformationSource> NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS
|
|
||||||
= DiagnosticFactory2.create(WARNING);
|
= DiagnosticFactory2.create(WARNING);
|
||||||
|
|
||||||
|
DiagnosticFactory1<KtElement, KotlinType> RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS
|
||||||
|
= DiagnosticFactory1.create(WARNING);
|
||||||
|
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
@SuppressWarnings("UnusedDeclaration")
|
||||||
Object _initializer = new Object() {
|
Object _initializer = new Object() {
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,4 +5,9 @@ public class Annotated {
|
|||||||
|
|
||||||
public void bar(@MyMigrationNonnull String x) {
|
public void bar(@MyMigrationNonnull String x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MyNullable
|
||||||
|
public String nullable() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import javax.annotation.*;
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
import javax.annotation.meta.TypeQualifierNickname;
|
||||||
|
import javax.annotation.meta.When;
|
||||||
|
|
||||||
|
@Documented
|
||||||
|
@TypeQualifierNickname
|
||||||
|
@Nonnull(when = When.MAYBE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface MyNullable {
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
warning: argument -Xjsr305-annotations is deprecated. Please use -Xjsr305 instead
|
warning: argument -Xjsr305-annotations is deprecated. Please use -Xjsr305 instead
|
||||||
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: warning: expected type does not accept nulls in Java, but the value may be null in Kotlin
|
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: warning: type mismatch: inferred type is Nothing? but String was expected
|
||||||
a.foo(null)
|
a.foo(null)
|
||||||
^
|
^
|
||||||
OK
|
OK
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
fun test(annotated: Annotated) {
|
fun test(annotated: Annotated) {
|
||||||
annotated.foo(null)
|
annotated.foo(null)
|
||||||
annotated.bar(null)
|
annotated.bar(null)
|
||||||
|
annotated.nullable().length
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
compiler/testData/cli/jvm/jsr305Migration.kt:2:19: warning: expected type does not accept nulls in Java, but the value may be null in Kotlin
|
compiler/testData/cli/jvm/jsr305Migration.kt:2:19: warning: type mismatch: inferred type is Nothing? but String was expected
|
||||||
annotated.foo(null)
|
annotated.foo(null)
|
||||||
^
|
^
|
||||||
|
compiler/testData/cli/jvm/jsr305Migration.kt:4:5: warning: unsafe use of a nullable receiver of type String?
|
||||||
|
annotated.nullable().length
|
||||||
|
^
|
||||||
OK
|
OK
|
||||||
|
|||||||
+4
-1
@@ -1,4 +1,7 @@
|
|||||||
compiler/testData/cli/jvm/jsr305Migration.kt:2:19: warning: expected type does not accept nulls in Java, but the value may be null in Kotlin
|
compiler/testData/cli/jvm/jsr305Migration.kt:2:19: warning: type mismatch: inferred type is Nothing? but String was expected
|
||||||
annotated.foo(null)
|
annotated.foo(null)
|
||||||
^
|
^
|
||||||
|
compiler/testData/cli/jvm/jsr305Migration.kt:4:5: warning: unsafe use of a nullable receiver of type String?
|
||||||
|
annotated.nullable().length
|
||||||
|
^
|
||||||
OK
|
OK
|
||||||
|
|||||||
+5
-2
@@ -1,7 +1,10 @@
|
|||||||
compiler/testData/cli/jvm/jsr305Migration.kt:2:19: warning: expected type does not accept nulls in Java, but the value may be null in Kotlin
|
compiler/testData/cli/jvm/jsr305Migration.kt:2:19: warning: type mismatch: inferred type is Nothing? but String was expected
|
||||||
annotated.foo(null)
|
annotated.foo(null)
|
||||||
^
|
^
|
||||||
compiler/testData/cli/jvm/jsr305Migration.kt:3:19: warning: expected type does not accept nulls in Java, but the value may be null in Kotlin
|
compiler/testData/cli/jvm/jsr305Migration.kt:3:19: warning: type mismatch: inferred type is Nothing? but String was expected
|
||||||
annotated.bar(null)
|
annotated.bar(null)
|
||||||
^
|
^
|
||||||
|
compiler/testData/cli/jvm/jsr305Migration.kt:4:5: warning: unsafe use of a nullable receiver of type String?
|
||||||
|
annotated.nullable().length
|
||||||
|
^
|
||||||
OK
|
OK
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: warning: expected type does not accept nulls in Java, but the value may be null in Kotlin
|
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: warning: type mismatch: inferred type is Nothing? but String was expected
|
||||||
a.foo(null)
|
a.foo(null)
|
||||||
^
|
^
|
||||||
OK
|
OK
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: warning: expected type does not accept nulls in Java, but the value may be null in Kotlin
|
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: warning: type mismatch: inferred type is Nothing? but String was expected
|
||||||
a.foo(null)
|
a.foo(null)
|
||||||
^
|
^
|
||||||
OK
|
OK
|
||||||
|
|||||||
@@ -27,18 +27,18 @@ public class A<T> {
|
|||||||
|
|
||||||
fun main(a: A<String>, a1: A<String?>) {
|
fun main(a: A<String>, a1: A<String?>) {
|
||||||
a.foo("", null)?.length
|
a.foo("", null)?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo("", null)<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS(String?)!>a.foo("", null)<!>.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS(String; Nothing?)!>null<!>, "")<!>.length
|
||||||
|
|
||||||
a.bar().length
|
a.bar().length
|
||||||
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
||||||
|
|
||||||
a.field?.length
|
a.field?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field<!>.length
|
||||||
|
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz("")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz("")<!>.length
|
||||||
a.baz("")?.length
|
a.baz("")?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)<!>.length
|
||||||
|
|
||||||
a1.baz("")!!.length
|
a1.baz("")!!.length
|
||||||
a1.baz(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)!!.length
|
a1.baz(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)!!.length
|
||||||
@@ -51,4 +51,3 @@ fun main(a: A<String>, a1: A<String?>) {
|
|||||||
a.baz2(null)<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
a.baz2(null)<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
||||||
a.baz2(null)<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
a.baz2(null)<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -18,15 +18,15 @@ fun test() {
|
|||||||
var platformJ = J.staticJ
|
var platformJ = J.staticJ
|
||||||
|
|
||||||
+platformNN
|
+platformNN
|
||||||
+<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
+<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||||
+platformJ
|
+platformJ
|
||||||
|
|
||||||
++platformNN
|
++platformNN
|
||||||
++<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
++<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||||
++platformJ
|
++platformJ
|
||||||
|
|
||||||
platformNN++
|
platformNN++
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>++
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>++
|
||||||
platformJ++
|
platformJ++
|
||||||
|
|
||||||
1 + platformNN
|
1 + platformNN
|
||||||
@@ -34,7 +34,7 @@ fun test() {
|
|||||||
1 + platformJ
|
1 + platformJ
|
||||||
|
|
||||||
platformNN + 1
|
platformNN + 1
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> + 1
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> + 1
|
||||||
platformJ + 1
|
platformJ + 1
|
||||||
|
|
||||||
1 <!INFIX_MODIFIER_REQUIRED!>plus<!> platformNN
|
1 <!INFIX_MODIFIER_REQUIRED!>plus<!> platformNN
|
||||||
@@ -42,10 +42,10 @@ fun test() {
|
|||||||
1 <!INFIX_MODIFIER_REQUIRED!>plus<!> platformJ
|
1 <!INFIX_MODIFIER_REQUIRED!>plus<!> platformJ
|
||||||
|
|
||||||
platformNN <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
|
platformNN <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
|
||||||
platformJ <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
|
platformJ <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
|
||||||
|
|
||||||
platformNN += 1
|
platformNN += 1
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> += 1
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> += 1
|
||||||
platformJ += 1
|
platformJ += 1
|
||||||
}
|
}
|
||||||
Vendored
+2
-2
@@ -18,10 +18,10 @@ fun test() {
|
|||||||
val platformJ = J.staticJ
|
val platformJ = J.staticJ
|
||||||
|
|
||||||
platformNN[0]
|
platformNN[0]
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>[0]
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>[0]
|
||||||
platformJ[0]
|
platformJ[0]
|
||||||
|
|
||||||
platformNN[0] = 1
|
platformNN[0] = 1
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>[0] = 1
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>[0] = 1
|
||||||
platformJ[0] = 1
|
platformJ[0] = 1
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -39,6 +39,6 @@ fun test() {
|
|||||||
platformJ || false
|
platformJ || false
|
||||||
|
|
||||||
!platformNN
|
!platformNN
|
||||||
!<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
!<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||||
!platformJ
|
!platformJ
|
||||||
}
|
}
|
||||||
+1
-1
@@ -19,5 +19,5 @@ public class J {
|
|||||||
// FILE: k.kt
|
// FILE: k.kt
|
||||||
|
|
||||||
var A by J.staticNN
|
var A by J.staticNN
|
||||||
var B by <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>J.staticN<!>
|
var B by <!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>J.staticN<!>
|
||||||
var C by J.staticJ
|
var C by J.staticJ
|
||||||
+1
-1
@@ -19,7 +19,7 @@ fun test() {
|
|||||||
val platformJ = J.staticJ
|
val platformJ = J.staticJ
|
||||||
|
|
||||||
platformNN.foo()
|
platformNN.foo()
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>.foo()
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>.foo()
|
||||||
platformJ.foo()
|
platformJ.foo()
|
||||||
|
|
||||||
with(platformNN) {
|
with(platformNN) {
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ fun test() {
|
|||||||
val platformJ = J.staticJ
|
val platformJ = J.staticJ
|
||||||
|
|
||||||
platformNN.foo()
|
platformNN.foo()
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>.foo()
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>.foo()
|
||||||
platformJ.foo()
|
platformJ.foo()
|
||||||
|
|
||||||
with(platformNN) {
|
with(platformNN) {
|
||||||
|
|||||||
Vendored
+1
-2
@@ -20,7 +20,6 @@ fun test() {
|
|||||||
val platformJ = J.staticJ
|
val platformJ = J.staticJ
|
||||||
|
|
||||||
for (x in platformNN) {}
|
for (x in platformNN) {}
|
||||||
for (x in <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>) {}
|
for (x in <!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>) {}
|
||||||
for (x in platformJ) {}
|
for (x in platformJ) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -18,6 +18,6 @@ public class J {
|
|||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
J.staticNN()
|
J.staticNN()
|
||||||
J.<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>staticN<!>()
|
J.<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>staticN<!>()
|
||||||
J.staticJ()
|
J.staticJ()
|
||||||
}
|
}
|
||||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ public class J {
|
|||||||
|
|
||||||
fun foo(collection: Collection<J>) {
|
fun foo(collection: Collection<J>) {
|
||||||
val mapped = collection.map { it.method() }
|
val mapped = collection.map { it.method() }
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>mapped[0]<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>mapped[0]<!>.length
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R> {
|
public fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R> {
|
||||||
|
|||||||
+1
-1
@@ -24,6 +24,6 @@ fun test() {
|
|||||||
val platformJ = J.staticJ
|
val platformJ = J.staticJ
|
||||||
|
|
||||||
val (a1, b1) = platformNN
|
val (a1, b1) = platformNN
|
||||||
val (a2, b2) = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
val (a2, b2) = <!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||||
val (a3, b3) = platformJ
|
val (a3, b3) = platformJ
|
||||||
}
|
}
|
||||||
+2
-3
@@ -18,11 +18,10 @@ fun test() {
|
|||||||
val platformJ = J.staticJ
|
val platformJ = J.staticJ
|
||||||
|
|
||||||
platformNN[0]
|
platformNN[0]
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>[0]
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>[0]
|
||||||
platformJ[0]
|
platformJ[0]
|
||||||
|
|
||||||
platformNN[0] = 1
|
platformNN[0] = 1
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>[0] = 1
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>[0] = 1
|
||||||
platformJ[0] = 1
|
platformJ[0] = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+5
-5
@@ -79,15 +79,15 @@ public class A {
|
|||||||
|
|
||||||
fun main(a: A) {
|
fun main(a: A) {
|
||||||
a.foo("", null)?.length
|
a.foo("", null)?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo("", null)<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo("", null)<!>.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "")<!>.length
|
||||||
|
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz("", null)<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz("", null)<!>.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "")<!>.length
|
||||||
|
|
||||||
a.bar().length
|
a.bar().length
|
||||||
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
||||||
|
|
||||||
a.field?.length
|
a.field?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field<!>.length
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ fun main(a: A) {
|
|||||||
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
||||||
|
|
||||||
a.field?.length
|
a.field?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field<!>.length
|
||||||
a.field = null
|
a.field = null
|
||||||
|
|
||||||
a.nonNullField<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
a.nonNullField<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
||||||
|
|||||||
+7
-7
@@ -134,7 +134,7 @@ fun main(a: A, b: A.B, c: A.C) {
|
|||||||
a.foo("", null).length
|
a.foo("", null).length
|
||||||
a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "").length
|
a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "").length
|
||||||
|
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foobar(null, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foobar(null, "")<!>.length
|
||||||
a.foobar("", <!NULL_FOR_NONNULL_TYPE!>null<!>)?.length
|
a.foobar("", <!NULL_FOR_NONNULL_TYPE!>null<!>)?.length
|
||||||
|
|
||||||
a.bar().length
|
a.bar().length
|
||||||
@@ -149,17 +149,17 @@ fun main(a: A, b: A.B, c: A.C) {
|
|||||||
|
|
||||||
// b
|
// b
|
||||||
b.foo("", <!NULL_FOR_NONNULL_TYPE!>null<!>)?.length
|
b.foo("", <!NULL_FOR_NONNULL_TYPE!>null<!>)?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.foo("", <!NULL_FOR_NONNULL_TYPE!>null<!>)<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.foo("", <!NULL_FOR_NONNULL_TYPE!>null<!>)<!>.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.foo(null, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.foo(null, "")<!>.length
|
||||||
|
|
||||||
b.foobar(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "").length
|
b.foobar(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "").length
|
||||||
b.foobar("", null)<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
b.foobar("", null)<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
||||||
|
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.bar()<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.bar()<!>.length
|
||||||
b.bar()!!.length
|
b.bar()!!.length
|
||||||
|
|
||||||
b.field?.length
|
b.field?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.field<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.field<!>.length
|
||||||
|
|
||||||
b.baz()<!UNSAFE_CALL!>.<!>get(0)
|
b.baz()<!UNSAFE_CALL!>.<!>get(0)
|
||||||
b.baz()!!.get(0).get(0)
|
b.baz()!!.get(0).get(0)
|
||||||
@@ -170,14 +170,14 @@ fun main(a: A, b: A.B, c: A.C) {
|
|||||||
c.foo("", null).length
|
c.foo("", null).length
|
||||||
c.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "").length
|
c.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "").length
|
||||||
|
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>c.foobar(null, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>c.foobar(null, "")<!>.length
|
||||||
c.foobar("", null)?.length
|
c.foobar("", null)?.length
|
||||||
|
|
||||||
c.bar().length
|
c.bar().length
|
||||||
c.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
c.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
||||||
|
|
||||||
c.field?.length
|
c.field?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>c.field<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>c.field<!>.length
|
||||||
|
|
||||||
c.baz()<!UNSAFE_CALL!>.<!>get(0)
|
c.baz()<!UNSAFE_CALL!>.<!>get(0)
|
||||||
c.baz()!!.get(0).get(0)
|
c.baz()!!.get(0).get(0)
|
||||||
|
|||||||
+2
-2
@@ -69,7 +69,7 @@ public class A {
|
|||||||
fun main(a: A) {
|
fun main(a: A) {
|
||||||
a.foo("", null)<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
a.foo("", null)<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
||||||
a.foo("", null).length
|
a.foo("", null).length
|
||||||
a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "").length
|
a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS(String; Nothing?)!>null<!>, "").length
|
||||||
|
|
||||||
a.bar().length
|
a.bar().length
|
||||||
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
||||||
@@ -77,7 +77,7 @@ fun main(a: A) {
|
|||||||
a.field?.length
|
a.field?.length
|
||||||
a.field.length
|
a.field.length
|
||||||
|
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz()<!>.get(0)
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS(MutableList<String!>?)!>a.baz()<!>.get(0)
|
||||||
a.baz()!!.get(0).get(0)
|
a.baz()!!.get(0).get(0)
|
||||||
a.baz()!!.get(0)?.get(0)
|
a.baz()!!.get(0)?.get(0)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ fun main(a: test.A) {
|
|||||||
a.field?.length
|
a.field?.length
|
||||||
a.field.length
|
a.field.length
|
||||||
|
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz()<!>.get(0)
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.baz()<!>.get(0)
|
||||||
a.baz()!!.get(0).get(0)
|
a.baz()!!.get(0).get(0)
|
||||||
a.baz()!!.get(0)?.get(0)
|
a.baz()!!.get(0)?.get(0)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-3
@@ -64,14 +64,14 @@ fun main(a: A) {
|
|||||||
a.field<!UNSAFE_CALL!>.<!>length
|
a.field<!UNSAFE_CALL!>.<!>length
|
||||||
|
|
||||||
a.foo2("", null)?.length
|
a.foo2("", null)?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo2("", null)<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo2("", null)<!>.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo2(null, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo2(null, "")<!>.length
|
||||||
|
|
||||||
a.bar2().length
|
a.bar2().length
|
||||||
a.bar2()!!.length
|
a.bar2()!!.length
|
||||||
|
|
||||||
a.field2?.length
|
a.field2?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field2<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field2<!>.length
|
||||||
|
|
||||||
a.field3?.length
|
a.field3?.length
|
||||||
a.field3<!UNSAFE_CALL!>.<!>length
|
a.field3<!UNSAFE_CALL!>.<!>length
|
||||||
|
|||||||
Vendored
+3
-3
@@ -46,12 +46,12 @@ fun main(a: A) {
|
|||||||
a.field.length
|
a.field.length
|
||||||
|
|
||||||
a.foo2("", null)?.length
|
a.foo2("", null)?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo2("", null)<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo2("", null)<!>.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo2(<!NULL_FOR_NONNULL_TYPE!>null<!>, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo2(<!NULL_FOR_NONNULL_TYPE!>null<!>, "")<!>.length
|
||||||
|
|
||||||
a.bar2().length
|
a.bar2().length
|
||||||
a.bar2()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
a.bar2()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
||||||
|
|
||||||
a.field2?.length
|
a.field2?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field2<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field2<!>.length
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -66,7 +66,7 @@ fun main(b: B, c: C) {
|
|||||||
b.foo2()?.length
|
b.foo2()?.length
|
||||||
b.foo3()<!UNSAFE_CALL!>.<!>length
|
b.foo3()<!UNSAFE_CALL!>.<!>length
|
||||||
b.foo3()?.length
|
b.foo3()?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.foo4()<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>b.foo4()<!>.length
|
||||||
b.foo4()?.length
|
b.foo4()?.length
|
||||||
|
|
||||||
b.bar(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
b.bar(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||||
|
|||||||
Vendored
+3
-3
@@ -36,14 +36,14 @@ public class A {
|
|||||||
|
|
||||||
fun main(a: A) {
|
fun main(a: A) {
|
||||||
a.foo("", null)?.length
|
a.foo("", null)?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo("", null)<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo("", null)<!>.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "")<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, "")<!>.length
|
||||||
|
|
||||||
a.bar().length
|
a.bar().length
|
||||||
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
a.bar()<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.length
|
||||||
|
|
||||||
a.field?.length
|
a.field?.length
|
||||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field<!>.length
|
<!RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>a.field<!>.length
|
||||||
|
|
||||||
a.foo2("", null)?.length
|
a.foo2("", null)?.length
|
||||||
a.foo2("", null).length
|
a.foo2("", null).length
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import static org.jetbrains.kotlin.idea.highlighter.HtmlTabledDescriptorRenderer
|
|||||||
import static org.jetbrains.kotlin.idea.highlighter.IdeRenderers.*;
|
import static org.jetbrains.kotlin.idea.highlighter.IdeRenderers.*;
|
||||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.ACCIDENTAL_OVERRIDE;
|
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.ACCIDENTAL_OVERRIDE;
|
||||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.CONFLICTING_JVM_DECLARATIONS;
|
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.CONFLICTING_JVM_DECLARATIONS;
|
||||||
|
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,6 +64,9 @@ public class IdeErrorMessages {
|
|||||||
MAP.put(TYPE_MISMATCH, "<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table></html>",
|
MAP.put(TYPE_MISMATCH, "<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table></html>",
|
||||||
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
|
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
|
||||||
|
|
||||||
|
MAP.put(NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, "<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table></html>",
|
||||||
|
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
|
||||||
|
|
||||||
MAP.put(TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS,
|
MAP.put(TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS,
|
||||||
"<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table><br />\n" +
|
"<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table><br />\n" +
|
||||||
"Projected type {2} restricts use of <br />\n{3}\n</html>",
|
"Projected type {2} restricts use of <br />\n{3}\n</html>",
|
||||||
|
|||||||
Reference in New Issue
Block a user