diff --git a/compiler/testData/loadJava/compiledJava/PrivateMembers.txt b/compiler/testData/loadJava/compiledJava/PrivateMembers.txt index 93350ea65b4..2b006cb7ab3 100644 --- a/compiler/testData/loadJava/compiledJava/PrivateMembers.txt +++ b/compiler/testData/loadJava/compiledJava/PrivateMembers.txt @@ -4,7 +4,7 @@ public open class PrivateMembers { private constructor PrivateMembers() private final var field: kotlin.Int private open fun method(): kotlin.Unit - private final /*synthesized*/ fun samAdapter(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit + private final /*synthesized*/ fun samAdapter(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit private open fun samAdapter(/*0*/ p0: test.PrivateMembers.SamInterface!): kotlin.Unit private open inner class Inner { diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/AmbiguousAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/AmbiguousAdapters.txt index 3d69c69d4ab..67cd27aa493 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/AmbiguousAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/AmbiguousAdapters.txt @@ -2,8 +2,8 @@ package test public open class AmbiguousAdapters { public constructor AmbiguousAdapters() - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit public open fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/Basic.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/Basic.txt index 1b625560c37..9efc9eb02fd 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/Basic.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/Basic.txt @@ -2,10 +2,10 @@ package test public open class Basic { public constructor Basic() - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit // Static members - public /*synthesized*/ fun bar(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit + public /*synthesized*/ fun bar(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit public open fun bar(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/Constructor.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/Constructor.txt index feb9f32a186..f85e89a2c92 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/Constructor.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/Constructor.txt @@ -1,6 +1,6 @@ package test public open class Constructor { - public /*synthesized*/ constructor Constructor(/*0*/ p0: (() -> kotlin.Unit)?) + public /*synthesized*/ constructor Constructor(/*0*/ p0: (() -> kotlin.Unit)!) public constructor Constructor(/*0*/ p0: java.lang.Runnable!) } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/DeepSamLoop.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/DeepSamLoop.txt index 54d28bed348..486644c6f33 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/DeepSamLoop.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/DeepSamLoop.txt @@ -3,16 +3,16 @@ package test public trait DeepSamLoop { public trait Bar { - public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Bar?) -> kotlin.Unit)?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Bar!) -> kotlin.Unit)!): kotlin.Unit public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Foo!): kotlin.Unit } public trait Foo { - public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Foo?) -> kotlin.Unit)?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Foo!) -> kotlin.Unit)!): kotlin.Unit public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Bar!): kotlin.Unit } // Static members - public final /*synthesized*/ fun Bar(/*0*/ function: (test.DeepSamLoop.Foo?) -> kotlin.Unit): test.DeepSamLoop.Bar - public final /*synthesized*/ fun Foo(/*0*/ function: (test.DeepSamLoop.Bar?) -> kotlin.Unit): test.DeepSamLoop.Foo + public /*synthesized*/ fun Bar(/*0*/ function: (test.DeepSamLoop.Foo!) -> kotlin.Unit): test.DeepSamLoop.Bar + public /*synthesized*/ fun Foo(/*0*/ function: (test.DeepSamLoop.Bar!) -> kotlin.Unit): test.DeepSamLoop.Foo } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/NonTrivialFunctionType.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/NonTrivialFunctionType.txt index 33efd145f30..e8338dfd6b2 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/NonTrivialFunctionType.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/NonTrivialFunctionType.txt @@ -2,11 +2,11 @@ package test public open class NonTrivialFunctionType { public constructor NonTrivialFunctionType() - public final /*synthesized*/ fun foo(/*0*/ p0: ((java.io.File, kotlin.String) -> kotlin.Boolean)?): kotlin.Unit - public final /*synthesized*/ fun foo(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: ((java.io.File!, kotlin.String!) -> kotlin.Boolean)!): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: ((kotlin.String!, kotlin.String!) -> kotlin.Int)!): kotlin.Unit public open fun foo(/*0*/ p0: java.io.FilenameFilter!): kotlin.Unit public open fun foo(/*0*/ p0: java.util.Comparator!): kotlin.Unit - public final /*synthesized*/ fun wildcardBound(/*0*/ p0: ((kotlin.CharSequence?, kotlin.CharSequence?) -> kotlin.Int)?): kotlin.Unit + public final /*synthesized*/ fun wildcardBound(/*0*/ p0: ((kotlin.CharSequence!, kotlin.CharSequence!) -> kotlin.Int)!): kotlin.Unit public open fun wildcardBound(/*0*/ p0: java.util.Comparator!): kotlin.Unit public open fun wildcardUnbound(/*0*/ p0: java.util.Comparator!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/AdapterDoesntOverrideDeclaration.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/AdapterDoesntOverrideDeclaration.txt index 8f020ab7ded..f76631190fd 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/AdapterDoesntOverrideDeclaration.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/AdapterDoesntOverrideDeclaration.txt @@ -3,15 +3,15 @@ package test public trait AdapterDoesntOverrideDeclaration { public trait Sub : test.AdapterDoesntOverrideDeclaration.Super { - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public trait Super { - public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit + public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit } // Static members - public final /*synthesized*/ fun Super(/*0*/ function: ((() -> kotlin.Unit)?) -> kotlin.Unit): test.AdapterDoesntOverrideDeclaration.Super + public /*synthesized*/ fun Super(/*0*/ function: ((() -> kotlin.Unit!)!) -> kotlin.Unit): test.AdapterDoesntOverrideDeclaration.Super } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAdapterAndDeclaration.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAdapterAndDeclaration.txt index c0cbf63458a..d41e90271e4 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAdapterAndDeclaration.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAdapterAndDeclaration.txt @@ -3,14 +3,14 @@ package test public trait InheritedAdapterAndDeclaration { public trait Sub : test.InheritedAdapterAndDeclaration.Super { - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public trait Super { - public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAmbiguousAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAmbiguousAdapters.txt index 7970c379294..85b21f7a92c 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAmbiguousAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAmbiguousAdapters.txt @@ -3,16 +3,16 @@ package test public trait InheritedAmbiguousAdapters { public trait Sub : test.InheritedAmbiguousAdapters.Super { - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public trait Super { - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAndOverriddenAmbiguousAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAndOverriddenAmbiguousAdapters.txt index d1126be6ee6..d26fcd92cfc 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAndOverriddenAmbiguousAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAndOverriddenAmbiguousAdapters.txt @@ -3,16 +3,16 @@ package test public trait InheritedAndOverriddenAmbiguousAdapters { public trait Sub : test.InheritedAndOverriddenAmbiguousAdapters.Super { - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit - public abstract override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit + public abstract override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public trait Super { - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverridden.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverridden.txt index d2279264b80..56df91abef0 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverridden.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverridden.txt @@ -4,13 +4,13 @@ public trait InheritedOverridden { public open class Sub : test.InheritedOverridden.Super { public constructor Sub() - public final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public open override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public open override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public open class Super { public constructor Super() - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public open fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverriddenAdapter.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverriddenAdapter.txt index 5f0950d43b6..42b12e26641 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverriddenAdapter.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverriddenAdapter.txt @@ -4,13 +4,13 @@ public trait InheritedOverriddenAdapter { public open class Sub : test.InheritedOverriddenAdapter.Super { public constructor Sub() - public open override /*1*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public open override /*1*/ fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public open class Super { public constructor Super() - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public open fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdapters.txt index 978fc13d436..655dcb3b2f3 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdapters.txt @@ -3,22 +3,22 @@ package test public trait InheritedSameAdapters { public trait Sub : test.InheritedSameAdapters.Super1, test.InheritedSameAdapters.Super2 { - public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public trait Super1 { - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public trait Super2 { - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } // Static members - public final /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Sub - public final /*synthesized*/ fun Super1(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Super1 - public final /*synthesized*/ fun Super2(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Super2 + public /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable!) -> kotlin.Unit): test.InheritedSameAdapters.Sub + public /*synthesized*/ fun Super1(/*0*/ function: (java.lang.Runnable!) -> kotlin.Unit): test.InheritedSameAdapters.Super1 + public /*synthesized*/ fun Super2(/*0*/ function: (java.lang.Runnable!) -> kotlin.Unit): test.InheritedSameAdapters.Super2 } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSimple.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSimple.txt index cf43fe3ad8e..c7111364b59 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSimple.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSimple.txt @@ -3,12 +3,12 @@ package test public trait InheritedSimple { public trait Sub : test.InheritedSimple.Super { - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public trait Super { - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/OverriddenAmbiguousAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/OverriddenAmbiguousAdapters.txt index 6af72f2b45e..153434ee896 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/OverriddenAmbiguousAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/OverriddenAmbiguousAdapters.txt @@ -3,15 +3,15 @@ package test public trait OverriddenAmbiguousAdapters { public trait Sub : test.OverriddenAmbiguousAdapters.Super { - public abstract override /*2*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public abstract override /*2*/ fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public trait Super { - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit - public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit + public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } } diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/sam/SingleAbstractMethodUtils.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/sam/SingleAbstractMethodUtils.java index 5d040ed2fa9..b4de0b638f0 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/sam/SingleAbstractMethodUtils.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/sam/SingleAbstractMethodUtils.java @@ -22,6 +22,7 @@ import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.annotations.Annotations; import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl; import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl; +import org.jetbrains.jet.lang.resolve.java.JavaPackage; import org.jetbrains.jet.lang.resolve.java.descriptor.*; import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils; import org.jetbrains.jet.lang.resolve.java.structure.*; @@ -82,7 +83,7 @@ public class SingleAbstractMethodUtils { } @Nullable - private static JetType getFunctionTypeForSamType(@NotNull JetType samType) { + private static JetType getFunctionTypeForSamType(@NotNull JetType samType, boolean isSamConstructor) { // e.g. samType == Comparator? ClassifierDescriptor classifier = samType.getConstructor().getDeclarationDescriptor(); @@ -94,7 +95,16 @@ public class SingleAbstractMethodUtils { // Function2? JetType substitute = TypeSubstitutor.create(samType).substitute(functionTypeDefault, Variance.INVARIANT); - return substitute == null ? null : fixProjections(TypeUtils.makeNullableAsSpecified(substitute, samType.isNullable())); + if (substitute == null) return null; + + JetType fixedProjections = fixProjections(substitute); + if (fixedProjections == null) return null; + + if (JavaPackage.getPLATFORM_TYPES() && !isSamConstructor) { + return new DelegatingFlexibleType(fixedProjections, TypeUtils.makeNullable(fixedProjections)); + } + + return TypeUtils.makeNullableAsSpecified(fixedProjections, !isSamConstructor && samType.isNullable()); } } return null; @@ -139,7 +149,7 @@ public class SingleAbstractMethodUtils { TypeParameters typeParameters = recreateAndInitializeTypeParameters(samInterface.getTypeConstructor().getParameters(), result); - JetType parameterTypeUnsubstituted = getFunctionTypeForSamType(samInterface.getDefaultType()); + JetType parameterTypeUnsubstituted = getFunctionTypeForSamType(samInterface.getDefaultType(), true); assert parameterTypeUnsubstituted != null : "couldn't get function type for SAM type " + samInterface.getDefaultType(); JetType parameterType = typeParameters.substitutor.substitute(parameterTypeUnsubstituted, Variance.IN_VARIANCE); assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted + @@ -165,7 +175,7 @@ public class SingleAbstractMethodUtils { } public static boolean isSamType(@NotNull JetType type) { - return getFunctionTypeForSamType(type) != null; + return getFunctionTypeForSamType(type, /* irrelevant */ false) != null; } public static boolean isSamAdapterNecessary(@NotNull FunctionDescriptor fun) { @@ -238,7 +248,7 @@ public class SingleAbstractMethodUtils { List valueParameters = new ArrayList(originalValueParameters.size()); for (ValueParameterDescriptor originalParam : originalValueParameters) { JetType originalType = originalParam.getType(); - JetType functionType = getFunctionTypeForSamType(originalType); + JetType functionType = getFunctionTypeForSamType(originalType, false); JetType newTypeUnsubstituted = functionType != null ? functionType : originalType; JetType newType = typeParameters.substitutor.substitute(newTypeUnsubstituted, Variance.IN_VARIANCE); assert newType != null : "couldn't substitute type: " + newTypeUnsubstituted + ", substitutor = " + typeParameters.substitutor; diff --git a/core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java b/core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java index 6a7a83262f4..182e6474793 100644 --- a/core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java +++ b/core/descriptors/src/org/jetbrains/jet/renderer/DescriptorRendererImpl.java @@ -292,15 +292,6 @@ public class DescriptorRendererImpl implements DescriptorRenderer { @NotNull @Override public String renderType(@NotNull JetType type) { - if (type == CANT_INFER_LAMBDA_PARAM_TYPE || type == DONT_CARE) { - return "???"; - } - if (ErrorUtils.isUninferredParameter(type)) { - if (uninferredTypeParameterAsName) { - return renderError(((UninferredParameterTypeConstructor) type.getConstructor()).getTypeParameterDescriptor().getName().toString()); - } - return "???"; - } if (type instanceof FlexibleType) { FlexibleType flexibleType = (FlexibleType) type; if (!debugMode) { @@ -310,6 +301,21 @@ public class DescriptorRendererImpl implements DescriptorRenderer { return "(" + renderType(flexibleType.getLowerBound()) + ".." + renderType(flexibleType.getUpperBound()) + ")"; } } + return renderInflexibleType(type); + } + + private String renderInflexibleType(@NotNull JetType type) { + assert !TypesPackage.isFlexible(type) : "Flexible types not allowed here: " + renderType(type); + + if (type == CANT_INFER_LAMBDA_PARAM_TYPE || type == DONT_CARE) { + return "???"; + } + if (ErrorUtils.isUninferredParameter(type)) { + if (uninferredTypeParameterAsName) { + return renderError(((UninferredParameterTypeConstructor) type.getConstructor()).getTypeParameterDescriptor().getName().toString()); + } + return "???"; + } if (type instanceof LazyType && debugMode) { return type.toString(); } @@ -327,10 +333,14 @@ public class DescriptorRendererImpl implements DescriptorRenderer { JetType lower = type.getLowerBound(); JetType upper = type.getUpperBound(); - String lowerRendered = renderDefaultType(lower); - String upperRendered = renderDefaultType(upper); + String lowerRendered = renderInflexibleType(lower); + String upperRendered = renderInflexibleType(upper); if (differsOnlyInNullability(lowerRendered, upperRendered)) { + if (upperRendered.startsWith("(")) { + // the case of complex type, e.g. (() -> Unit)? + return "(" + lowerRendered + ")!"; + } return lowerRendered + "!"; } @@ -358,7 +368,8 @@ public class DescriptorRendererImpl implements DescriptorRenderer { } private static boolean differsOnlyInNullability(String lower, String upper) { - return lower.equals(upper.replace("?", "")) || upper.endsWith("?") && (lower + "?").equals(upper); + return lower.equals(upper.replace("?", "")) + || upper.endsWith("?") && ((lower + "?").equals(upper)) || (("(" + lower + ")?").equals(upper)); } @NotNull