From a2da690afd2e5f7fc748ce498f0c0d627cb9cece Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Mon, 13 Jun 2022 15:36:57 -0700 Subject: [PATCH] Test: add java source files as JavaSourceRoot so that those can be properly populated in SingleJavaRootsIndex --- .../multipleJavaClassesInOneFile.fir.txt | 2 +- .../problems/multipleJavaClassesInOneFile.kt | 2 +- .../sam/samInterfaceTypeParameterErasure.kt | 2 -- .../misc/annotatedTypeArguments.txt | 19 ++++++++++++++ .../misc/methodWithTypeParameter.txt | 12 +++++++++ .../misc/returnTypeDifferentConstructor.txt | 12 +++++++++ .../typeMismatchOnOverrideJavaNullable.txt | 8 ++++++ .../tests/exposed/packagePrivate.txt | 7 +++++ .../manyConstraintsDueToFlexibleRawTypes.txt | 16 ++++++++++++ ...eToRecursiveFlexibleTypesWithWildcards.txt | 16 ++++++++++++ .../tests/j+k/differentFilename.fir.kt | 26 ------------------- .../tests/j+k/differentFilename.kt | 5 ++-- .../tests/j+k/differentFilename.txt | 25 ++++++++++++++++++ ...ecursiveTypeArgumentAndNonRecursive.fir.kt | 4 +-- ...edRecursiveTypeArgumentAndNonRecursive.txt | 14 ++++++++++ ...notherErasedTypeArgumentIfRecursive.fir.kt | 4 +-- ...teAnotherErasedTypeArgumentIfRecursive.txt | 14 ++++++++++ ...substituteAnotherErasedTypeArgument.fir.kt | 4 +-- .../substituteAnotherErasedTypeArgument.txt | 14 ++++++++++ ...stituteOtherErasedDeepTypeArguments.fir.kt | 4 +-- ...substituteOtherErasedDeepTypeArguments.txt | 20 ++++++++++++++ ...alOtherErasedDependentTypeArguments.fir.kt | 4 +-- ...veralOtherErasedDependentTypeArguments.txt | 14 ++++++++++ ...tuteSeveralOtherErasedTypeArguments.fir.kt | 4 +-- ...stituteSeveralOtherErasedTypeArguments.txt | 14 ++++++++++ .../rawTypes/superTypeErasion.txt | 21 +++++++++++++++ .../tests/smartCasts/toInvisible.fir.kt | 2 +- .../samAdapters/GenericClass.fir.kt | 14 ---------- .../samAdapters/GenericClass.kt | 1 + .../samAdapters/GenericClass.txt | 7 +++++ .../samAdapters/GenericMethod.fir.kt | 14 ---------- .../samAdapters/GenericMethod.kt | 1 + .../samAdapters/GenericMethod.txt | 7 +++++ .../GenericMethodInGenericClass.fir.kt | 16 ------------ .../GenericMethodInGenericClass.kt | 1 + .../GenericMethodInGenericClass.txt | 7 +++++ .../JvmEnvironmentConfigurator.kt | 21 ++++++++++++--- 37 files changed, 285 insertions(+), 93 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/j+k/differentFilename.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.fir.kt diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.fir.txt b/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.fir.txt index 96cb1ed653f..1911e36961a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.fir.txt @@ -3,5 +3,5 @@ FILE: main.kt public final fun test(): R|kotlin/Unit| { lval some: R|foo/Some| = R|foo/Some.Some|() - lval another: = #() + lval another: R|foo/Another| = R|foo/Another.Another|() } diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.kt b/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.kt index cf7361f6633..9c82b935241 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.kt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.kt @@ -11,5 +11,5 @@ package foo fun test() { val some = Some() - val another = Another() + val another = Another() } diff --git a/compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt b/compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt index 03bfba052b5..66683b9d6d5 100644 --- a/compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt +++ b/compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt @@ -1,6 +1,4 @@ // TARGET_BACKEND: JVM -// IGNORE_BACKEND_FIR: JVM_IR -// FIR status: ARGUMENT_TYPE_MISMATCH on J.foo { ... } // SAM_CONVERSIONS: CLASS // ^ test checks reflection for synthetic classes // FILE: J.java diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.txt index 9cee33afe67..882188cee79 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.txt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/annotatedTypeArguments.txt @@ -46,3 +46,22 @@ public/*package*/ open class AnnotatedTypeArguments { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } } + +public/*package*/ interface L { + 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 toString(): kotlin.String +} + +public/*package*/ interface P { + 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 toString(): kotlin.String +} + +public/*package*/ interface S { + 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 toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.txt index f4d230d963c..0215f1d2f65 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.txt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/methodWithTypeParameter.txt @@ -43,3 +43,15 @@ public/*package*/ open class Outer { } } +public/*package*/ interface X { + 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 toString(): kotlin.String +} + +public/*package*/ interface Y { + 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 toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.txt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.txt index fcd3a73fa92..18f4b083ad4 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.txt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/returnTypeDifferentConstructor.txt @@ -1,5 +1,17 @@ package +public/*package*/ interface Base { + 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 toString(): kotlin.String +} + +public/*package*/ interface Derived : Base { + 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 toString(): kotlin.String +} + public/*package*/ open class Outer { public/*package*/ constructor Outer() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.txt b/compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.txt index adaafc549b0..000f0d58032 100644 --- a/compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.txt +++ b/compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.txt @@ -36,3 +36,11 @@ public final class D : C { public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } + +@kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER}) @javax.annotation.meta.TypeQualifier /* annotation class not found */ public final annotation class MyTypeQualifier : kotlin.Annotation { + public constructor MyTypeQualifier() + 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 toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/tests/exposed/packagePrivate.txt b/compiler/testData/diagnostics/tests/exposed/packagePrivate.txt index 9a0bc288c88..06f34e55ba4 100644 --- a/compiler/testData/diagnostics/tests/exposed/packagePrivate.txt +++ b/compiler/testData/diagnostics/tests/exposed/packagePrivate.txt @@ -24,6 +24,13 @@ package test { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } + public/*package*/ open class Internal { + public/*package*/ constructor Internal() + 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 toString(): kotlin.String + } + public open class My { public constructor My() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToFlexibleRawTypes.txt b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToFlexibleRawTypes.txt index babfe4e89f8..987b708b422 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToFlexibleRawTypes.txt +++ b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToFlexibleRawTypes.txt @@ -2,6 +2,14 @@ package public fun test(): kotlin.Unit +public/*package*/ abstract class MyComparableSettings : kotlin.Comparable { + public/*package*/ constructor MyComparableSettings() + public abstract override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MyComparableSettings!): kotlin.Int + 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 toString(): kotlin.String +} + public open class MySettings!, /*1*/ PS : MyComparableSettings!, /*2*/ L : MySettingsListener!> { public constructor MySettings!, /*1*/ PS : MyComparableSettings!, /*2*/ L : MySettingsListener!>() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -12,3 +20,11 @@ public open class MySettings!, /*1*/ PS : My // Static members public open fun getSettings(): (MySettings<(raw) *, (raw) MyComparableSettings!, (raw) MySettingsListener!>..MySettings<*, *, out MySettingsListener<*>!>?) } + +public/*package*/ abstract class MySettingsListener { + public/*package*/ constructor MySettingsListener() + 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 toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.txt b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.txt index 6bfec97b38b..0f998b80a0a 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.txt +++ b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.txt @@ -2,6 +2,14 @@ package public fun test(): kotlin.Unit +public/*package*/ abstract class MyComparableSettings : kotlin.Comparable { + public/*package*/ constructor MyComparableSettings() + public abstract override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MyComparableSettings!): kotlin.Int + 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 toString(): kotlin.String +} + public/*package*/ open class MySettings!, /*1*/ PS : MyComparableSettings!, /*2*/ L : MySettingsListener!> { public/*package*/ constructor MySettings!, /*1*/ PS : MyComparableSettings!, /*2*/ L : MySettingsListener!>() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -12,3 +20,11 @@ public/*package*/ open class MySettings!, /* // Static members public open fun getSettings(): MySettings<*, *, *>! } + +public/*package*/ abstract class MySettingsListener { + public/*package*/ constructor MySettingsListener() + 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 toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/tests/j+k/differentFilename.fir.kt b/compiler/testData/diagnostics/tests/j+k/differentFilename.fir.kt deleted file mode 100644 index 9533eb94d34..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/differentFilename.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// SKIP_JAVAC -// FILE: A.java -public class A { - public B b() {} - public F f() {} -} - -class B { public void bar() {} } - -// FILE: C.java -class D { - public void baz() {} -} - -// FILE: E.java -class F { - public void foobaz() {} -} - -// FILE: main.kt -fun main(x: A) { - x.b().bar() - x.f().foobaz() - - D().baz() -} diff --git a/compiler/testData/diagnostics/tests/j+k/differentFilename.kt b/compiler/testData/diagnostics/tests/j+k/differentFilename.kt index 545704650fc..52dceccd0bb 100644 --- a/compiler/testData/diagnostics/tests/j+k/differentFilename.kt +++ b/compiler/testData/diagnostics/tests/j+k/differentFilename.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_JAVAC // FILE: A.java public class A { @@ -20,7 +21,7 @@ class F { // FILE: main.kt fun main(x: A) { x.b().bar() - x.f().foobaz() + x.f().foobaz() - D().baz() + D().baz() } diff --git a/compiler/testData/diagnostics/tests/j+k/differentFilename.txt b/compiler/testData/diagnostics/tests/j+k/differentFilename.txt index 14e3afe774e..25c6fb1a194 100644 --- a/compiler/testData/diagnostics/tests/j+k/differentFilename.txt +++ b/compiler/testData/diagnostics/tests/j+k/differentFilename.txt @@ -10,3 +10,28 @@ public open class A { public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } + +public/*package*/ open class B { + public/*package*/ constructor B() + public open fun bar(): kotlin.Unit + 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 toString(): kotlin.String +} + +public/*package*/ open class D { + public/*package*/ constructor D() + public open fun baz(): kotlin.Unit + 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 toString(): kotlin.String +} + +public/*package*/ open class F { + public/*package*/ constructor F() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foobaz(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.fir.kt index 9a8cc690f49..91b9776e87a 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.fir.kt @@ -20,7 +20,7 @@ interface I {} // FILE: test.kt fun test() { - val t = X.E.t + val t = X.E.t t - t.id // should be OK + t.id // should be OK } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.txt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.txt index ef8ac4d3443..53988cc2ccf 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedRecursiveTypeArgumentAndNonRecursive.txt @@ -2,6 +2,20 @@ package public fun test(): kotlin.Unit +public/*package*/ open class E { + public/*package*/ constructor E() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun getT(): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public/*package*/ interface I { + 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 toString(): kotlin.String +} + public/*package*/ open class X!, /*1*/ P : kotlin.Any!> { public/*package*/ constructor X!, /*1*/ P : kotlin.Any!>() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.fir.kt index e715e30bbc0..62e0f58170f 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.fir.kt @@ -20,7 +20,7 @@ interface I

{} // FILE: test.kt fun test() { - val t = X.E.t + val t = X.E.t t - t.id // should be OK + t.id // should be OK } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.txt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.txt index 537039a51be..0830094d1e3 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/dontSubstituteAnotherErasedTypeArgumentIfRecursive.txt @@ -2,6 +2,20 @@ package public fun test(): kotlin.Unit +public/*package*/ open class E { + public/*package*/ constructor E() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun getT(): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public/*package*/ interface I { + 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 toString(): kotlin.String +} + public/*package*/ open class X!> { public/*package*/ constructor X!>() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.fir.kt index 3464b806316..3932d251a7d 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.fir.kt @@ -20,7 +20,7 @@ interface I

{} // FILE: test.kt fun test() { - val t = X.E.t + val t = X.E.t t - t.id // should be OK + t.id // should be OK } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.txt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.txt index 82b76d2a427..259921c093d 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteAnotherErasedTypeArgument.txt @@ -2,6 +2,20 @@ package public fun test(): kotlin.Unit +public/*package*/ open class E { + public/*package*/ constructor E() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun getT(): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public/*package*/ interface I { + 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 toString(): kotlin.String +} + public/*package*/ open class X!, /*1*/ P : kotlin.Any!> { public/*package*/ constructor X!, /*1*/ P : kotlin.Any!>() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.fir.kt index c66c8f2f510..47eb750733b 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.fir.kt @@ -21,7 +21,7 @@ interface I2 {} // FILE: test.kt fun test() { - val t = X.E.t + val t = X.E.t t - t.id // error before + t.id // error before } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.txt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.txt index 73dc0666326..4a223a23ff5 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteOtherErasedDeepTypeArguments.txt @@ -2,6 +2,26 @@ package public fun test(): kotlin.Unit +public/*package*/ open class E { + public/*package*/ constructor E() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun getT(): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public/*package*/ interface I1 { + 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 toString(): kotlin.String +} + +public/*package*/ interface I2 { + 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 toString(): kotlin.String +} + public/*package*/ open class X!, /*1*/ P : kotlin.Any!, /*2*/ A : I1!, B!, I1!, P!>!>!> { public/*package*/ constructor X!, /*1*/ P : kotlin.Any!, /*2*/ A : I1!, B!, I1!, P!>!>!>() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.fir.kt index 008adec7d6e..6c6539fddb5 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.fir.kt @@ -20,7 +20,7 @@ interface I

{} // FILE: test.kt fun test() { - val t = X.E.t + val t = X.E.t t - t.id // should be OK + t.id // should be OK } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.txt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.txt index 6f6afa643c6..1cc41e9b559 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedDependentTypeArguments.txt @@ -2,6 +2,20 @@ package public fun test(): kotlin.Unit +public/*package*/ open class E { + public/*package*/ constructor E() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun getT(): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public/*package*/ interface I { + 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 toString(): kotlin.String +} + public/*package*/ open class X!, /*1*/ P : kotlin.Any!, /*2*/ A : I!> { public/*package*/ constructor X!, /*1*/ P : kotlin.Any!, /*2*/ A : I!>() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.fir.kt index c7752b207fc..b0f551d8bd6 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.fir.kt @@ -20,7 +20,7 @@ interface I

{} // FILE: test.kt fun test() { - val t = X.E.t + val t = X.E.t t - t.id // should be OK + t.id // should be OK } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.txt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.txt index 10fb27fb8d7..fbfac01630c 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/substituteSeveralOtherErasedTypeArguments.txt @@ -2,6 +2,20 @@ package public fun test(): kotlin.Unit +public/*package*/ open class E { + public/*package*/ constructor E() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun getT(): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public/*package*/ interface I { + 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 toString(): kotlin.String +} + public/*package*/ open class X!, /*1*/ P : kotlin.Any!, /*2*/ A : I!> { public/*package*/ constructor X!, /*1*/ P : kotlin.Any!, /*2*/ A : I!>() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/superTypeErasion.txt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/superTypeErasion.txt index d168eddcef7..9568457371e 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/superTypeErasion.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/superTypeErasion.txt @@ -2,6 +2,27 @@ package public fun main(): kotlin.Unit +public/*package*/ open class Bar { + public/*package*/ constructor Bar() + 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 toString(): kotlin.String +} + +public/*package*/ open class BaseOperation!> { + public/*package*/ constructor BaseOperation!>() + 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 toString(): kotlin.String +} + +public/*package*/ open class Foo { + public/*package*/ constructor Foo() + 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 toString(): kotlin.String +} + public open class Test : BaseOperation<(raw) Bar!, (raw) Foo!> { public constructor Test() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/smartCasts/toInvisible.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/toInvisible.fir.kt index 01e451abd0f..30dba5bc403 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/toInvisible.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/toInvisible.fir.kt @@ -33,7 +33,7 @@ import a.AImpl fun test1(a: A) { if (a is AImpl) { (a as A).b().bar() // OK - a.b().bar() + a.b().bar() } } diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.fir.kt deleted file mode 100644 index 546951d161a..00000000000 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// JAVAC_EXPECTED_FILE -// FILE: KotlinFile.kt -fun foo(javaClass: JavaClass): String { - return javaClass.doSomething("", 1) { s: String -> "" } -} - -// FILE: JavaClass.java -public class JavaClass { - public T doSomething(T t, int anInt, I i) { return t; } -} - -interface I { - T doIt(T t); -} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt index 9240e501a88..20938153731 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JAVAC_EXPECTED_FILE // FILE: KotlinFile.kt fun foo(javaClass: JavaClass): String { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.txt index 6069520c1c4..650254fa329 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.txt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.txt @@ -2,6 +2,13 @@ package public fun foo(/*0*/ javaClass: JavaClass): kotlin.String +public/*package*/ interface I { + public abstract fun doIt(/*0*/ t: T!): T! + 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 toString(): kotlin.String +} + public open class JavaClass { public constructor JavaClass() public open fun doSomething(/*0*/ t: T!, /*1*/ anInt: kotlin.Int, /*2*/ i: I!): T! diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.fir.kt deleted file mode 100644 index df84bf0a53e..00000000000 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// JAVAC_EXPECTED_FILE -// FILE: KotlinFile.kt -fun foo(javaClass: JavaClass): String { - return javaClass.doSomething("") { it } -} - -// FILE: JavaClass.java -public class JavaClass { - public T doSomething(T t, I i) { return i.run(t); } -} - -interface I { - T run(T t); -} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt index ffa5c54f4e0..2787727ea76 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JAVAC_EXPECTED_FILE // FILE: KotlinFile.kt fun foo(javaClass: JavaClass): String { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.txt index b822bf3b527..7de2d3ca74a 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.txt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.txt @@ -2,6 +2,13 @@ package public fun foo(/*0*/ javaClass: JavaClass): kotlin.String +public/*package*/ interface I { + 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 abstract fun run(/*0*/ t: T!): T! + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + public open class JavaClass { public constructor JavaClass() public open fun doSomething(/*0*/ t: T!, /*1*/ i: I!): T! diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.fir.kt deleted file mode 100644 index d0d1f4fcea8..00000000000 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// JAVAC_EXPECTED_FILE -// FILE: KotlinFile.kt -fun foo(javaClass: JavaClass) { - val a: String = javaClass.doSomething1("", 1) { p: String -> p } - val b: String = javaClass.doSomething2("", 1, true) { p: Int -> p } -} - -// FILE: JavaClass.java -public class JavaClass { - public T doSomething1(T t, X x, I i) { return i.run(t); } - public T doSomething2(T t, X x, boolean p, I i) { return i.run(t); } -} - -interface I { - T run(T t); -} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt index 551aeadc9e5..67e3a418bdf 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JAVAC_EXPECTED_FILE // FILE: KotlinFile.kt fun foo(javaClass: JavaClass) { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.txt index 8822d288ac0..a441d61a1b0 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.txt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.txt @@ -2,6 +2,13 @@ package public fun foo(/*0*/ javaClass: JavaClass): kotlin.Unit +public/*package*/ interface I { + 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 abstract fun run(/*0*/ t: T!): T! + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + public open class JavaClass { public constructor JavaClass() public open fun doSomething1(/*0*/ t: T!, /*1*/ x: X!, /*2*/ i: I!): T! diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmEnvironmentConfigurator.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmEnvironmentConfigurator.kt index ab6d950f5ca..e6b342662d9 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmEnvironmentConfigurator.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmEnvironmentConfigurator.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.test.services.configuration +import com.intellij.ide.highlighter.JavaFileType import com.intellij.openapi.util.SystemInfo import com.intellij.psi.PsiJavaModule.MODULE_INFO_FILE import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig @@ -217,17 +218,29 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig val javaSourceFiles = module.javaFiles.filter { INCLUDE_JAVA_AS_BINARY !in it.directives } - if (javaSourceFiles.isNotEmpty() && JvmEnvironmentConfigurationDirectives.SKIP_JAVA_SOURCES !in module.directives && ALL_JAVA_AS_BINARY !in registeredDirectives) { - javaSourceFiles.forEach { testServices.sourceFileProvider.getRealFileForSourceFile(it) } + if (javaSourceFiles.isNotEmpty() && + JvmEnvironmentConfigurationDirectives.SKIP_JAVA_SOURCES !in module.directives && + ALL_JAVA_AS_BINARY !in registeredDirectives + ) { + // NB: [getRealFileForSourceFile] is misleading, since it actually creates a real file from the given test file as well. + val realSourceFileMap = javaSourceFiles.associateWith { testServices.sourceFileProvider.getRealFileForSourceFile(it) } // TODO: temporary hack to provide java 9 modules in the source mode properly (see comment on ClasspathRootsResolved::addModularRoots) addJavaCompiledModulesFromDependentKotlinModules(configuration, configurationKind, module, bySources = true) - val moduleInfoFiles = javaSourceFiles.filter { it.name == MODULE_INFO_FILE } - + val (moduleInfoFiles, sourceFiles) = javaSourceFiles.partition { it.name == MODULE_INFO_FILE } if (moduleInfoFiles.isNotEmpty()) { addJavaSourceRootsByJavaModules(configuration, moduleInfoFiles) } else { + sourceFiles.forEach l@{ testFile -> + val file = realSourceFileMap[testFile] ?: return@l + if (JvmEnvironmentConfigurationDirectives.USE_JAVAC !in module.directives && + !file.isDirectory && + file.extension == JavaFileType.DEFAULT_EXTENSION + ) { + configuration.addJavaSourceRoot(file) + } + } configuration.addJavaSourceRoot(testServices.sourceFileProvider.javaSourceDirectory) } }