diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt index 3e6a7d9b28c..b5b2ae6e4e8 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaSymbolProvider.kt @@ -136,7 +136,7 @@ class JavaSymbolProvider( ) { require(this is FirTypeParameterImpl) for (upperBound in javaTypeParameter.upperBounds) { - bounds += upperBound.toFirResolvedTypeRef(this@JavaSymbolProvider.session, stack) + bounds += upperBound.toFirResolvedTypeRef(this@JavaSymbolProvider.session, stack, isNullable = true) } addDefaultBoundIfNecessary() } diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt index 5f9dd605d15..d0bb5e1e4a8 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt @@ -93,9 +93,9 @@ internal fun JavaType.toFirJavaTypeRef(session: FirSession, javaTypeParameterSta } internal fun JavaClassifierType.toFirResolvedTypeRef( - session: FirSession, javaTypeParameterStack: JavaTypeParameterStack + session: FirSession, javaTypeParameterStack: JavaTypeParameterStack, isNullable: Boolean = false ): FirResolvedTypeRef { - val coneType = this.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable = false) + val coneType = this.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable) return FirResolvedTypeRefImpl( source = null, type = coneType ).apply { diff --git a/compiler/testData/loadJava/compiledJava/ClassWithTypePP.fir.txt b/compiler/testData/loadJava/compiledJava/ClassWithTypePP.fir.txt index ae67ea3b7ef..15ed3657b96 100644 --- a/compiler/testData/loadJava/compiledJava/ClassWithTypePP.fir.txt +++ b/compiler/testData/loadJava/compiledJava/ClassWithTypePP.fir.txt @@ -1,4 +1,4 @@ -public final class ClassWithTypePP : R|kotlin/Any| { - public constructor(): R|test/ClassWithTypePP| +public final class ClassWithTypePP : R|kotlin/Any| { + public constructor(): R|test/ClassWithTypePP| } diff --git a/compiler/testData/loadJava/compiledJava/ClassWithTypePRefNext.fir.txt b/compiler/testData/loadJava/compiledJava/ClassWithTypePRefNext.fir.txt index e36bdb46e5a..fe457de72a8 100644 --- a/compiler/testData/loadJava/compiledJava/ClassWithTypePRefNext.fir.txt +++ b/compiler/testData/loadJava/compiledJava/ClassWithTypePRefNext.fir.txt @@ -1,4 +1,4 @@ -public open class ClassWithTypePRefNext|, P> : R|kotlin/Any| { - public constructor|, P>(): R|test/ClassWithTypePRefNext| +public open class ClassWithTypePRefNext?|, P> : R|kotlin/Any| { + public constructor?|, P>(): R|test/ClassWithTypePRefNext| } diff --git a/compiler/testData/loadJava/compiledJava/ClassWithTypePRefSelf.fir.txt b/compiler/testData/loadJava/compiledJava/ClassWithTypePRefSelf.fir.txt index af1f1138354..7eeb04402d4 100644 --- a/compiler/testData/loadJava/compiledJava/ClassWithTypePRefSelf.fir.txt +++ b/compiler/testData/loadJava/compiledJava/ClassWithTypePRefSelf.fir.txt @@ -1,4 +1,4 @@ -public final class ClassWithTypePRefSelf

|> : R|kotlin/Any| { - public constructor

|>(): R|test/ClassWithTypePRefSelf

| +public final class ClassWithTypePRefSelf

?|> : R|kotlin/Any| { + public constructor

?|>(): R|test/ClassWithTypePRefSelf

| } diff --git a/compiler/testData/loadJava/compiledJava/ClassWithTypePRefSelfAndClass.fir.txt b/compiler/testData/loadJava/compiledJava/ClassWithTypePRefSelfAndClass.fir.txt index 46cb7f3a7d5..9ca97119335 100644 --- a/compiler/testData/loadJava/compiledJava/ClassWithTypePRefSelfAndClass.fir.txt +++ b/compiler/testData/loadJava/compiledJava/ClassWithTypePRefSelfAndClass.fir.txt @@ -1,4 +1,4 @@ -public final class ClassWithTypePRefSelfAndClass

|> : R|kotlin/Any| { - public constructor

|>(): R|test/ClassWithTypePRefSelfAndClass

| +public final class ClassWithTypePRefSelfAndClass

?|> : R|kotlin/Any| { + public constructor

?|>(): R|test/ClassWithTypePRefSelfAndClass

| } diff --git a/compiler/testData/loadJava/compiledJava/MethodTypePOneUpperBound.fir.txt b/compiler/testData/loadJava/compiledJava/MethodTypePOneUpperBound.fir.txt index 2bb1ef113c2..dc5f00f442e 100644 --- a/compiler/testData/loadJava/compiledJava/MethodTypePOneUpperBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/MethodTypePOneUpperBound.fir.txt @@ -1,5 +1,5 @@ public open class MethodTypePOneUpperBound : R|kotlin/Any| { - public open operator fun bar(): R|kotlin/Unit| + public open operator fun bar(): R|kotlin/Unit| public constructor(): R|test/MethodTypePOneUpperBound| diff --git a/compiler/testData/loadJava/compiledJava/MethodTypePTwoUpperBounds.fir.txt b/compiler/testData/loadJava/compiledJava/MethodTypePTwoUpperBounds.fir.txt index 07b0b89ada3..6a47cf7d958 100644 --- a/compiler/testData/loadJava/compiledJava/MethodTypePTwoUpperBounds.fir.txt +++ b/compiler/testData/loadJava/compiledJava/MethodTypePTwoUpperBounds.fir.txt @@ -1,5 +1,5 @@ public open class MethodTypePTwoUpperBounds : R|kotlin/Any| { - public open operator fun foo(): R|kotlin/Unit| + public open operator fun foo(): R|kotlin/Unit| public constructor(): R|test/MethodTypePTwoUpperBounds| diff --git a/compiler/testData/loadJava/compiledJava/MethodWithTypePP.fir.txt b/compiler/testData/loadJava/compiledJava/MethodWithTypePP.fir.txt index 4b0f823d5e1..db2b86e8f08 100644 --- a/compiler/testData/loadJava/compiledJava/MethodWithTypePP.fir.txt +++ b/compiler/testData/loadJava/compiledJava/MethodWithTypePP.fir.txt @@ -1,5 +1,5 @@ public final class MethodWithTypePP : R|kotlin/Any| { - public final operator fun f(): R|kotlin/Unit| + public final operator fun f(): R|kotlin/Unit| public constructor(): R|test/MethodWithTypePP| diff --git a/compiler/testData/loadJava/compiledJava/MethodWithTypePRefClassP.fir.txt b/compiler/testData/loadJava/compiledJava/MethodWithTypePRefClassP.fir.txt index ec77d8fe1c2..a359b727382 100644 --- a/compiler/testData/loadJava/compiledJava/MethodWithTypePRefClassP.fir.txt +++ b/compiler/testData/loadJava/compiledJava/MethodWithTypePRefClassP.fir.txt @@ -1,5 +1,5 @@ public open class MethodWithTypePRefClassP

: R|kotlin/Any| { - public final operator fun f(): R|kotlin/Unit| + public final operator fun f(): R|kotlin/Unit| public constructor

(): R|test/MethodWithTypePRefClassP

| diff --git a/compiler/testData/loadJava/compiledJava/RawUpperBound.fir.txt b/compiler/testData/loadJava/compiledJava/RawUpperBound.fir.txt index 2fa45c790db..17f6b19a2dd 100644 --- a/compiler/testData/loadJava/compiledJava/RawUpperBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/RawUpperBound.fir.txt @@ -1,2 +1,2 @@ -public abstract interface RawUpperBound|> : R|kotlin/Any| { +public abstract interface RawUpperBound?|> : R|kotlin/Any| { } diff --git a/compiler/testData/loadJava/compiledJava/RecursiveRawUpperBound.fir.txt b/compiler/testData/loadJava/compiledJava/RecursiveRawUpperBound.fir.txt index e2cffc65849..84d2145318e 100644 --- a/compiler/testData/loadJava/compiledJava/RecursiveRawUpperBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/RecursiveRawUpperBound.fir.txt @@ -1,2 +1,2 @@ -public abstract interface RecursiveRawUpperBound|> : R|kotlin/Any| { +public abstract interface RecursiveRawUpperBound?|> : R|kotlin/Any| { } diff --git a/compiler/testData/loadJava/compiledJava/RecursiveWildcardUpperBound.fir.txt b/compiler/testData/loadJava/compiledJava/RecursiveWildcardUpperBound.fir.txt index 6e3d3b70fe1..ea2b10bbe08 100644 --- a/compiler/testData/loadJava/compiledJava/RecursiveWildcardUpperBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/RecursiveWildcardUpperBound.fir.txt @@ -1,2 +1,2 @@ -public abstract interface RecursiveWildcardUpperBound|> : R|kotlin/Any| { +public abstract interface RecursiveWildcardUpperBound?|> : R|kotlin/Any| { } diff --git a/compiler/testData/loadJava/compiledJava/constructor/ConstructorGenericUpperBound.fir.txt b/compiler/testData/loadJava/compiledJava/constructor/ConstructorGenericUpperBound.fir.txt index f8ffe9294a1..41a6147a0c6 100644 --- a/compiler/testData/loadJava/compiledJava/constructor/ConstructorGenericUpperBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/constructor/ConstructorGenericUpperBound.fir.txt @@ -1,4 +1,4 @@ public open class ConstructorGenericUpperBound : R|kotlin/Any| { - public constructor

(p: R|ft!|): R|test/ConstructorGenericUpperBound| + public constructor

(p: R|ft!|): R|test/ConstructorGenericUpperBound| } diff --git a/compiler/testData/loadJava/compiledJava/kotlinSignature/AllBoundsInWhen.fir.txt b/compiler/testData/loadJava/compiledJava/kotlinSignature/AllBoundsInWhen.fir.txt index 9b0bcf905f5..02ed41f8f28 100644 --- a/compiler/testData/loadJava/compiledJava/kotlinSignature/AllBoundsInWhen.fir.txt +++ b/compiler/testData/loadJava/compiledJava/kotlinSignature/AllBoundsInWhen.fir.txt @@ -1,5 +1,5 @@ public open class AllBoundsInWhen : R|kotlin/Any| { - public open operator fun foo(): R|kotlin/Unit| + public open operator fun foo(): R|kotlin/Unit| public constructor(): R|test/AllBoundsInWhen| diff --git a/compiler/testData/loadJava/compiledJava/kotlinSignature/MethodWithTypeParameters.fir.txt b/compiler/testData/loadJava/compiledJava/kotlinSignature/MethodWithTypeParameters.fir.txt index be91524e238..5b03c145dfc 100644 --- a/compiler/testData/loadJava/compiledJava/kotlinSignature/MethodWithTypeParameters.fir.txt +++ b/compiler/testData/loadJava/compiledJava/kotlinSignature/MethodWithTypeParameters.fir.txt @@ -1,5 +1,5 @@ public open class MethodWithTypeParameters : R|kotlin/Any| { - public open operator fun |> foo(a: R|ft!|, b: R|ft, kotlin/collections/List?>!|, list: R|ft, kotlin/collections/List?>!|): R|kotlin/Unit| + public open operator fun ?|> foo(a: R|ft!|, b: R|ft, kotlin/collections/List?>!|, list: R|ft, kotlin/collections/List?>!|): R|kotlin/Unit| public constructor(): R|test/MethodWithTypeParameters| diff --git a/compiler/testData/loadJava/compiledJava/kotlinSignature/error/WrongTypeParameterBoundStructure1.fir.txt b/compiler/testData/loadJava/compiledJava/kotlinSignature/error/WrongTypeParameterBoundStructure1.fir.txt index f0e900e28ad..80f11a712dc 100644 --- a/compiler/testData/loadJava/compiledJava/kotlinSignature/error/WrongTypeParameterBoundStructure1.fir.txt +++ b/compiler/testData/loadJava/compiledJava/kotlinSignature/error/WrongTypeParameterBoundStructure1.fir.txt @@ -1,5 +1,5 @@ public open class WrongTypeParameterBoundStructure1 : R|kotlin/Any| { - public open operator fun |> foo(a: R|ft!|, b: R|ft, kotlin/collections/List?>!|): R|kotlin/Unit| + public open operator fun ?|> foo(a: R|ft!|, b: R|ft, kotlin/collections/List?>!|): R|kotlin/Unit| public constructor(): R|test/WrongTypeParameterBoundStructure1| diff --git a/compiler/testData/loadJava/compiledJava/library/Max.fir.txt b/compiler/testData/loadJava/compiledJava/library/Max.fir.txt index 02b6a65ac46..bfb618ba7d0 100644 --- a/compiler/testData/loadJava/compiledJava/library/Max.fir.txt +++ b/compiler/testData/loadJava/compiledJava/library/Max.fir.txt @@ -1,5 +1,5 @@ public open class Max : R|kotlin/Any| { - public open operator fun |> max(coll: R|ft, kotlin/collections/Collection?>!|): R|ft!| + public open operator fun ?|> max(coll: R|ft, kotlin/collections/Collection?>!|): R|ft!| public constructor(): R|test/Max| diff --git a/compiler/testData/loadJava/compiledJava/sam/GenericInterfaceParameterWithSelfBound.fir.txt b/compiler/testData/loadJava/compiledJava/sam/GenericInterfaceParameterWithSelfBound.fir.txt index eedcc50a97c..b968aaad7d0 100644 --- a/compiler/testData/loadJava/compiledJava/sam/GenericInterfaceParameterWithSelfBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/sam/GenericInterfaceParameterWithSelfBound.fir.txt @@ -1,4 +1,4 @@ -public abstract interface GenericInterfaceParameterWithSelfBound|> : R|kotlin/Any| { +public abstract interface GenericInterfaceParameterWithSelfBound?|> : R|kotlin/Any| { public abstract operator fun method(t: R|ft!|): R|ft!| } diff --git a/compiler/testData/loadJava/compiledJava/sam/GenericInterfaceParametersWithBounds.fir.txt b/compiler/testData/loadJava/compiledJava/sam/GenericInterfaceParametersWithBounds.fir.txt index 38c3e289862..94133370a78 100644 --- a/compiler/testData/loadJava/compiledJava/sam/GenericInterfaceParametersWithBounds.fir.txt +++ b/compiler/testData/loadJava/compiledJava/sam/GenericInterfaceParametersWithBounds.fir.txt @@ -1,4 +1,4 @@ -public abstract interface GenericInterfaceParametersWithBounds|, R|kotlin/Cloneable|, B : R|kotlin/collections/MutableList|> : R|kotlin/Any| { +public abstract interface GenericInterfaceParametersWithBounds?|, R|kotlin/Cloneable?|, B : R|kotlin/collections/MutableList?|> : R|kotlin/Any| { public abstract operator fun method(a: R|kotlin/Array!>|, b: R|ft!|): R|kotlin/Unit| } diff --git a/compiler/testData/loadJava/compiledJava/sam/GenericMethodParameters.fir.txt b/compiler/testData/loadJava/compiledJava/sam/GenericMethodParameters.fir.txt index 6b48ed17ac1..8720bdb3319 100644 --- a/compiler/testData/loadJava/compiledJava/sam/GenericMethodParameters.fir.txt +++ b/compiler/testData/loadJava/compiledJava/sam/GenericMethodParameters.fir.txt @@ -1,4 +1,4 @@ public abstract interface GenericMethodParameters : R|kotlin/Any| { - public abstract operator fun |> method(a: R|kotlin/Array!>|, b: R|ft!|): R|kotlin/Unit| + public abstract operator fun ?|> method(a: R|kotlin/Array!>|, b: R|ft!|): R|kotlin/Unit| } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfMethod.fir.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfMethod.fir.txt index 176829206fc..c1fdc383d79 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfMethod.fir.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfMethod.fir.txt @@ -1,9 +1,9 @@ public open class TypeParameterOfMethod : R|kotlin/Any| { public open static operator fun max(comparator: R|ft!>, java/util/Comparator!>?>!|, value1: R|ft!|, value2: R|ft!|): R|ft!| - public open static operator fun max2(comparator: R|ft!>, java/util/Comparator!>?>!|, value1: R|ft!|, value2: R|ft!|): R|ft!| + public open static operator fun max2(comparator: R|ft!>, java/util/Comparator!>?>!|, value1: R|ft!|, value2: R|ft!|): R|ft!| - public open static operator fun |> method(a: R|ft!>, java/util/Comparator!>?>!|, b: R|ft!|): R|kotlin/Unit| + public open static operator fun ?|> method(a: R|ft!>, java/util/Comparator!>?>!|, b: R|ft!|): R|kotlin/Unit| public constructor(): R|test/TypeParameterOfMethod|