Add test data with current behavior for KT-56656
This commit is contained in:
committed by
Space Team
parent
bcbe26287a
commit
157c260fda
+6
@@ -618,6 +618,12 @@ public class FirPsiOldFrontendForeignAnnotationsCompiledJavaTestGenerated extend
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrideOfMethodWithParametricNullness.kt")
|
||||||
|
public void testOverrideOfMethodWithParametricNullness() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/overrideOfMethodWithParametricNullness.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("typeUseOnObject.kt")
|
@TestMetadata("typeUseOnObject.kt")
|
||||||
public void testTypeUseOnObject() throws Exception {
|
public void testTypeUseOnObject() throws Exception {
|
||||||
|
|||||||
+6
@@ -618,6 +618,12 @@ public class FirPsiOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingT
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrideOfMethodWithParametricNullness.kt")
|
||||||
|
public void testOverrideOfMethodWithParametricNullness() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/overrideOfMethodWithParametricNullness.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("typeUseOnObject.kt")
|
@TestMetadata("typeUseOnObject.kt")
|
||||||
public void testTypeUseOnObject() throws Exception {
|
public void testTypeUseOnObject() throws Exception {
|
||||||
|
|||||||
+6
@@ -618,6 +618,12 @@ public class FirPsiOldFrontendForeignAnnotationsSourceJavaTestGenerated extends
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrideOfMethodWithParametricNullness.kt")
|
||||||
|
public void testOverrideOfMethodWithParametricNullness() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/overrideOfMethodWithParametricNullness.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("typeUseOnObject.kt")
|
@TestMetadata("typeUseOnObject.kt")
|
||||||
public void testTypeUseOnObject() throws Exception {
|
public void testTypeUseOnObject() throws Exception {
|
||||||
|
|||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
// FULL_JDK
|
||||||
|
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||||
|
// ISSUE: KT-56656
|
||||||
|
|
||||||
|
// FILE: ParametricNullness.java
|
||||||
|
import static java.lang.annotation.ElementType.FIELD;
|
||||||
|
import static java.lang.annotation.ElementType.METHOD;
|
||||||
|
import static java.lang.annotation.ElementType.PARAMETER;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
@Target({FIELD, METHOD, PARAMETER})
|
||||||
|
@javax.annotation.meta.TypeQualifierNickname
|
||||||
|
@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN)
|
||||||
|
@interface ParametricNullness {}
|
||||||
|
|
||||||
|
// FILE: ElementTypesAreNonnullByDefault.java
|
||||||
|
import static java.lang.annotation.ElementType.FIELD;
|
||||||
|
import static java.lang.annotation.ElementType.METHOD;
|
||||||
|
import static java.lang.annotation.ElementType.PARAMETER;
|
||||||
|
import static java.lang.annotation.ElementType.TYPE;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.meta.TypeQualifierDefault;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks all "top-level" types as non-null in a way that is recognized by Kotlin. Note that this
|
||||||
|
* unfortunately includes type-variable usages, so we also provide {@link ParametricNullness} to
|
||||||
|
* "undo" it as best we can.
|
||||||
|
*/
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
@Target(TYPE)
|
||||||
|
@TypeQualifierDefault({FIELD, METHOD, PARAMETER})
|
||||||
|
@Nonnull
|
||||||
|
@interface ElementTypesAreNonnullByDefault {}
|
||||||
|
|
||||||
|
// FILE: MyFunction.java
|
||||||
|
import javax.annotation.CheckForNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
@ElementTypesAreNonnullByDefault
|
||||||
|
public interface MyFunction<F extends @Nullable Object, T extends @Nullable Object> extends java.util.function.Function<F, T> {
|
||||||
|
@Override
|
||||||
|
@ParametricNullness
|
||||||
|
T apply (@ParametricNullness F input);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class A<!> : MyFunction<String?, String?> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun apply(x: String?): String? = ""
|
||||||
|
}
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
// FULL_JDK
|
||||||
|
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||||
|
// ISSUE: KT-56656
|
||||||
|
|
||||||
|
// FILE: ParametricNullness.java
|
||||||
|
import static java.lang.annotation.ElementType.FIELD;
|
||||||
|
import static java.lang.annotation.ElementType.METHOD;
|
||||||
|
import static java.lang.annotation.ElementType.PARAMETER;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
@Target({FIELD, METHOD, PARAMETER})
|
||||||
|
@javax.annotation.meta.TypeQualifierNickname
|
||||||
|
@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN)
|
||||||
|
@interface ParametricNullness {}
|
||||||
|
|
||||||
|
// FILE: ElementTypesAreNonnullByDefault.java
|
||||||
|
import static java.lang.annotation.ElementType.FIELD;
|
||||||
|
import static java.lang.annotation.ElementType.METHOD;
|
||||||
|
import static java.lang.annotation.ElementType.PARAMETER;
|
||||||
|
import static java.lang.annotation.ElementType.TYPE;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.meta.TypeQualifierDefault;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks all "top-level" types as non-null in a way that is recognized by Kotlin. Note that this
|
||||||
|
* unfortunately includes type-variable usages, so we also provide {@link ParametricNullness} to
|
||||||
|
* "undo" it as best we can.
|
||||||
|
*/
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
@Target(TYPE)
|
||||||
|
@TypeQualifierDefault({FIELD, METHOD, PARAMETER})
|
||||||
|
@Nonnull
|
||||||
|
@interface ElementTypesAreNonnullByDefault {}
|
||||||
|
|
||||||
|
// FILE: MyFunction.java
|
||||||
|
import javax.annotation.CheckForNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
@ElementTypesAreNonnullByDefault
|
||||||
|
public interface MyFunction<F extends @Nullable Object, T extends @Nullable Object> extends java.util.function.Function<F, T> {
|
||||||
|
@Override
|
||||||
|
@ParametricNullness
|
||||||
|
T apply (@ParametricNullness F input);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class A : MyFunction<String?, String?> {
|
||||||
|
override fun apply(x: String?): String? = ""
|
||||||
|
}
|
||||||
+6
@@ -618,6 +618,12 @@ public class ForeignAnnotationsCompiledJavaTestGenerated extends AbstractForeign
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrideOfMethodWithParametricNullness.kt")
|
||||||
|
public void testOverrideOfMethodWithParametricNullness() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/overrideOfMethodWithParametricNullness.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("typeUseOnObject.kt")
|
@TestMetadata("typeUseOnObject.kt")
|
||||||
public void testTypeUseOnObject() throws Exception {
|
public void testTypeUseOnObject() throws Exception {
|
||||||
|
|||||||
+6
@@ -618,6 +618,12 @@ public class ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated exte
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrideOfMethodWithParametricNullness.kt")
|
||||||
|
public void testOverrideOfMethodWithParametricNullness() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/overrideOfMethodWithParametricNullness.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("typeUseOnObject.kt")
|
@TestMetadata("typeUseOnObject.kt")
|
||||||
public void testTypeUseOnObject() throws Exception {
|
public void testTypeUseOnObject() throws Exception {
|
||||||
|
|||||||
+6
@@ -618,6 +618,12 @@ public class ForeignAnnotationsSourceJavaTestGenerated extends AbstractForeignAn
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/eclipse.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrideOfMethodWithParametricNullness.kt")
|
||||||
|
public void testOverrideOfMethodWithParametricNullness() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/overrideOfMethodWithParametricNullness.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("typeUseOnObject.kt")
|
@TestMetadata("typeUseOnObject.kt")
|
||||||
public void testTypeUseOnObject() throws Exception {
|
public void testTypeUseOnObject() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user