Add test data with current behavior for KT-56656
This commit is contained in:
committed by
Space Team
parent
bcbe26287a
commit
157c260fda
+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? = ""
|
||||
}
|
||||
Reference in New Issue
Block a user