Ignore @Nullable annotation for vararg parameter
See the comment in code for clarification #KT-19786 Fixed
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
|||||||
|
// FILE: BaseClass.java
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class BaseClass {
|
||||||
|
public void loadCache(@NotNull Object... args) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class A : BaseClass() {
|
||||||
|
// org.jetbrains.annotations.NotNull has @Target PARAMETER, so it doesn't affect elements type
|
||||||
|
override fun loadCache(vararg args: Any?) {
|
||||||
|
super.loadCache(*args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B : BaseClass() {
|
||||||
|
// org.jetbrains.annotations.NotNull has @Target PARAMETER, so it doesn't affect elements type
|
||||||
|
override fun loadCache(vararg args: Any) {
|
||||||
|
super.loadCache(*args)
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final class A : BaseClass {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ fun loadCache(/*0*/ vararg args: kotlin.Any? /*kotlin.Array<out kotlin.Any?>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B : BaseClass {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ fun loadCache(/*0*/ vararg args: kotlin.Any /*kotlin.Array<out kotlin.Any>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class BaseClass {
|
||||||
|
public constructor BaseClass()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun loadCache(/*0*/ @org.jetbrains.annotations.NotNull vararg args: kotlin.Any! /*kotlin.Array<(out) kotlin.Any!>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
// FILE: BaseClass.java
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class BaseClass {
|
||||||
|
public void loadCache(@Nullable Object... args) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class A : BaseClass() {
|
||||||
|
// org.jetbrains.annotations.Nullable has @Target PARAMETER, so it doesn't affect elements type
|
||||||
|
override fun loadCache(vararg args: Any?) {
|
||||||
|
super.loadCache(*args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B : BaseClass() {
|
||||||
|
// org.jetbrains.annotations.Nullable has @Target PARAMETER, so it doesn't affect elements type
|
||||||
|
override fun loadCache(vararg args: Any) {
|
||||||
|
super.loadCache(*args)
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final class A : BaseClass {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ fun loadCache(/*0*/ vararg args: kotlin.Any? /*kotlin.Array<out kotlin.Any?>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B : BaseClass {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ fun loadCache(/*0*/ vararg args: kotlin.Any /*kotlin.Array<out kotlin.Any>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class BaseClass {
|
||||||
|
public constructor BaseClass()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun loadCache(/*0*/ @org.jetbrains.annotations.Nullable vararg args: kotlin.Any! /*kotlin.Array<(out) kotlin.Any!>!*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
// JAVAC_EXPECTED_FILE
|
||||||
|
// SKIP_COMPILED_JAVA
|
||||||
|
// FILE: BaseClass.java
|
||||||
|
import org.checkerframework.checker.nullness.qual.*;
|
||||||
|
|
||||||
|
public class BaseClass {
|
||||||
|
public void loadCache(@NonNull Object... args) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class A : BaseClass() {
|
||||||
|
// org.checkerframework.checker.nullness.qual.NonNull has @Target TYPE_USE, so it affects only elements type
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun loadCache(vararg args: Any?) {
|
||||||
|
super.loadCache(*<!TYPE_MISMATCH!>args<!>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B : BaseClass() {
|
||||||
|
override fun loadCache(vararg args: Any) {
|
||||||
|
super.loadCache(*args)
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final class A : BaseClass {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun loadCache(/*0*/ @org.checkerframework.checker.nullness.qual.NonNull vararg args: @org.checkerframework.checker.nullness.qual.NonNull kotlin.Any /*kotlin.Array<(out) @org.checkerframework.checker.nullness.qual.NonNull kotlin.Any>*/): kotlin.Unit
|
||||||
|
public open fun loadCache(/*0*/ vararg args: kotlin.Any? /*kotlin.Array<out kotlin.Any?>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B : BaseClass {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ fun loadCache(/*0*/ vararg args: kotlin.Any /*kotlin.Array<out kotlin.Any>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class BaseClass {
|
||||||
|
public constructor BaseClass()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun loadCache(/*0*/ @org.checkerframework.checker.nullness.qual.NonNull vararg args: @org.checkerframework.checker.nullness.qual.NonNull kotlin.Any /*kotlin.Array<(out) @org.checkerframework.checker.nullness.qual.NonNull kotlin.Any>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
Vendored
+23
@@ -0,0 +1,23 @@
|
|||||||
|
// JAVAC_EXPECTED_FILE
|
||||||
|
// SKIP_COMPILED_JAVA
|
||||||
|
// FILE: BaseClass.java
|
||||||
|
import org.checkerframework.checker.nullness.qual.*;
|
||||||
|
|
||||||
|
public class BaseClass {
|
||||||
|
public void loadCache(@Nullable Object... args) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class A : BaseClass() {
|
||||||
|
override fun loadCache(vararg args: Any?) {
|
||||||
|
super.loadCache(*args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B : BaseClass() {
|
||||||
|
// org.checkerframework.checker.nullness.qual.Nullable has @Target TYPE_USE, so it affects only elements type
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun loadCache(vararg args: Any) {
|
||||||
|
super.loadCache(*args)
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final class A : BaseClass {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ fun loadCache(/*0*/ vararg args: kotlin.Any? /*kotlin.Array<out kotlin.Any?>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B : BaseClass {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun loadCache(/*0*/ @org.checkerframework.checker.nullness.qual.Nullable vararg args: @org.checkerframework.checker.nullness.qual.Nullable kotlin.Any? /*kotlin.Array<(out) @org.checkerframework.checker.nullness.qual.Nullable kotlin.Any?>!*/): kotlin.Unit
|
||||||
|
public open fun loadCache(/*0*/ vararg args: kotlin.Any /*kotlin.Array<out kotlin.Any>*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class BaseClass {
|
||||||
|
public constructor BaseClass()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun loadCache(/*0*/ @org.checkerframework.checker.nullness.qual.Nullable vararg args: @org.checkerframework.checker.nullness.qual.Nullable kotlin.Any? /*kotlin.Array<(out) @org.checkerframework.checker.nullness.qual.Nullable kotlin.Any?>!*/): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+12
@@ -102,6 +102,18 @@ public class ForeignJava8AnnotationsNoAnnotationInClasspathTestGenerated extends
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("notNullVarargsOverrides.kt")
|
||||||
|
public void testNotNullVarargsOverrides() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/notNullVarargsOverrides.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableVarargsOverrides.kt")
|
||||||
|
public void testNullableVarargsOverrides() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/nullableVarargsOverrides.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("returnTypeDifferentConstructor.kt")
|
@TestMetadata("returnTypeDifferentConstructor.kt")
|
||||||
public void testReturnTypeDifferentConstructor() throws Exception {
|
public void testReturnTypeDifferentConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
||||||
|
|||||||
+12
@@ -102,6 +102,18 @@ public class ForeignJava8AnnotationsNoAnnotationInClasspathWithFastClassReadingT
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("notNullVarargsOverrides.kt")
|
||||||
|
public void testNotNullVarargsOverrides() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/notNullVarargsOverrides.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableVarargsOverrides.kt")
|
||||||
|
public void testNullableVarargsOverrides() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/nullableVarargsOverrides.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("returnTypeDifferentConstructor.kt")
|
@TestMetadata("returnTypeDifferentConstructor.kt")
|
||||||
public void testReturnTypeDifferentConstructor() throws Exception {
|
public void testReturnTypeDifferentConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
||||||
|
|||||||
Generated
+12
@@ -102,6 +102,18 @@ public class ForeignJava8AnnotationsTestGenerated extends AbstractForeignJava8An
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("notNullVarargsOverrides.kt")
|
||||||
|
public void testNotNullVarargsOverrides() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/notNullVarargsOverrides.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableVarargsOverrides.kt")
|
||||||
|
public void testNullableVarargsOverrides() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/nullableVarargsOverrides.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("returnTypeDifferentConstructor.kt")
|
@TestMetadata("returnTypeDifferentConstructor.kt")
|
||||||
public void testReturnTypeDifferentConstructor() throws Exception {
|
public void testReturnTypeDifferentConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
||||||
|
|||||||
+12
@@ -102,6 +102,18 @@ public class JavacForeignJava8AnnotationsTestGenerated extends AbstractJavacFore
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("notNullVarargsOverrides.kt")
|
||||||
|
public void testNotNullVarargsOverrides() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/notNullVarargsOverrides.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableVarargsOverrides.kt")
|
||||||
|
public void testNullableVarargsOverrides() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/nullableVarargsOverrides.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("returnTypeDifferentConstructor.kt")
|
@TestMetadata("returnTypeDifferentConstructor.kt")
|
||||||
public void testReturnTypeDifferentConstructor() throws Exception {
|
public void testReturnTypeDifferentConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
||||||
|
|||||||
@@ -13303,6 +13303,18 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("notNullVarargOverride.kt")
|
||||||
|
public void testNotNullVarargOverride() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/signatureAnnotations/notNullVarargOverride.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableVarargOverride.kt")
|
||||||
|
public void testNullableVarargOverride() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/signatureAnnotations/nullableVarargOverride.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("overridesDefaultValue.kt")
|
@TestMetadata("overridesDefaultValue.kt")
|
||||||
public void testOverridesDefaultValue() throws Exception {
|
public void testOverridesDefaultValue() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.kt");
|
||||||
|
|||||||
Generated
+12
@@ -13303,6 +13303,18 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("notNullVarargOverride.kt")
|
||||||
|
public void testNotNullVarargOverride() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/signatureAnnotations/notNullVarargOverride.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("nullableVarargOverride.kt")
|
||||||
|
public void testNullableVarargOverride() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/signatureAnnotations/nullableVarargOverride.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("overridesDefaultValue.kt")
|
@TestMetadata("overridesDefaultValue.kt")
|
||||||
public void testOverridesDefaultValue() throws Exception {
|
public void testOverridesDefaultValue() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.kt");
|
||||||
|
|||||||
+9
-1
@@ -195,6 +195,9 @@ class SignatureEnhancement(
|
|||||||
private val containerContext: LazyJavaResolverContext,
|
private val containerContext: LazyJavaResolverContext,
|
||||||
private val containerApplicabilityType: AnnotationTypeQualifierResolver.QualifierApplicabilityType
|
private val containerApplicabilityType: AnnotationTypeQualifierResolver.QualifierApplicabilityType
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
private val isForVarargParameter get() = typeContainer.safeAs<ValueParameterDescriptor>()?.varargElementType != null
|
||||||
|
|
||||||
fun enhance(predefined: TypeEnhancementInfo? = null): PartEnhancementResult {
|
fun enhance(predefined: TypeEnhancementInfo? = null): PartEnhancementResult {
|
||||||
val qualifiers = computeIndexedQualifiersForOverride()
|
val qualifiers = computeIndexedQualifiersForOverride()
|
||||||
|
|
||||||
@@ -352,7 +355,12 @@ class SignatureEnhancement(
|
|||||||
val ownNullabilityForWarning = own.nullability
|
val ownNullabilityForWarning = own.nullability
|
||||||
|
|
||||||
val isCovariantPosition = isCovariant && isHeadTypeConstructor
|
val isCovariantPosition = isCovariant && isHeadTypeConstructor
|
||||||
val nullability = nullabilityFromSupertypes.select(ownNullability, isCovariantPosition)
|
val nullability =
|
||||||
|
nullabilityFromSupertypes.select(ownNullability, isCovariantPosition)
|
||||||
|
// Vararg value parameters effectively have non-nullable type in Kotlin
|
||||||
|
// and having nullable types in Java may lead to impossibility of overriding them in Kotlin
|
||||||
|
?.takeUnless { isForVarargParameter && isHeadTypeConstructor && it == NullabilityQualifier.NULLABLE }
|
||||||
|
|
||||||
val mutability =
|
val mutability =
|
||||||
mutabilityFromSupertypes
|
mutabilityFromSupertypes
|
||||||
.select(MutabilityQualifier.MUTABLE, MutabilityQualifier.READ_ONLY, own.mutability, isCovariantPosition)
|
.select(MutabilityQualifier.MUTABLE, MutabilityQualifier.READ_ONLY, own.mutability, isCovariantPosition)
|
||||||
|
|||||||
Reference in New Issue
Block a user