Move and fix tests on typeEnhancement with TYPE_USE annotations
This commit is contained in:
+39
@@ -46,4 +46,43 @@ public class ForeignJava8AnnotationsTestGenerated extends AbstractForeignJava8An
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/eclipse.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TypeEnhancement extends AbstractForeignJava8AnnotationsTest {
|
||||
public void testAllFilesPresentInTypeEnhancement() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotatedTypeArguments.kt")
|
||||
public void testAnnotatedTypeArguments() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/annotatedTypeArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("methodWithTypeParameter.kt")
|
||||
public void testMethodWithTypeParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/methodWithTypeParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("returnTypeDifferentConstructor.kt")
|
||||
public void testReturnTypeDifferentConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeDifferentConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("returnTypeOverrideInKotlin.kt")
|
||||
public void testReturnTypeOverrideInKotlin() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/returnTypeOverrideInKotlin.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
// FILE: AnnotatedTypeArguments.java
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.checkerframework.checker.nullness.qual.*;
|
||||
|
||||
interface P<X, Y> {}
|
||||
interface L<T> {}
|
||||
@@ -16,7 +16,7 @@ class AnnotatedTypeArguments {
|
||||
// some complicated type tree
|
||||
// return type and argument's type differ only by nullability of outermost type
|
||||
@Nullable
|
||||
L<P<@NotNull L<@Nullable String>, @NotNull S<?>>> foo(@NotNull L<P<@NotNull L<@Nullable String>, @NotNull S<?>>> x) {return null;}
|
||||
L<P<@NonNull L<@Nullable String>, @NonNull S<?>>> foo(@NonNull L<P<@NonNull L<@Nullable String>, @NonNull S<?>>> x) {return null;}
|
||||
}
|
||||
|
||||
class C extends B {
|
||||
@@ -26,13 +26,13 @@ class AnnotatedTypeArguments {
|
||||
|
||||
class D1 extends C {
|
||||
// signature should be the same as in A, but annotated String-type should be platform
|
||||
L<P<L<@NotNull String>, S<?>>> foo(L<P<L<@NotNull String>, S<?>>> x) {return null;}
|
||||
L<P<L<@NonNull String>, S<?>>> foo(L<P<L<@NonNull String>, S<?>>> x) {return null;}
|
||||
}
|
||||
|
||||
class D2 extends C {
|
||||
// return type refined to not-nullable
|
||||
// argument type here same as in A except outermost type (it becomes flexible because of conflict)
|
||||
@NotNull
|
||||
@NonNull
|
||||
L<P<L<String>, S<?>>> foo(@Nullable L<P<L<String>, S<?>>> x) {return null;}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -17,7 +17,7 @@ public/*package*/ open class AnnotatedTypeArguments {
|
||||
public/*package*/ open inner class B : AnnotatedTypeArguments.A {
|
||||
public/*package*/ constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@org.jetbrains.annotations.Nullable() public/*package*/ open override /*1*/ fun foo(/*0*/ @org.jetbrains.annotations.NotNull() x: L<P<L<kotlin.String?>, S<*>>!>): L<P<L<kotlin.String?>, S<*>>!>?
|
||||
@org.checkerframework.checker.nullness.qual.Nullable() public/*package*/ open override /*1*/ fun foo(/*0*/ @org.checkerframework.checker.nullness.qual.NonNull() x: L<P<L<kotlin.String?>, S<*>>!>): L<P<L<kotlin.String?>, S<*>>!>?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public/*package*/ open class AnnotatedTypeArguments {
|
||||
public/*package*/ open inner class D2 : AnnotatedTypeArguments.C {
|
||||
public/*package*/ constructor D2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@org.jetbrains.annotations.NotNull() public/*package*/ open override /*1*/ fun foo(/*0*/ @org.jetbrains.annotations.Nullable() x: L<P<L<kotlin.String?>, S<*>>!>!): L<P<L<kotlin.String?>, S<*>>!>
|
||||
@org.checkerframework.checker.nullness.qual.NonNull() public/*package*/ open override /*1*/ fun foo(/*0*/ @org.checkerframework.checker.nullness.qual.Nullable() x: L<P<L<kotlin.String?>, S<*>>!>!): L<P<L<kotlin.String?>, S<*>>!>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
// FILE: Outer.java
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.checkerframework.checker.nullness.qual.*;
|
||||
|
||||
interface X<T> {}
|
||||
interface Y<T> {}
|
||||
@@ -15,7 +15,7 @@ class Outer {
|
||||
class B extends A {
|
||||
// OK, non-platform types
|
||||
@Override
|
||||
<T1, T2> @NotNull T2 foo(@Nullable T1 x) { return null; }
|
||||
<T1, T2> @NonNull T2 foo(@Nullable T1 x) { return null; }
|
||||
|
||||
// Parameter type is fully non-flexible (OK)
|
||||
// Return type is `X<R!>?`.
|
||||
@@ -23,7 +23,7 @@ class Outer {
|
||||
// so type enhancing happens only for outermost type.
|
||||
// TODO: We should properly compare equality with specific local equality axioms (as when calculating overriden descriptors)
|
||||
@Override
|
||||
<R> @Nullable X<@Nullable R> bar(@NotNull Y<@NotNull R> x) { return null; }
|
||||
<R> @Nullable X<@Nullable R> bar(@NonNull Y<@NonNull R> x) { return null; }
|
||||
}
|
||||
|
||||
class C extends B {
|
||||
@@ -41,11 +41,11 @@ class Outer {
|
||||
// Return type is not-nullable, covariantly overridden, OK
|
||||
// Parameter type is flexible, because of conflict with supertype, OK
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNull
|
||||
<U, W> W foo(@Nullable U x) { return null; }
|
||||
|
||||
|
||||
@Override
|
||||
<F> @NotNull X<@NotNull F> bar(@Nullable Y<@Nullable F> x) { return null; }
|
||||
<F> @NonNull X<@NonNull F> bar(@Nullable Y<@Nullable F> x) { return null; }
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -17,9 +17,9 @@ public/*package*/ open class Outer {
|
||||
|
||||
public/*package*/ open inner class B : Outer.A {
|
||||
public/*package*/ constructor B()
|
||||
@java.lang.Override() public/*package*/ open override /*1*/ fun </*0*/ R : kotlin.Any!> bar(/*0*/ @org.jetbrains.annotations.NotNull() x: Y<R>): X<R!>?
|
||||
@java.lang.Override() public/*package*/ open override /*1*/ fun </*0*/ R : kotlin.Any!> bar(/*0*/ @org.checkerframework.checker.nullness.qual.NonNull() x: Y<R>): X<R!>?
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@java.lang.Override() public/*package*/ open override /*1*/ fun </*0*/ T1 : kotlin.Any!, /*1*/ T2 : kotlin.Any!> foo(/*0*/ @org.jetbrains.annotations.Nullable() x: T1?): T2
|
||||
@java.lang.Override() public/*package*/ open override /*1*/ fun </*0*/ T1 : kotlin.Any!, /*1*/ T2 : kotlin.Any!> foo(/*0*/ @org.checkerframework.checker.nullness.qual.Nullable() x: T1?): T2
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -35,9 +35,9 @@ public/*package*/ open class Outer {
|
||||
|
||||
public/*package*/ open inner class D : Outer.C {
|
||||
public/*package*/ constructor D()
|
||||
@java.lang.Override() public/*package*/ open override /*1*/ fun </*0*/ F : kotlin.Any!> bar(/*0*/ @org.jetbrains.annotations.Nullable() x: Y<F!>!): X<F!>
|
||||
@java.lang.Override() public/*package*/ open override /*1*/ fun </*0*/ F : kotlin.Any!> bar(/*0*/ @org.checkerframework.checker.nullness.qual.Nullable() x: Y<F!>!): X<F!>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@java.lang.Override() @org.jetbrains.annotations.NotNull() public/*package*/ open override /*1*/ fun </*0*/ U : kotlin.Any!, /*1*/ W : kotlin.Any!> foo(/*0*/ @org.jetbrains.annotations.Nullable() x: U?): W
|
||||
@java.lang.Override() @org.checkerframework.checker.nullness.qual.NonNull() public/*package*/ open override /*1*/ fun </*0*/ U : kotlin.Any!, /*1*/ W : kotlin.Any!> foo(/*0*/ @org.checkerframework.checker.nullness.qual.Nullable() x: U?): W
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+5
-5
@@ -1,13 +1,13 @@
|
||||
// FILE: Outer.java
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.checkerframework.checker.nullness.qual.*;
|
||||
|
||||
interface Base<T> {}
|
||||
interface Derived<E> extends Base<E> {}
|
||||
|
||||
class Outer {
|
||||
class A {
|
||||
@Nullable Base<@NotNull String> foo() { return null; }
|
||||
@Nullable Base<@NonNull String> foo() { return null; }
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
@@ -17,7 +17,7 @@ class Outer {
|
||||
|
||||
class C extends A {
|
||||
@Override
|
||||
@NotNull Base<String> foo() {}
|
||||
@NonNull Base<String> foo() {}
|
||||
}
|
||||
|
||||
class D extends A {
|
||||
@@ -27,11 +27,11 @@ class Outer {
|
||||
|
||||
class E extends A {
|
||||
@Override
|
||||
@NotNull Derived<String> foo() {}
|
||||
@NonNull Derived<String> foo() {}
|
||||
}
|
||||
|
||||
class F extends A {
|
||||
@Override
|
||||
@NotNull Derived<@NotNull String> foo() {}
|
||||
@NonNull Derived<@NonNull String> foo() {}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -9,7 +9,7 @@ public/*package*/ open class Outer {
|
||||
public/*package*/ open inner class A {
|
||||
public/*package*/ constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@org.jetbrains.annotations.Nullable() public/*package*/ open fun foo(): Base<kotlin.String>?
|
||||
@org.checkerframework.checker.nullness.qual.Nullable() public/*package*/ open fun foo(): Base<kotlin.String>?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public/*package*/ open class Outer {
|
||||
public/*package*/ open inner class C : Outer.A {
|
||||
public/*package*/ constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@java.lang.Override() @org.jetbrains.annotations.NotNull() public/*package*/ open override /*1*/ fun foo(): Base<kotlin.String>
|
||||
@java.lang.Override() @org.checkerframework.checker.nullness.qual.NonNull() public/*package*/ open override /*1*/ fun foo(): Base<kotlin.String>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public/*package*/ open class Outer {
|
||||
public/*package*/ open inner class E : Outer.A {
|
||||
public/*package*/ constructor E()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@java.lang.Override() @org.jetbrains.annotations.NotNull() public/*package*/ open override /*1*/ fun foo(): Derived<kotlin.String!>
|
||||
@java.lang.Override() @org.checkerframework.checker.nullness.qual.NonNull() public/*package*/ open override /*1*/ fun foo(): Derived<kotlin.String!>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public/*package*/ open class Outer {
|
||||
public/*package*/ open inner class F : Outer.A {
|
||||
public/*package*/ constructor F()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@java.lang.Override() @org.jetbrains.annotations.NotNull() public/*package*/ open override /*1*/ fun foo(): Derived<kotlin.String!>
|
||||
@java.lang.Override() @org.checkerframework.checker.nullness.qual.NonNull() public/*package*/ open override /*1*/ fun foo(): Derived<kotlin.String!>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// FILE: A.java
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.checkerframework.checker.nullness.qual.*
|
||||
|
||||
public class A {
|
||||
@Nullable Base<@NotNull String> foo() { return null; }
|
||||
@Nullable Base<@NonNull String> foo() { return null; }
|
||||
}
|
||||
|
||||
// FILE: a.kt
|
||||
+1
-1
@@ -6,7 +6,7 @@ public fun bar2(): Derived<kotlin.String?>
|
||||
public open class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@org.jetbrains.annotations.Nullable() public/*package*/ open fun foo(): Base<kotlin.String>?
|
||||
@org.checkerframework.checker.nullness.qual.Nullable() public/*package*/ open fun foo(): Base<kotlin.String>?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// FILE: A.java
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.*;
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
List<@NonNull String> foo() {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package
|
||||
|
||||
public/*package*/ open class A {
|
||||
public/*package*/ constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public/*package*/ open fun foo(): kotlin.collections.(Mutable)List<kotlin.String>!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.checkers
|
||||
import org.jetbrains.kotlin.test.MockLibraryUtil
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractForeignAnnotationsTest : AbstractDiagnosticsTest() {
|
||||
abstract class AbstractForeignAnnotationsTest : AbstractDiagnosticsWithFullJdkTest() {
|
||||
override fun getExtraClasspath(): List<File> {
|
||||
return listOf(MockLibraryUtil.compileLibraryToJar(
|
||||
annotationsPath,
|
||||
|
||||
@@ -13028,36 +13028,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/platformTypes/typeEnhancement"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotatedTypeArguments.kt")
|
||||
public void testAnnotatedTypeArguments() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/annotatedTypeArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("methodWithTypeParameter.kt")
|
||||
public void testMethodWithTypeParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/methodWithTypeParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overriddenExtensions.kt")
|
||||
public void testOverriddenExtensions() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/overriddenExtensions.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("returnTypeDifferentConstructor.kt")
|
||||
public void testReturnTypeDifferentConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/returnTypeDifferentConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("returnTypeOverrideInKotlin.kt")
|
||||
public void testReturnTypeOverrideInKotlin() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/returnTypeOverrideInKotlin.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("saveAnnotationAfterSubstitution.kt")
|
||||
public void testSaveAnnotationAfterSubstitution() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/saveAnnotationAfterSubstitution.kt");
|
||||
|
||||
Reference in New Issue
Block a user