From 729085ec9ac88e24b8e2c1a3ca1126b0fce14579 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 28 Jul 2015 17:13:09 +0300 Subject: [PATCH] Iniital implementation of synthetic extensions for SAM-adapter functions (non-static only) --- .../kotlin/codegen/SamCodegenUtil.java | 5 + .../jetbrains/kotlin/codegen/StackValue.java | 74 ++-- .../binding/CodegenAnnotatingVisitor.java | 5 +- .../java/sam/SingleAbstractMethodUtils.java | 28 +- ...tionalScopesWithJavaSyntheticExtensions.kt | 27 ++ ...ope.kt => JavaSyntheticPropertiesScope.kt} | 29 +- .../synthetic/SamAdapterFunctionsScope.kt | 106 ++++++ .../synthetic/syntheticExtensionsUtils.kt | 27 ++ .../tasks/CallableDescriptorCollectors.kt | 7 +- .../phantomClashWithSamAdapter.kt | 28 -- .../phantomClashWithSamAdapter.txt | 19 -- .../dynamicTypes/withInvisibleSynthesized.txt | 1 - .../testData/diagnostics/tests/inline/sam.txt | 1 - .../j+k/cantDeclareIfSamAdapterIsInherited.kt | 17 - .../tests/j+k/computeIfAbsentConcurrent.txt | 2 - .../tests/j+k/inheritAbstractSamAdapter.txt | 5 - .../j+k/overrideWithSamAndTypeParameter.txt | 2 - .../tests/regressions/kt1639-JFrame.txt | 2 - .../diagnostics/tests/regressions/kt588.txt | 2 - .../{ => javaProperties}/AbbreviationName.kt | 0 .../{ => javaProperties}/AbbreviationName.txt | 0 .../{ => javaProperties}/Bases.kt | 0 .../{ => javaProperties}/Bases.txt | 0 .../{ => javaProperties}/CompiledClass.kt | 0 .../{ => javaProperties}/CompiledClass.txt | 0 .../{ => javaProperties}/FalseGetters.kt | 0 .../{ => javaProperties}/FalseGetters.txt | 0 .../{ => javaProperties}/FalseSetters.kt | 0 .../{ => javaProperties}/FalseSetters.txt | 0 .../{ => javaProperties}/FromTwoBases.kt | 0 .../{ => javaProperties}/FromTwoBases.txt | 0 .../{ => javaProperties}/GenericClass.kt | 0 .../{ => javaProperties}/GenericClass.txt | 0 .../{ => javaProperties}/Getter.kt | 0 .../{ => javaProperties}/Getter.txt | 0 .../{ => javaProperties}/GetterAndSetter.kt | 0 .../{ => javaProperties}/GetterAndSetter.txt | 0 .../{ => javaProperties}/ImplicitReceiver.kt | 0 .../{ => javaProperties}/ImplicitReceiver.txt | 0 .../{ => javaProperties}/IsNaming.kt | 0 .../{ => javaProperties}/IsNaming.txt | 0 .../JavaOverridesKotlin.kt | 0 .../JavaOverridesKotlin.txt | 0 .../KotlinOverridesJava.kt | 0 .../KotlinOverridesJava.txt | 0 .../KotlinOverridesJava2.kt | 0 .../KotlinOverridesJava2.txt | 0 .../KotlinOverridesJava3.kt | 0 .../KotlinOverridesJava3.txt | 0 .../KotlinOverridesJava4.kt | 0 .../KotlinOverridesJava4.txt | 0 .../KotlinOverridesJava5.kt | 0 .../KotlinOverridesJava5.txt | 0 .../{ => javaProperties}/OnlyPublic.kt | 0 .../{ => javaProperties}/OnlyPublic.txt | 0 .../OverrideGetterOnly.kt | 0 .../OverrideGetterOnly.txt | 0 .../{ => javaProperties}/SetterOnly.kt | 0 .../{ => javaProperties}/SetterOnly.txt | 0 .../{ => javaProperties}/SmartCast.kt | 0 .../{ => javaProperties}/SmartCast.txt | 0 .../SmartCastImplicitReceiver.kt | 0 .../SmartCastImplicitReceiver.txt | 0 .../TypeParameterReceiver.kt | 0 .../TypeParameterReceiver.txt | 0 .../samAdapters/GenericClass.kt | 15 + .../samAdapters/GenericClass.txt | 12 + .../samAdapters/GenericMethod.kt | 13 + .../samAdapters/GenericMethod.txt | 11 + .../GenericMethodInGenericClass.kt | 13 + .../GenericMethodInGenericClass.txt | 11 + .../samAdapters/InnerClassInGeneric.kt | 20 ++ .../samAdapters/InnerClassInGeneric.txt | 20 ++ .../samAdapters/NoNamedArgsAllowed.kt | 13 + .../samAdapters/NoNamedArgsAllowed.txt | 12 + .../syntheticExtensions/samAdapters/Simple.kt | 30 ++ .../samAdapters/Simple.txt} | 24 +- .../sam/adapters/AmbiguousAdapters.txt | 2 - .../compiledJava/sam/adapters/Basic.txt | 1 - .../compiledJava/sam/adapters/DeepSamLoop.txt | 2 - .../adapters/NoSamForClassTypeParameter.txt | 8 - .../adapters/NoSamForMethodTypeParameter.txt | 6 - .../sam/adapters/NonTrivialFunctionType.txt | 3 - .../sam/adapters/PrivateSamAdapter.txt | 1 - .../sam/adapters/SelfAsParameter.txt | 1 - .../sam/adapters/TypeParameterOfClass.txt | 1 - .../adapters/TypeParameterOfOuterClass.txt | 1 - .../AdapterDoesntOverrideDeclaration.txt | 1 - .../InheritedAdapterAndDeclaration.txt | 2 - .../InheritedAmbiguousAdapters.txt | 4 - ...nheritedAndOverriddenAmbiguousAdapters.txt | 4 - .../inheritance/InheritedOverridden.txt | 2 - .../InheritedOverriddenAdapter.txt | 3 +- .../inheritance/InheritedSameAdapters.txt | 3 - .../InheritedSameAdaptersWithSubstitution.txt | 4 - .../adapters/inheritance/InheritedSimple.txt | 2 - .../OverriddenAmbiguousAdapters.txt | 4 +- .../InheritAmbguousSamAdaptersInKotlin.txt | 4 - .../samAdapters/InheritSamAdapterInKotlin.txt | 2 - .../OverrideSamAdapterInKotlin.txt | 3 +- .../SamAdapterForOverriddenFromKotlin.txt | 1 - .../checkers/JetDiagnosticsTestGenerated.java | 322 ++++++++++-------- .../lazy/descriptors/LazyJavaMemberScope.kt | 4 +- .../kotlin/resolve/DescriptorUtils.kt | 6 + .../kotlin/types/DescriptorSubstitutor.java | 6 +- ...otlinPropertyAccessorsReferenceSearcher.kt | 4 +- 106 files changed, 624 insertions(+), 364 deletions(-) create mode 100644 compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/AdditionalScopesWithJavaSyntheticExtensions.kt rename compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/{JavaSyntheticExtensionsScope.kt => JavaSyntheticPropertiesScope.kt} (94%) create mode 100644 compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt create mode 100644 compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/syntheticExtensionsUtils.kt delete mode 100644 compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.kt delete mode 100644 compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.txt delete mode 100644 compiler/testData/diagnostics/tests/j+k/cantDeclareIfSamAdapterIsInherited.kt rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/AbbreviationName.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/AbbreviationName.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/Bases.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/Bases.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/CompiledClass.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/CompiledClass.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/FalseGetters.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/FalseGetters.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/FalseSetters.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/FalseSetters.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/FromTwoBases.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/FromTwoBases.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/GenericClass.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/GenericClass.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/Getter.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/Getter.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/GetterAndSetter.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/GetterAndSetter.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/ImplicitReceiver.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/ImplicitReceiver.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/IsNaming.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/IsNaming.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/JavaOverridesKotlin.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/JavaOverridesKotlin.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava2.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava2.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava3.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava3.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava4.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava4.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava5.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/KotlinOverridesJava5.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/OnlyPublic.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/OnlyPublic.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/OverrideGetterOnly.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/OverrideGetterOnly.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/SetterOnly.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/SetterOnly.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/SmartCast.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/SmartCast.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/SmartCastImplicitReceiver.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/SmartCastImplicitReceiver.txt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/TypeParameterReceiver.kt (100%) rename compiler/testData/diagnostics/tests/syntheticExtensions/{ => javaProperties}/TypeParameterReceiver.txt (100%) create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.txt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.txt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.txt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.txt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.txt create mode 100644 compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Simple.kt rename compiler/testData/diagnostics/tests/{j+k/cantDeclareIfSamAdapterIsInherited.txt => syntheticExtensions/samAdapters/Simple.txt} (50%) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/SamCodegenUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/SamCodegenUtil.java index cc2baa2ab86..e7f8e76787a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/SamCodegenUtil.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/SamCodegenUtil.java @@ -21,6 +21,7 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor; import org.jetbrains.kotlin.descriptors.FunctionDescriptor; import org.jetbrains.kotlin.load.java.descriptors.SamAdapterDescriptor; +import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor; public class SamCodegenUtil { @Nullable @@ -30,6 +31,10 @@ public class SamCodegenUtil { return ((SamAdapterDescriptor) original).getOriginForSam(); } + if (original instanceof SamAdapterExtensionFunctionDescriptor) { + return ((SamAdapterExtensionFunctionDescriptor) original).getOriginalFunction(); + } + if (original.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { for (FunctionDescriptor overridden : original.getOverriddenDescriptors()) { FunctionDescriptor originalIfSamAdapter = getOriginalIfSamAdapter(overridden); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java index 517fde5f1ba..026b74e6bcf 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.resolve.jvm.AsmTypes; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature; import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue; +import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor; import org.jetbrains.org.objectweb.asm.Label; import org.jetbrains.org.objectweb.asm.Type; import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter; @@ -485,15 +486,29 @@ public abstract class StackValue { ExpressionCodegen codegen, @Nullable Callable callableMethod ) { - if (resolvedCall.getDispatchReceiver().exists() || resolvedCall.getExtensionReceiver().exists() || isLocalFunCall(callableMethod)) { - boolean hasExtensionReceiver = resolvedCall.getExtensionReceiver().exists(); + ReceiverValue callDispatchReceiver = resolvedCall.getDispatchReceiver(); + ReceiverValue callExtensionReceiver = resolvedCall.getExtensionReceiver(); + if (callDispatchReceiver.exists() || callExtensionReceiver.exists() || isLocalFunCall(callableMethod)) { + CallableDescriptor descriptor = resolvedCall.getResultingDescriptor(); + ReceiverParameterDescriptor dispatchReceiverParameter = descriptor.getDispatchReceiverParameter(); + ReceiverParameterDescriptor extensionReceiverParameter = descriptor.getExtensionReceiverParameter(); + + if (descriptor.getOriginal() instanceof SamAdapterExtensionFunctionDescriptor) { + callDispatchReceiver = callExtensionReceiver; + callExtensionReceiver = ReceiverValue.NO_RECEIVER; + dispatchReceiverParameter = extensionReceiverParameter; + extensionReceiverParameter = null; + } + + boolean hasExtensionReceiver = callExtensionReceiver.exists(); StackValue dispatchReceiver = platformStaticCallIfPresent( - genReceiver(hasExtensionReceiver ? none() : receiver, codegen, resolvedCall, callableMethod, false), - resolvedCall.getResultingDescriptor() + genReceiver(hasExtensionReceiver ? none() : receiver, codegen, resolvedCall, callableMethod, callDispatchReceiver, false), + descriptor ); - StackValue extensionReceiver = genReceiver(receiver, codegen, resolvedCall, callableMethod, true); - return new CallReceiver(dispatchReceiver, extensionReceiver, - CallReceiver.calcType(resolvedCall, codegen.typeMapper, callableMethod)); + StackValue extensionReceiver = genReceiver(receiver, codegen, resolvedCall, callableMethod, callExtensionReceiver, true); + Type type = CallReceiver.calcType(resolvedCall, dispatchReceiverParameter, extensionReceiverParameter, codegen.typeMapper, callableMethod); + assert type != null : "Could not map receiver type for " + resolvedCall; + return new CallReceiver(dispatchReceiver, extensionReceiver, type); } return receiver; } @@ -503,9 +518,9 @@ public abstract class StackValue { @NotNull ExpressionCodegen codegen, @NotNull ResolvedCall resolvedCall, @Nullable Callable callableMethod, + ReceiverValue receiverValue, boolean isExtension ) { - ReceiverValue receiverValue = isExtension ? resolvedCall.getExtensionReceiver() : resolvedCall.getDispatchReceiver(); if (receiver == none()) { if (receiverValue.exists()) { return codegen.generateReceiverValue(receiverValue); @@ -1253,24 +1268,36 @@ public abstract class StackValue { this.extensionReceiver = extensionReceiver; } + @Nullable public static Type calcType( @NotNull ResolvedCall resolvedCall, + @Nullable ReceiverParameterDescriptor dispatchReceiver, + @Nullable ReceiverParameterDescriptor extensionReceiver, @NotNull JetTypeMapper typeMapper, @Nullable Callable callableMethod ) { - CallableDescriptor descriptor = resolvedCall.getResultingDescriptor(); - - Type dispatchReceiverType = smartDispatchReceiverType(descriptor, typeMapper); - ReceiverParameterDescriptor extensionReceiver = descriptor.getExtensionReceiverParameter(); - if (extensionReceiver != null) { return callableMethod != null ? callableMethod.getExtensionReceiverType() : typeMapper.mapType(extensionReceiver.getType()); } - else if (dispatchReceiverType != null) { + else if (dispatchReceiver != null) { + CallableDescriptor descriptor = resolvedCall.getResultingDescriptor(); + if (AnnotationsPackage.isPlatformStaticInObjectOrClass(descriptor)) { return Type.VOID_TYPE; } - return callableMethod != null ? callableMethod.getDispatchReceiverType() : dispatchReceiverType; + + if (callableMethod != null) { + return callableMethod.getDispatchReceiverType(); + } + + // Extract the receiver from the resolved call, workarounding the fact that ResolvedCall#dispatchReceiver doesn't have + // all the needed information, for example there's no way to find out whether or not a smart cast was applied to the receiver. + DeclarationDescriptor container = descriptor.getContainingDeclaration(); + if (container instanceof ClassDescriptor) { + return typeMapper.mapClass((ClassDescriptor) container); + } + + return typeMapper.mapType(dispatchReceiver); } else if (isLocalFunCall(callableMethod)) { return callableMethod.getGenerateCalleeType(); @@ -1279,23 +1306,6 @@ public abstract class StackValue { return Type.VOID_TYPE; } - /** - * Extracts the receiver from the resolved call, workarounding the fact that ResolvedCall#dispatchReceiver doesn't have - * all the needed information, for example there's no way to find out whether or not a smart cast was applied to the receiver. - */ - @Nullable - private static Type smartDispatchReceiverType(@NotNull CallableDescriptor descriptor, @NotNull JetTypeMapper typeMapper) { - ReceiverParameterDescriptor dispatchReceiverParameter = descriptor.getDispatchReceiverParameter(); - if (dispatchReceiverParameter == null) return null; - - DeclarationDescriptor container = descriptor.getContainingDeclaration(); - if (container instanceof ClassDescriptor) { - return typeMapper.mapClass((ClassDescriptor) container); - } - - return typeMapper.mapType(dispatchReceiverParameter); - } - @Override public void putSelector(@NotNull Type type, @NotNull InstructionAdapter v) { StackValue currentExtensionReceiver = extensionReceiver; diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenAnnotatingVisitor.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenAnnotatingVisitor.java index 1e8413c8131..4d529360e5b 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenAnnotatingVisitor.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/binding/CodegenAnnotatingVisitor.java @@ -416,9 +416,8 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid { if (original == null) return; List valueArguments = call.getValueArgumentsByIndex(); - if (valueArguments == null) { - throw new IllegalStateException("Failed to arrange value arguments by index: " + descriptor); - } + if (valueArguments == null) return; + for (ValueParameterDescriptor valueParameter : original.getValueParameters()) { SamType samType = SamType.create(valueParameter.getType()); if (samType == null) continue; diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.java index fc46df77c06..d76b72ece12 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.java @@ -239,30 +239,40 @@ public class SingleAbstractMethodUtils { JetType returnTypeUnsubstituted = original.getReturnType(); assert returnTypeUnsubstituted != null : "Creating SAM adapter for not initialized original: " + original; - JetType returnType = typeParameters.substitutor.substitute(returnTypeUnsubstituted, Variance.OUT_VARIANCE); + TypeSubstitutor substitutor = typeParameters.substitutor; + JetType returnType = substitutor.substitute(returnTypeUnsubstituted, Variance.OUT_VARIANCE); assert returnType != null : "couldn't substitute type: " + returnTypeUnsubstituted + - ", substitutor = " + typeParameters.substitutor; + ", substitutor = " + substitutor; + List valueParameters = createValueParametersForSamAdapter(original, adapter, substitutor); + + initializer.initialize(typeParameters.descriptors, valueParameters, returnType); + + return adapter; + } + + public static List createValueParametersForSamAdapter( + @NotNull FunctionDescriptor original, + @NotNull FunctionDescriptor samAdapter, + @NotNull TypeSubstitutor substitutor + ) { List originalValueParameters = original.getValueParameters(); List valueParameters = new ArrayList(originalValueParameters.size()); for (ValueParameterDescriptor originalParam : originalValueParameters) { JetType originalType = originalParam.getType(); 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; + JetType newType = substitutor.substitute(newTypeUnsubstituted, Variance.IN_VARIANCE); + assert newType != null : "couldn't substitute type: " + newTypeUnsubstituted + ", substitutor = " + substitutor; ValueParameterDescriptor newParam = new ValueParameterDescriptorImpl( - adapter, null, originalParam.getIndex(), originalParam.getAnnotations(), + samAdapter, null, originalParam.getIndex(), originalParam.getAnnotations(), originalParam.getName(), newType, false, null, SourceElement.NO_SOURCE ); valueParameters.add(newParam); } - - initializer.initialize(typeParameters.descriptors, valueParameters, returnType); - - return adapter; + return valueParameters; } @NotNull diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/AdditionalScopesWithJavaSyntheticExtensions.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/AdditionalScopesWithJavaSyntheticExtensions.kt new file mode 100644 index 00000000000..84bd1b1d6c6 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/AdditionalScopesWithJavaSyntheticExtensions.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.synthetic + +import org.jetbrains.kotlin.psi.JetFile +import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider +import org.jetbrains.kotlin.storage.StorageManager + +class AdditionalScopesWithJavaSyntheticExtensions(storageManager: StorageManager) : FileScopeProvider.AdditionalScopes { + private val scopes = listOf(JavaSyntheticPropertiesScope(storageManager), SamAdapterFunctionsScope(storageManager)) + + override fun scopes(file: JetFile) = scopes +} \ No newline at end of file diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticExtensionsScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt similarity index 94% rename from compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticExtensionsScope.kt rename to compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt index df0c227ad28..4c4dc2790dd 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticExtensionsScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt @@ -22,21 +22,19 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl -import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.JetFile import org.jetbrains.kotlin.resolve.DescriptorUtils -import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope +import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.typeUtil.isBoolean import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf import org.jetbrains.kotlin.types.typeUtil.isUnit -import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeFirstWord import org.jetbrains.kotlin.util.capitalizeDecapitalize.decapitalizeSmart +import org.jetbrains.kotlin.utils.Printer import org.jetbrains.kotlin.utils.addIfNotNull import java.util.ArrayList import java.util.HashSet @@ -84,13 +82,7 @@ interface SyntheticJavaPropertyDescriptor : PropertyDescriptor { } } -class AdditionalScopesWithJavaSyntheticExtensions(storageManager: StorageManager) : FileScopeProvider.AdditionalScopes { - private val scope = JavaSyntheticExtensionsScope(storageManager) - - override fun scopes(file: JetFile) = listOf(scope) -} - -class JavaSyntheticExtensionsScope(storageManager: StorageManager) : JetScope by JetScope.Empty { +class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImpl() { private val syntheticPropertyInClass = storageManager.createMemoizedFunctionWithNullableValues, PropertyDescriptor> { pair -> syntheticPropertyInClassNotCached(pair.first, pair.second) } @@ -117,13 +109,6 @@ class JavaSyntheticExtensionsScope(storageManager: StorageManager) : JetScope by return MyPropertyDescriptor(ownerClass, getMethod.original, setMethod?.original, name, propertyType) } - private fun FunctionDescriptor.hasJavaOriginInHierarchy(): Boolean { - return if (overriddenDescriptors.isEmpty()) - containingDeclaration is JavaClassDescriptor - else - overriddenDescriptors.any { it.hasJavaOriginInHierarchy() } - } - private fun isGoodGetMethod(descriptor: FunctionDescriptor): Boolean { val returnType = descriptor.returnType ?: return false if (returnType.isUnit()) return false @@ -251,6 +236,14 @@ class JavaSyntheticExtensionsScope(storageManager: StorageManager) : JetScope by return Name.identifier("set" + identifier.removePrefix(prefix)) } + override fun getContainingDeclaration(): DeclarationDescriptor { + throw UnsupportedOperationException() + } + + override fun printScopeStructure(p: Printer) { + p.println(javaClass.simpleName) + } + private class MyPropertyDescriptor( ownerClass: ClassDescriptor, override val getMethod: FunctionDescriptor, diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt new file mode 100644 index 00000000000..5549b62496d --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt @@ -0,0 +1,106 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.synthetic + +import com.intellij.util.SmartList +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl +import org.jetbrains.kotlin.load.java.sam.SingleAbstractMethodUtils +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf +import org.jetbrains.kotlin.resolve.scopes.JetScope +import org.jetbrains.kotlin.storage.StorageManager +import org.jetbrains.kotlin.types.DescriptorSubstitutor +import org.jetbrains.kotlin.types.JetType +import org.jetbrains.kotlin.types.TypeSubstitution +import org.jetbrains.kotlin.types.Variance +import java.util.ArrayList + +interface SamAdapterExtensionFunctionDescriptor : FunctionDescriptor { + val originalFunction: FunctionDescriptor +} + +class SamAdapterFunctionsScope(storageManager: StorageManager) : JetScope by JetScope.Empty { + private val extensionForFunction = storageManager.createMemoizedFunctionWithNullableValues { function -> + extensionForFunctionNotCached(function) + } + + private fun extensionForFunctionNotCached(function: FunctionDescriptor): FunctionDescriptor? { + //TODO! + if (function.visibility == Visibilities.PRIVATE || function.visibility == Visibilities.PRIVATE_TO_THIS || function.visibility == Visibilities.INVISIBLE_FAKE) return null + if (!function.hasJavaOriginInHierarchy()) return null //TODO: should we go into base at all? + if (!SingleAbstractMethodUtils.isSamAdapterNecessary(function)) return null + val returnType = function.returnType ?: return null + return MyFunctionDescriptor(function, returnType) + } + + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection { + var result: SmartList? = null + for (type in receiverTypes) { + for (function in type.memberScope.getFunctions(name)) { + val extension = extensionForFunction(function.original) + if (extension != null) { + if (result == null) { + result = SmartList() + } + result.add(extension) + } + } + } + return when { + result == null -> emptyList() + result.size() > 1 -> result.toSet() + else -> result + } + } + + private class MyFunctionDescriptor( + override val originalFunction: FunctionDescriptor, + originalReturnType: JetType + ) : SamAdapterExtensionFunctionDescriptor, SimpleFunctionDescriptorImpl( + DescriptorUtils.getContainingModule(originalFunction), + null, + Annotations.EMPTY, //TODO + originalFunction.name, + CallableMemberDescriptor.Kind.SYNTHESIZED, + originalFunction.source + ) { + init { + val typeParamsSum = (originalFunction.typeParameters).toArrayList() + val ownerClass = originalFunction.containingDeclaration as ClassDescriptor + //TODO: should we go up parents for getters/setters too? + for (parent in ownerClass.parentsWithSelf) { + if (parent !is ClassDescriptor) break + typeParamsSum += parent.typeConstructor.parameters + } + //TODO: duplicated parameter names + + val typeParameters = ArrayList(typeParamsSum.size()) + val typeSubstitutor = DescriptorSubstitutor.substituteTypeParameters(typeParamsSum, TypeSubstitution.EMPTY, this, typeParameters) + + val returnType = typeSubstitutor.safeSubstitute(originalReturnType, Variance.OUT_VARIANCE) + val receiverType = typeSubstitutor.safeSubstitute(ownerClass.defaultType, Variance.INVARIANT) + val valueParameters = SingleAbstractMethodUtils.createValueParametersForSamAdapter(originalFunction, this, typeSubstitutor) + initialize(receiverType, null, typeParameters, valueParameters, returnType, Modality.FINAL, Visibilities.PUBLIC) + } + + override fun hasStableParameterNames() = originalFunction.hasStableParameterNames() + override fun hasSynthesizedParameterNames() = originalFunction.hasSynthesizedParameterNames() + } +} \ No newline at end of file diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/syntheticExtensionsUtils.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/syntheticExtensionsUtils.kt new file mode 100644 index 00000000000..81781e781e7 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/syntheticExtensionsUtils.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.synthetic + +import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor + +fun FunctionDescriptor.hasJavaOriginInHierarchy(): Boolean { + return if (overriddenDescriptors.isEmpty()) + containingDeclaration is JavaClassDescriptor + else + overriddenDescriptors.any { it.hasJavaOriginInHierarchy() } +} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/CallableDescriptorCollectors.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/CallableDescriptorCollectors.kt index c3d2931bec5..2a722dea7cf 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/CallableDescriptorCollectors.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/CallableDescriptorCollectors.kt @@ -100,14 +100,15 @@ private object FunctionCollector : CallableDescriptorCollector, bindingTrace: BindingTrace): Collection { val functions = scope.getFunctions(name) - val (extensions, nonExtensions) = functions.partition { it.getExtensionReceiverParameter() != null } + val (extensions, nonExtensions) = functions.partition { it.extensionReceiverParameter != null } + val syntheticExtensions = scope.getSyntheticExtensionFunctions(receiverTypes, name) if (name == OperatorConventions.INVOKE) { // Create synthesized "invoke" extensions for each non-extension "invoke" found in the scope - return extensions + createSynthesizedInvokes(nonExtensions) + return extensions + createSynthesizedInvokes(nonExtensions) + syntheticExtensions } - return extensions + return extensions + syntheticExtensions } private fun getConstructors( diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.kt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.kt deleted file mode 100644 index 846e44e0a95..00000000000 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.kt +++ /dev/null @@ -1,28 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// FILE: p/Sam.java - -package p; - -public interface Sam { - void sam(); -} - -// FILE: p/Foo.java - -package p; - -public class Foo { - public void foo(Sam sam); -} - -// FILE: k.kt - -import p.* - -// to have enough fake overrides -open class K0 : Foo() - -class K : K0() { - // We keep this test to make sure ACCIDENTAL_OVERRIDE is not reported - fun foo(f: () -> Unit) {} -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.txt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.txt deleted file mode 100644 index a50fc24831a..00000000000 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.txt +++ /dev/null @@ -1,19 +0,0 @@ -package - -internal final class K : K0 { - public constructor K() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - internal final override /*1*/ fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun foo(/*0*/ sam: p.Sam!): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal open class K0 : p.Foo { - public constructor K0() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ sam: (() -> kotlin.Unit)!): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun foo(/*0*/ sam: p.Sam!): 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/dynamicTypes/withInvisibleSynthesized.txt b/compiler/testData/diagnostics/tests/dynamicTypes/withInvisibleSynthesized.txt index e911cfc7c31..53faafc1beb 100644 --- a/compiler/testData/diagnostics/tests/dynamicTypes/withInvisibleSynthesized.txt +++ b/compiler/testData/diagnostics/tests/dynamicTypes/withInvisibleSynthesized.txt @@ -4,7 +4,6 @@ internal final class K : p.J.C { public constructor K() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - invisible_fake final override /*1*/ /*fake_override*/ fun sam(/*0*/ sam: (() -> kotlin.Unit)!): kotlin.Unit invisible_fake open override /*1*/ /*fake_override*/ fun sam(/*0*/ sam: p.J.Sam!): kotlin.Unit internal final fun test(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/diagnostics/tests/inline/sam.txt b/compiler/testData/diagnostics/tests/inline/sam.txt index 4ed999394bb..8eb5904b354 100644 --- a/compiler/testData/diagnostics/tests/inline/sam.txt +++ b/compiler/testData/diagnostics/tests/inline/sam.txt @@ -16,7 +16,6 @@ public open class Test { public constructor Test() 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 final /*synthesized*/ fun test(/*0*/ r: (() -> kotlin.Int)!): kotlin.Unit public open fun test(/*0*/ r: Run!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/j+k/cantDeclareIfSamAdapterIsInherited.kt b/compiler/testData/diagnostics/tests/j+k/cantDeclareIfSamAdapterIsInherited.kt deleted file mode 100644 index ec64c6f6e04..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/cantDeclareIfSamAdapterIsInherited.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: Super.java -class Super { - void foo(Runnable r) { - } -} - -// FILE: Sub.kt -class Sub1() : Super() { - fun foo(r : (() -> Unit)?) { - } -} - -class Sub2() : Super() { - override fun foo(r : (() -> Unit)?) { - } -} - diff --git a/compiler/testData/diagnostics/tests/j+k/computeIfAbsentConcurrent.txt b/compiler/testData/diagnostics/tests/j+k/computeIfAbsentConcurrent.txt index 971686de9cd..f207047e0a2 100644 --- a/compiler/testData/diagnostics/tests/j+k/computeIfAbsentConcurrent.txt +++ b/compiler/testData/diagnostics/tests/j+k/computeIfAbsentConcurrent.txt @@ -6,7 +6,6 @@ public fun concurrentMap(): kotlin.Unit public open class ConcHashMap : ConcMap { public constructor ConcHashMap() - java.lang.Override() public/*package*/ final override /*1*/ /*synthesized*/ fun computeIfAbsent(/*0*/ key: K!, /*1*/ mappingFunction: ((K!) -> V!)!): V! java.lang.Override() public/*package*/ open override /*1*/ fun computeIfAbsent(/*0*/ key: K!, /*1*/ mappingFunction: MyFunc!): V! public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -14,7 +13,6 @@ public open class ConcHashMap : Co } public interface ConcMap { - public final /*synthesized*/ fun computeIfAbsent(/*0*/ key: K!, /*1*/ mappingFunction: ((K!) -> V!)!): V! public abstract fun computeIfAbsent(/*0*/ key: K!, /*1*/ mappingFunction: MyFunc!): V! public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/j+k/inheritAbstractSamAdapter.txt b/compiler/testData/diagnostics/tests/j+k/inheritAbstractSamAdapter.txt index fd5a4d12d50..68ad5f6472c 100644 --- a/compiler/testData/diagnostics/tests/j+k/inheritAbstractSamAdapter.txt +++ b/compiler/testData/diagnostics/tests/j+k/inheritAbstractSamAdapter.txt @@ -4,17 +4,14 @@ public /*synthesized*/ fun A(/*0*/ function: (java.lang.Runnable!) -> kotlin.Uni public interface A { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final /*synthesized*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public abstract fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } public interface B : A { - public final /*synthesized*/ fun bar(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public abstract fun bar(/*0*/ r: java.lang.Runnable!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -22,10 +19,8 @@ public interface B : A { internal final class C : B { public constructor C() - public final override /*1*/ /*fake_override*/ fun bar(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public open override /*1*/ fun bar(/*0*/ r: java.lang.Runnable?): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public open override /*1*/ fun foo(/*0*/ r: java.lang.Runnable?): 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/j+k/overrideWithSamAndTypeParameter.txt b/compiler/testData/diagnostics/tests/j+k/overrideWithSamAndTypeParameter.txt index 0271562cc76..ff92c32caf0 100644 --- a/compiler/testData/diagnostics/tests/j+k/overrideWithSamAndTypeParameter.txt +++ b/compiler/testData/diagnostics/tests/j+k/overrideWithSamAndTypeParameter.txt @@ -6,7 +6,6 @@ internal fun main(): kotlin.Unit public interface A { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final /*synthesized*/ fun foo(/*0*/ key: K!, /*1*/ f: ((kotlin.String!) -> kotlin.String!)!): K! public abstract fun foo(/*0*/ key: K!, /*1*/ f: MyFunc!): K! public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -15,7 +14,6 @@ public interface A { public open class B : A { public constructor B() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - java.lang.Override() public final override /*1*/ /*synthesized*/ fun foo(/*0*/ key: E!, /*1*/ f: ((kotlin.String!) -> kotlin.String!)!): E! java.lang.Override() public open override /*1*/ fun foo(/*0*/ key: E!, /*1*/ f: MyFunc!): E! 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/regressions/kt1639-JFrame.txt b/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.txt index 2b693b154e2..9434cf345b1 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.txt +++ b/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.txt @@ -335,9 +335,7 @@ package test { public open override /*1*/ /*fake_override*/ fun getModalExclusionType(): [ERROR : Unresolved java classifier: ModalExclusionType]! public open override /*1*/ /*fake_override*/ fun getMostRecentFocusOwner(): java.awt.Component! invisible_fake open override /*1*/ /*fake_override*/ fun getMouseEventTarget(/*0*/ p0: kotlin.Int, /*1*/ p1: kotlin.Int, /*2*/ p2: kotlin.Boolean): java.awt.Component! - invisible_fake final override /*1*/ /*fake_override*/ fun getMouseEventTarget(/*0*/ p0: kotlin.Int, /*1*/ p1: kotlin.Int, /*2*/ p2: kotlin.Boolean, /*3*/ p3: ((java.awt.Component!) -> kotlin.Boolean)!, /*4*/ p4: kotlin.Boolean): java.awt.Component! invisible_fake open override /*1*/ /*fake_override*/ fun getMouseEventTarget(/*0*/ p0: kotlin.Int, /*1*/ p1: kotlin.Int, /*2*/ p2: kotlin.Boolean, /*3*/ p3: java.awt.Container.EventTargetFilter!, /*4*/ p4: kotlin.Boolean): java.awt.Component! - invisible_fake final override /*1*/ /*fake_override*/ fun getMouseEventTargetImpl(/*0*/ p0: kotlin.Int, /*1*/ p1: kotlin.Int, /*2*/ p2: kotlin.Boolean, /*3*/ p3: ((java.awt.Component!) -> kotlin.Boolean)!, /*4*/ p4: kotlin.Boolean, /*5*/ p5: kotlin.Boolean): java.awt.Component! invisible_fake open override /*1*/ /*fake_override*/ fun getMouseEventTargetImpl(/*0*/ p0: kotlin.Int, /*1*/ p1: kotlin.Int, /*2*/ p2: kotlin.Boolean, /*3*/ p3: java.awt.Container.EventTargetFilter!, /*4*/ p4: kotlin.Boolean, /*5*/ p5: kotlin.Boolean): java.awt.Component! public open override /*1*/ /*fake_override*/ fun getMouseListeners(): kotlin.Array<(out) [ERROR : Unresolved java classifier: MouseListener]!>! public open override /*1*/ /*fake_override*/ fun getMouseMotionListeners(): kotlin.Array<(out) [ERROR : Unresolved java classifier: MouseMotionListener]!>! diff --git a/compiler/testData/diagnostics/tests/regressions/kt588.txt b/compiler/testData/diagnostics/tests/regressions/kt588.txt index 2cb6a33a6f2..3381e698e17 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt588.txt +++ b/compiler/testData/diagnostics/tests/regressions/kt588.txt @@ -40,7 +40,6 @@ internal final class Test : java.lang.Thread { public final override /*1*/ /*fake_override*/ fun getThreadGroup(): [ERROR : Unresolved java classifier: ThreadGroup]! public open override /*1*/ /*fake_override*/ fun getUncaughtExceptionHandler(): java.lang.Thread.UncaughtExceptionHandler! public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - invisible_fake final override /*1*/ /*fake_override*/ fun init(/*0*/ p0: [ERROR : Unresolved java classifier: ThreadGroup]!, /*1*/ p1: (() -> kotlin.Unit)!, /*2*/ p2: kotlin.String!, /*3*/ p3: kotlin.Long): kotlin.Unit invisible_fake open override /*1*/ /*fake_override*/ fun init(/*0*/ p0: [ERROR : Unresolved java classifier: ThreadGroup]!, /*1*/ p1: java.lang.Runnable!, /*2*/ p2: kotlin.String!, /*3*/ p3: kotlin.Long): kotlin.Unit public open override /*1*/ /*fake_override*/ fun interrupt(): kotlin.Unit invisible_fake open override /*1*/ /*fake_override*/ fun interrupt0(): kotlin.Unit @@ -60,7 +59,6 @@ internal final class Test : java.lang.Thread { invisible_fake open override /*1*/ /*fake_override*/ fun setNativeName(/*0*/ p0: kotlin.String!): kotlin.Unit public final override /*1*/ /*fake_override*/ fun setPriority(/*0*/ p0: kotlin.Int): kotlin.Unit invisible_fake open override /*1*/ /*fake_override*/ fun setPriority0(/*0*/ p0: kotlin.Int): kotlin.Unit - public final override /*1*/ /*fake_override*/ fun setUncaughtExceptionHandler(/*0*/ p0: ((java.lang.Thread!, kotlin.Throwable!) -> kotlin.Unit)!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun setUncaughtExceptionHandler(/*0*/ p0: java.lang.Thread.UncaughtExceptionHandler!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun start(): kotlin.Unit invisible_fake open override /*1*/ /*fake_override*/ fun start0(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/AbbreviationName.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/AbbreviationName.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/AbbreviationName.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/AbbreviationName.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/AbbreviationName.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/AbbreviationName.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/AbbreviationName.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/AbbreviationName.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/Bases.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/Bases.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/Bases.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/Bases.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/CompiledClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/CompiledClass.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/CompiledClass.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/CompiledClass.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/FalseGetters.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseGetters.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/FalseGetters.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseGetters.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/FalseGetters.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseGetters.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/FalseGetters.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseGetters.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/FalseSetters.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseSetters.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/FalseSetters.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseSetters.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/FalseSetters.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseSetters.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/FalseSetters.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseSetters.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/FromTwoBases.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FromTwoBases.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/FromTwoBases.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FromTwoBases.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/FromTwoBases.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FromTwoBases.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/FromTwoBases.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FromTwoBases.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/GenericClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GenericClass.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/GenericClass.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GenericClass.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/GenericClass.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GenericClass.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/GenericClass.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GenericClass.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/Getter.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/Getter.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/Getter.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/Getter.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/GetterAndSetter.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GetterAndSetter.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/GetterAndSetter.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GetterAndSetter.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/GetterAndSetter.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GetterAndSetter.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/GetterAndSetter.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GetterAndSetter.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/ImplicitReceiver.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/ImplicitReceiver.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/ImplicitReceiver.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/ImplicitReceiver.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/IsNaming.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/IsNaming.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/IsNaming.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/IsNaming.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/IsNaming.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/IsNaming.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/IsNaming.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/IsNaming.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/JavaOverridesKotlin.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/JavaOverridesKotlin.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/JavaOverridesKotlin.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/JavaOverridesKotlin.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava2.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava2.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava2.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava2.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava3.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava3.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava3.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava3.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava4.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava4.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava4.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava4.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava5.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava5.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava5.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava5.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/OnlyPublic.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/OnlyPublic.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/OnlyPublic.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/OnlyPublic.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/OverrideGetterOnly.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/OverrideGetterOnly.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/OverrideGetterOnly.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/OverrideGetterOnly.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/SetterOnly.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterOnly.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/SetterOnly.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterOnly.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/SetterOnly.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterOnly.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/SetterOnly.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterOnly.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/SmartCast.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCast.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/SmartCast.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCast.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/SmartCast.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCast.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/SmartCast.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCast.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/SmartCastImplicitReceiver.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCastImplicitReceiver.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/SmartCastImplicitReceiver.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCastImplicitReceiver.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/SmartCastImplicitReceiver.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCastImplicitReceiver.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/SmartCastImplicitReceiver.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCastImplicitReceiver.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/TypeParameterReceiver.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeParameterReceiver.kt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/TypeParameterReceiver.kt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeParameterReceiver.kt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/TypeParameterReceiver.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeParameterReceiver.txt similarity index 100% rename from compiler/testData/diagnostics/tests/syntheticExtensions/TypeParameterReceiver.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeParameterReceiver.txt diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt new file mode 100644 index 00000000000..f9382a8e2ff --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt @@ -0,0 +1,15 @@ +// FILE: KotlinFile.kt +fun foo(javaClass: JavaClass): String { + return javaClass.doSomething("", 1) { s: String -> "" } +} + +fun useString(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); +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.txt new file mode 100644 index 00000000000..1302d9a59e6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.txt @@ -0,0 +1,12 @@ +package + +internal fun foo(/*0*/ javaClass: JavaClass): kotlin.String +internal fun useString(/*0*/ s: kotlin.String): kotlin.Unit + +public open class JavaClass { + public constructor JavaClass() + public open fun doSomething(/*0*/ t: T!, /*1*/ anInt: kotlin.Int, /*2*/ i: I!): 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 +} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt new file mode 100644 index 00000000000..cf003292cd9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt @@ -0,0 +1,13 @@ +// 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); +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.txt new file mode 100644 index 00000000000..a51d3b5e55b --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.txt @@ -0,0 +1,11 @@ +package + +internal fun foo(/*0*/ javaClass: JavaClass): kotlin.String + +public open class JavaClass { + public constructor JavaClass() + public open fun doSomething(/*0*/ t: T!, /*1*/ i: I!): 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 +} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt new file mode 100644 index 00000000000..e5b833f7f59 --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt @@ -0,0 +1,13 @@ +// FILE: KotlinFile.kt +fun foo(javaClass: JavaClass): String { + return javaClass.doSomething("", 1) { it } +} + +// FILE: JavaClass.java +public class JavaClass { + public T doSomething(T t, X x, I i) { return i.run(t); } +} + +interface I { + T run(T t); +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.txt new file mode 100644 index 00000000000..805ea565a61 --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.txt @@ -0,0 +1,11 @@ +package + +internal fun foo(/*0*/ javaClass: JavaClass): kotlin.String + +public open class JavaClass { + public constructor JavaClass() + public open fun doSomething(/*0*/ t: T!, /*1*/ x: X!, /*2*/ i: I!): 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 +} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt new file mode 100644 index 00000000000..f341d80d957 --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt @@ -0,0 +1,20 @@ +// FILE: KotlinFile.kt +fun foo(javaClass: JavaClass) { + val inner = javaClass.createInner() + inner.doSomething(1, "") { + bar() + } +} + +fun bar(){} + +// FILE: JavaClass.java +public class JavaClass { + public Inner createInner() { + return new Inner(); + } + + public class Inner{ + public void doSomething(T t, X x, Runnable runnable) { runnable.run(); } + } +} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.txt new file mode 100644 index 00000000000..4bb0cb41320 --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.txt @@ -0,0 +1,20 @@ +package + +internal fun bar(): kotlin.Unit +internal fun foo(/*0*/ javaClass: JavaClass): kotlin.Unit + +public open class JavaClass { + public constructor JavaClass() + public open fun createInner(): JavaClass.Inner! + 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 inner class Inner { + public constructor Inner() + public open fun doSomething(/*0*/ t: T!, /*1*/ x: X!, /*2*/ runnable: java.lang.Runnable!): 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 + } +} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt new file mode 100644 index 00000000000..226048d24ea --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt @@ -0,0 +1,13 @@ +// FILE: KotlinFile.kt +fun foo(javaClass: JavaClass) { + javaClass.doSomething(p = 1) { + bar() + } +} + +fun bar(){} + +// FILE: JavaClass.java +public class JavaClass { + public void doSomething(int p, Runnable runnable) { runnable.run(); } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.txt new file mode 100644 index 00000000000..39e1675eb54 --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.txt @@ -0,0 +1,12 @@ +package + +internal fun bar(): kotlin.Unit +internal fun foo(/*0*/ javaClass: JavaClass): kotlin.Unit + +public open class JavaClass { + public constructor JavaClass() + public open fun doSomething(/*0*/ p: kotlin.Int, /*1*/ runnable: java.lang.Runnable!): 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 +} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Simple.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Simple.kt new file mode 100644 index 00000000000..422c631a52f --- /dev/null +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Simple.kt @@ -0,0 +1,30 @@ +// FILE: KotlinFile.kt +class KotlinClass { + public fun doSomething(runnable: Runnable) { runnable.run() } +} + +public interface I { + public fun doIt() +} + +fun foo(javaClass: JavaClass, kotlinClass: KotlinClass) { + javaClass.doSomething { + bar() + } + + kotlinClass.doSomething { + bar() + } + + javaClass.doSomething2 { + bar() + } +} + +fun bar(){} + +// FILE: JavaClass.java +public class JavaClass { + public void doSomething(Runnable runnable) { runnable.run(); } + public void doSomething2(I i) { i.doIt(); } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/j+k/cantDeclareIfSamAdapterIsInherited.txt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Simple.txt similarity index 50% rename from compiler/testData/diagnostics/tests/j+k/cantDeclareIfSamAdapterIsInherited.txt rename to compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Simple.txt index a95fefd091c..f355225b4cb 100644 --- a/compiler/testData/diagnostics/tests/j+k/cantDeclareIfSamAdapterIsInherited.txt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Simple.txt @@ -1,28 +1,28 @@ package -internal final class Sub1 : Super { - public constructor Sub1() +internal fun bar(): kotlin.Unit +internal fun foo(/*0*/ javaClass: JavaClass, /*1*/ kotlinClass: KotlinClass): kotlin.Unit + +public interface I { + public abstract fun doIt(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - internal final override /*1*/ fun foo(/*0*/ r: (() -> kotlin.Unit)?): kotlin.Unit - public/*package*/ open override /*1*/ /*fake_override*/ fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -internal final class Sub2 : Super { - public constructor Sub2() +public open class JavaClass { + public constructor JavaClass() + public open fun doSomething(/*0*/ runnable: java.lang.Runnable!): kotlin.Unit + public open fun doSomething2(/*0*/ i: I!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - internal open override /*1*/ fun foo(/*0*/ r: (() -> kotlin.Unit)?): kotlin.Unit - public/*package*/ open override /*1*/ /*fake_override*/ fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public/*package*/ open class Super { - public/*package*/ constructor Super() +internal final class KotlinClass { + public constructor KotlinClass() + public final fun doSomething(/*0*/ runnable: java.lang.Runnable): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public/*package*/ final /*synthesized*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit - public/*package*/ open fun foo(/*0*/ r: java.lang.Runnable!): 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/loadJava/compiledJava/sam/adapters/AmbiguousAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/AmbiguousAdapters.txt index 67cd27aa493..2d4ba4a9c71 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/AmbiguousAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/AmbiguousAdapters.txt @@ -2,8 +2,6 @@ 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 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 757d293d9a3..c2b48a722bf 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/Basic.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/Basic.txt @@ -2,7 +2,6 @@ package test public open class Basic { public constructor Basic() - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit // Static members diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/DeepSamLoop.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/DeepSamLoop.txt index 9fd6589f4b7..2ce50c9277a 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/DeepSamLoop.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/DeepSamLoop.txt @@ -3,12 +3,10 @@ package test public interface DeepSamLoop { public interface Bar { - 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 interface Foo { - 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 } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/NoSamForClassTypeParameter.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/NoSamForClassTypeParameter.txt index 41549d6757e..c900fe51a0b 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/NoSamForClassTypeParameter.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/NoSamForClassTypeParameter.txt @@ -2,33 +2,25 @@ package test public/*package*/ open class NoSamForTypeParameter { public/*package*/ constructor NoSamForTypeParameter() - public/*package*/ final /*synthesized*/ fun foo(/*0*/ p0: K!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open fun foo(/*0*/ p0: K!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } public/*package*/ open class NoSamForTypeParameterDerived1 : test.NoSamForTypeParameter { public/*package*/ constructor NoSamForTypeParameterDerived1() - public/*package*/ final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit - public/*package*/ final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } public/*package*/ open class NoSamForTypeParameterDerived2 : test.NoSamForTypeParameter { public/*package*/ constructor NoSamForTypeParameterDerived2() - public/*package*/ final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: E!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open override /*1*/ fun foo(/*0*/ p0: E!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } public/*package*/ open class NoSamForTypeParameterDerived3 : test.NoSamForTypeParameterDerived1 { public/*package*/ constructor NoSamForTypeParameterDerived3() - public/*package*/ final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit - public/*package*/ final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } public/*package*/ open class NoSamForTypeParameterDerived4 : test.NoSamForTypeParameterDerived2 { public/*package*/ constructor NoSamForTypeParameterDerived4() - public/*package*/ final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit - public/*package*/ final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/NoSamForMethodTypeParameter.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/NoSamForMethodTypeParameter.txt index 502943c5a02..f6376c68bd4 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/NoSamForMethodTypeParameter.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/NoSamForMethodTypeParameter.txt @@ -2,26 +2,20 @@ package test public/*package*/ open class NoSamForTypeParameter { public/*package*/ constructor NoSamForTypeParameter() - public/*package*/ final /*synthesized*/ fun foo(/*0*/ p0: K!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open fun foo(/*0*/ p0: K!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } public/*package*/ open class NoSamForTypeParameterDerived1 : test.NoSamForTypeParameter { public/*package*/ constructor NoSamForTypeParameterDerived1() - public/*package*/ final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit - public/*package*/ final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: K!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open fun foo(/*0*/ p0: java.lang.Runnable!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } public/*package*/ open class NoSamForTypeParameterDerived2 : test.NoSamForTypeParameter { public/*package*/ constructor NoSamForTypeParameterDerived2() - public/*package*/ final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: K!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open override /*1*/ fun foo(/*0*/ p0: K!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } public/*package*/ open class NoSamForTypeParameterDerived3 : test.NoSamForTypeParameterDerived1 { public/*package*/ constructor NoSamForTypeParameterDerived3() - public/*package*/ final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit - public/*package*/ final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: K!, /*1*/ p1: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable!, /*1*/ p1: java.lang.Runnable!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/NonTrivialFunctionType.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/NonTrivialFunctionType.txt index 4489b184bae..92518af45dd 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/NonTrivialFunctionType.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/NonTrivialFunctionType.txt @@ -2,11 +2,8 @@ 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 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 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/PrivateSamAdapter.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/PrivateSamAdapter.txt index d50f28efa6c..6ac60b670a1 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/PrivateSamAdapter.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/PrivateSamAdapter.txt @@ -2,7 +2,6 @@ package test public open class PrivateSamAdapter { public constructor PrivateSamAdapter() - private final /*synthesized*/ fun samAdapter(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit private open fun samAdapter(/*0*/ p0: test.PrivateSamAdapter.SamInterface!): kotlin.Unit private interface SamInterface { diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/SelfAsParameter.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/SelfAsParameter.txt index e8ecbe3e815..52c209c36d3 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/SelfAsParameter.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/SelfAsParameter.txt @@ -3,6 +3,5 @@ package test public /*synthesized*/ fun SelfAsParameter(/*0*/ function: (test.SelfAsParameter!) -> kotlin.Unit): test.SelfAsParameter public interface SelfAsParameter { - public final /*synthesized*/ fun foo(/*0*/ p0: ((test.SelfAsParameter!) -> kotlin.Unit)!): kotlin.Unit public abstract fun foo(/*0*/ p0: test.SelfAsParameter!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfClass.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfClass.txt index dd1c56efbf7..3422a86ec41 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfClass.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfClass.txt @@ -2,6 +2,5 @@ package test public open class TypeParameterOfClass { public constructor TypeParameterOfClass() - public final /*synthesized*/ fun foo(/*0*/ p0: ((T!, T!) -> kotlin.Int)!): kotlin.Unit public open fun foo(/*0*/ p0: java.util.Comparator!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfOuterClass.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfOuterClass.txt index 2f702a2eeb8..38812de8fa0 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfOuterClass.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfOuterClass.txt @@ -5,7 +5,6 @@ public open class TypeParameterOfOuterClass { public open inner class Inner { public constructor Inner() - public final /*synthesized*/ fun foo(/*0*/ p0: ((T!, T!) -> kotlin.Int)!): kotlin.Unit public open fun foo(/*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 8210fe730c3..fe176f0e97b 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/AdapterDoesntOverrideDeclaration.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/AdapterDoesntOverrideDeclaration.txt @@ -4,7 +4,6 @@ public interface AdapterDoesntOverrideDeclaration { public interface 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 } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAdapterAndDeclaration.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAdapterAndDeclaration.txt index c1f7ebe7644..d6d7bccbf99 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAdapterAndDeclaration.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAdapterAndDeclaration.txt @@ -4,13 +4,11 @@ public interface InheritedAdapterAndDeclaration { public interface 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 interface 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 } } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAmbiguousAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAmbiguousAdapters.txt index 40f78972463..b5e4f08ed6a 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAmbiguousAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAmbiguousAdapters.txt @@ -3,15 +3,11 @@ package test public interface InheritedAmbiguousAdapters { public interface 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 interface 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 } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAndOverriddenAmbiguousAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAndOverriddenAmbiguousAdapters.txt index d7bde758e48..d422296f8aa 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAndOverriddenAmbiguousAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedAndOverriddenAmbiguousAdapters.txt @@ -3,15 +3,11 @@ package test public interface InheritedAndOverriddenAmbiguousAdapters { public interface 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 interface 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 } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverridden.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverridden.txt index 4959a737d04..f5d76123db5 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverridden.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverridden.txt @@ -4,13 +4,11 @@ public interface 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 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 } } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverriddenAdapter.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverriddenAdapter.txt index 802355c6bf4..0b78fe33e60 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverriddenAdapter.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedOverriddenAdapter.txt @@ -4,13 +4,12 @@ public interface 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 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 } } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdapters.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdapters.txt index 2926af37f45..da0020bb56f 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdapters.txt @@ -3,17 +3,14 @@ package test public interface InheritedSameAdapters { public interface 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 interface Super1 { - public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit } public interface Super2 { - 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/InheritedSameAdaptersWithSubstitution.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdaptersWithSubstitution.txt index 9a6ce66d599..a6f5e3c4bdc 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdaptersWithSubstitution.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSameAdaptersWithSubstitution.txt @@ -3,22 +3,18 @@ package test public interface InheritedSameAdaptersWithSubstitution { public interface Sub : test.InheritedSameAdaptersWithSubstitution.Super1, test.InheritedSameAdaptersWithSubstitution.Super2Substituted { - public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: ((kotlin.String!, kotlin.String!) -> kotlin.Int)!): kotlin.Unit public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.util.Comparator!): kotlin.Unit } public interface Super1 { - public final /*synthesized*/ fun foo(/*0*/ p0: ((kotlin.String!, kotlin.String!) -> kotlin.Int)!): kotlin.Unit public abstract fun foo(/*0*/ p0: java.util.Comparator!): kotlin.Unit } public interface Super2 { - public final /*synthesized*/ fun foo(/*0*/ p0: ((T!, T!) -> kotlin.Int)!): kotlin.Unit public abstract fun foo(/*0*/ p0: java.util.Comparator!): kotlin.Unit } public interface Super2Substituted : test.InheritedSameAdaptersWithSubstitution.Super2 { - public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: ((kotlin.String!, kotlin.String!) -> kotlin.Int)!): kotlin.Unit public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.util.Comparator!): kotlin.Unit } diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSimple.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSimple.txt index caecdc3fd18..cc18ba2098a 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSimple.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/InheritedSimple.txt @@ -3,12 +3,10 @@ package test public interface InheritedSimple { public interface Sub : test.InheritedSimple.Super { - 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 interface Super { - 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 376b3ef7589..cb2850dd4d9 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/OverriddenAmbiguousAdapters.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/inheritance/OverriddenAmbiguousAdapters.txt @@ -3,14 +3,12 @@ package test public interface OverriddenAmbiguousAdapters { public interface Sub : test.OverriddenAmbiguousAdapters.Super { - public abstract override /*2*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit + public abstract 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 interface 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 } diff --git a/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritAmbguousSamAdaptersInKotlin.txt b/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritAmbguousSamAdaptersInKotlin.txt index f3c933c5508..bd84811a0ca 100644 --- a/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritAmbguousSamAdaptersInKotlin.txt +++ b/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritAmbguousSamAdaptersInKotlin.txt @@ -2,16 +2,12 @@ package test public final class Sub : test.Super { public constructor Sub() - public/*package*/ final override /*1*/ /*fake_override*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit - public/*package*/ final override /*1*/ /*fake_override*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open override /*1*/ /*fake_override*/ fun foo(/*0*/ r: java.io.Closeable!): kotlin.Unit public/*package*/ open override /*1*/ /*fake_override*/ fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit } public open class Super { public constructor Super() - public/*package*/ final /*synthesized*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit - public/*package*/ final /*synthesized*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open fun foo(/*0*/ r: java.io.Closeable!): kotlin.Unit public/*package*/ open fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit } diff --git a/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritSamAdapterInKotlin.txt b/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritSamAdapterInKotlin.txt index 175c3db2dd2..03902fb445e 100644 --- a/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritSamAdapterInKotlin.txt +++ b/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritSamAdapterInKotlin.txt @@ -2,12 +2,10 @@ package test public final class Sub : test.Super { public constructor Sub() - public/*package*/ final override /*1*/ /*fake_override*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open override /*1*/ /*fake_override*/ fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit } public open class Super { public constructor Super() - public/*package*/ final /*synthesized*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit } diff --git a/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/OverrideSamAdapterInKotlin.txt b/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/OverrideSamAdapterInKotlin.txt index eebc4a3c74d..ed3d5a50565 100644 --- a/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/OverrideSamAdapterInKotlin.txt +++ b/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/OverrideSamAdapterInKotlin.txt @@ -2,12 +2,11 @@ package test public final class Sub : test.Super { public constructor Sub() - internal open override /*1*/ fun foo(/*0*/ r: (() -> kotlin.Unit)?): kotlin.Unit + internal open fun foo(/*0*/ r: (() -> kotlin.Unit)?): kotlin.Unit public/*package*/ open override /*1*/ /*fake_override*/ fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit } public open class Super { public constructor Super() - public/*package*/ final /*synthesized*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public/*package*/ open fun foo(/*0*/ r: java.lang.Runnable!): kotlin.Unit } diff --git a/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/SamAdapterForOverriddenFromKotlin.txt b/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/SamAdapterForOverriddenFromKotlin.txt index bd1deb09d8e..ccd93214673 100644 --- a/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/SamAdapterForOverriddenFromKotlin.txt +++ b/compiler/testData/loadJava/javaAgainstKotlin/samAdapters/SamAdapterForOverriddenFromKotlin.txt @@ -2,7 +2,6 @@ package test public open class Sub : test.Super { public constructor Sub() - public final /*synthesized*/ fun foo(/*0*/ r: (() -> kotlin.Unit)!): kotlin.Unit public open override /*1*/ fun foo(/*0*/ r: java.lang.Runnable): kotlin.Unit } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 44fce6d35ac..be814772306 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -4631,12 +4631,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("phantomClashWithSamAdapter.kt") - public void testPhantomClashWithSamAdapter() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/phantomClashWithSamAdapter.kt"); - doTest(fileName); - } - @TestMetadata("privateClassFunctionOverriddenByProperty.kt") public void testPrivateClassFunctionOverriddenByProperty() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/privateClassFunctionOverriddenByProperty.kt"); @@ -8388,12 +8382,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("cantDeclareIfSamAdapterIsInherited.kt") - public void testCantDeclareIfSamAdapterIsInherited() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/cantDeclareIfSamAdapterIsInherited.kt"); - doTest(fileName); - } - @TestMetadata("computeIfAbsentConcurrent.kt") public void testComputeIfAbsentConcurrent() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/computeIfAbsentConcurrent.kt"); @@ -14252,146 +14240,200 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class SyntheticExtensions extends AbstractJetDiagnosticsTest { - @TestMetadata("AbbreviationName.kt") - public void testAbbreviationName() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/AbbreviationName.kt"); - doTest(fileName); - } - public void testAllFilesPresentInSyntheticExtensions() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/syntheticExtensions"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("Bases.kt") - public void testBases() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/Bases.kt"); - doTest(fileName); + @TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JavaProperties extends AbstractJetDiagnosticsTest { + @TestMetadata("AbbreviationName.kt") + public void testAbbreviationName() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/AbbreviationName.kt"); + doTest(fileName); + } + + public void testAllFilesPresentInJavaProperties() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("Bases.kt") + public void testBases() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.kt"); + doTest(fileName); + } + + @TestMetadata("CompiledClass.kt") + public void testCompiledClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.kt"); + doTest(fileName); + } + + @TestMetadata("FalseGetters.kt") + public void testFalseGetters() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseGetters.kt"); + doTest(fileName); + } + + @TestMetadata("FalseSetters.kt") + public void testFalseSetters() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseSetters.kt"); + doTest(fileName); + } + + @TestMetadata("FromTwoBases.kt") + public void testFromTwoBases() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FromTwoBases.kt"); + doTest(fileName); + } + + @TestMetadata("GenericClass.kt") + public void testGenericClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GenericClass.kt"); + doTest(fileName); + } + + @TestMetadata("Getter.kt") + public void testGetter() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.kt"); + doTest(fileName); + } + + @TestMetadata("GetterAndSetter.kt") + public void testGetterAndSetter() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/GetterAndSetter.kt"); + doTest(fileName); + } + + @TestMetadata("ImplicitReceiver.kt") + public void testImplicitReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("IsNaming.kt") + public void testIsNaming() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/IsNaming.kt"); + doTest(fileName); + } + + @TestMetadata("JavaOverridesKotlin.kt") + public void testJavaOverridesKotlin() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.kt"); + doTest(fileName); + } + + @TestMetadata("KotlinOverridesJava.kt") + public void testKotlinOverridesJava() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.kt"); + doTest(fileName); + } + + @TestMetadata("KotlinOverridesJava2.kt") + public void testKotlinOverridesJava2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.kt"); + doTest(fileName); + } + + @TestMetadata("KotlinOverridesJava3.kt") + public void testKotlinOverridesJava3() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.kt"); + doTest(fileName); + } + + @TestMetadata("KotlinOverridesJava4.kt") + public void testKotlinOverridesJava4() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.kt"); + doTest(fileName); + } + + @TestMetadata("KotlinOverridesJava5.kt") + public void testKotlinOverridesJava5() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.kt"); + doTest(fileName); + } + + @TestMetadata("OnlyPublic.kt") + public void testOnlyPublic() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.kt"); + doTest(fileName); + } + + @TestMetadata("OverrideGetterOnly.kt") + public void testOverrideGetterOnly() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.kt"); + doTest(fileName); + } + + @TestMetadata("SetterOnly.kt") + public void testSetterOnly() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterOnly.kt"); + doTest(fileName); + } + + @TestMetadata("SmartCast.kt") + public void testSmartCast() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("SmartCastImplicitReceiver.kt") + public void testSmartCastImplicitReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SmartCastImplicitReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("TypeParameterReceiver.kt") + public void testTypeParameterReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeParameterReceiver.kt"); + doTest(fileName); + } } - @TestMetadata("CompiledClass.kt") - public void testCompiledClass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/CompiledClass.kt"); - doTest(fileName); - } + @TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SamAdapters extends AbstractJetDiagnosticsTest { + public void testAllFilesPresentInSamAdapters() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters"), Pattern.compile("^(.+)\\.kt$"), true); + } - @TestMetadata("FalseGetters.kt") - public void testFalseGetters() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/FalseGetters.kt"); - doTest(fileName); - } + @TestMetadata("GenericClass.kt") + public void testGenericClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt"); + doTest(fileName); + } - @TestMetadata("FalseSetters.kt") - public void testFalseSetters() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/FalseSetters.kt"); - doTest(fileName); - } + @TestMetadata("GenericMethod.kt") + public void testGenericMethod() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethod.kt"); + doTest(fileName); + } - @TestMetadata("FromTwoBases.kt") - public void testFromTwoBases() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/FromTwoBases.kt"); - doTest(fileName); - } + @TestMetadata("GenericMethodInGenericClass.kt") + public void testGenericMethodInGenericClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt"); + doTest(fileName); + } - @TestMetadata("GenericClass.kt") - public void testGenericClass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/GenericClass.kt"); - doTest(fileName); - } + @TestMetadata("InnerClassInGeneric.kt") + public void testInnerClassInGeneric() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt"); + doTest(fileName); + } - @TestMetadata("Getter.kt") - public void testGetter() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/Getter.kt"); - doTest(fileName); - } + @TestMetadata("NoNamedArgsAllowed.kt") + public void testNoNamedArgsAllowed() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt"); + doTest(fileName); + } - @TestMetadata("GetterAndSetter.kt") - public void testGetterAndSetter() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/GetterAndSetter.kt"); - doTest(fileName); - } - - @TestMetadata("ImplicitReceiver.kt") - public void testImplicitReceiver() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/ImplicitReceiver.kt"); - doTest(fileName); - } - - @TestMetadata("IsNaming.kt") - public void testIsNaming() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/IsNaming.kt"); - doTest(fileName); - } - - @TestMetadata("JavaOverridesKotlin.kt") - public void testJavaOverridesKotlin() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/JavaOverridesKotlin.kt"); - doTest(fileName); - } - - @TestMetadata("KotlinOverridesJava.kt") - public void testKotlinOverridesJava() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava.kt"); - doTest(fileName); - } - - @TestMetadata("KotlinOverridesJava2.kt") - public void testKotlinOverridesJava2() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava2.kt"); - doTest(fileName); - } - - @TestMetadata("KotlinOverridesJava3.kt") - public void testKotlinOverridesJava3() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava3.kt"); - doTest(fileName); - } - - @TestMetadata("KotlinOverridesJava4.kt") - public void testKotlinOverridesJava4() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava4.kt"); - doTest(fileName); - } - - @TestMetadata("KotlinOverridesJava5.kt") - public void testKotlinOverridesJava5() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/KotlinOverridesJava5.kt"); - doTest(fileName); - } - - @TestMetadata("OnlyPublic.kt") - public void testOnlyPublic() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/OnlyPublic.kt"); - doTest(fileName); - } - - @TestMetadata("OverrideGetterOnly.kt") - public void testOverrideGetterOnly() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/OverrideGetterOnly.kt"); - doTest(fileName); - } - - @TestMetadata("SetterOnly.kt") - public void testSetterOnly() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/SetterOnly.kt"); - doTest(fileName); - } - - @TestMetadata("SmartCast.kt") - public void testSmartCast() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/SmartCast.kt"); - doTest(fileName); - } - - @TestMetadata("SmartCastImplicitReceiver.kt") - public void testSmartCastImplicitReceiver() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/SmartCastImplicitReceiver.kt"); - doTest(fileName); - } - - @TestMetadata("TypeParameterReceiver.kt") - public void testTypeParameterReceiver() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/TypeParameterReceiver.kt"); - doTest(fileName); + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Simple.kt"); + doTest(fileName); + } } } diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaMemberScope.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaMemberScope.kt index 666db4fa196..9647dfa8b7b 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaMemberScope.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaMemberScope.kt @@ -83,7 +83,9 @@ public abstract class LazyJavaMemberScope( for (method in memberIndex().findMethodsByName(name)) { val descriptor = resolveMethodToFunctionDescriptor(method, true) result.add(descriptor) - result.addIfNotNull(c.samConversionResolver.resolveSamAdapter(descriptor)) + if (method.isStatic) { + result.addIfNotNull(c.samConversionResolver.resolveSamAdapter(descriptor)) + } } computeNonDeclaredFunctions(result, name) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt index 0f242b3969a..2dc41418ac1 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt @@ -164,3 +164,9 @@ public fun Annotated.getAnnotationRetention(): KotlinRetention? { }?.getValue() as? EnumValue ?: return null return KotlinRetention.valueOf(retentionArgumentValue.value.name.asString()) } + +public val DeclarationDescriptor.parentsWithSelf: Sequence + get() = sequence(this, { it.containingDeclaration }) + +public val DeclarationDescriptor.parents: Sequence + get() = parentsWithSelf.drop(1) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/DescriptorSubstitutor.java b/core/descriptors/src/org/jetbrains/kotlin/types/DescriptorSubstitutor.java index 4a77ed3ed59..346c1651807 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/DescriptorSubstitutor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/DescriptorSubstitutor.java @@ -41,8 +41,8 @@ public class DescriptorSubstitutor { ) { Map mutableSubstitution = new HashMap(); - Map substitutedMap = - new HashMap(); + Map substitutedMap = new HashMap(); + int index = 0; for (TypeParameterDescriptor descriptor : typeParameters) { TypeParameterDescriptorImpl substituted = TypeParameterDescriptorImpl.createForFurtherModification( newContainingDeclaration, @@ -50,7 +50,7 @@ public class DescriptorSubstitutor { descriptor.isReified(), descriptor.getVariance(), descriptor.getName(), - descriptor.getIndex(), + index++, SourceElement.NO_SOURCE ); substituted.setInitialized(); diff --git a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinPropertyAccessorsReferenceSearcher.kt b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinPropertyAccessorsReferenceSearcher.kt index 5af77fff1c2..8316b0efd52 100644 --- a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinPropertyAccessorsReferenceSearcher.kt +++ b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinPropertyAccessorsReferenceSearcher.kt @@ -29,8 +29,8 @@ import org.jetbrains.kotlin.idea.JetFileType import org.jetbrains.kotlin.idea.caches.resolve.getJavaMethodDescriptor import org.jetbrains.kotlin.psi.JetProperty import org.jetbrains.kotlin.storage.LockBasedStorageManager +import org.jetbrains.kotlin.synthetic.JavaSyntheticPropertiesScope import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor -import org.jetbrains.kotlin.synthetic.JavaSyntheticExtensionsScope public class KotlinPropertyAccessorsReferenceSearcher() : QueryExecutorBase(true) { override fun processQuery(queryParameters: MethodReferencesSearch.SearchParameters, consumer: Processor) { @@ -54,7 +54,7 @@ public class KotlinPropertyAccessorsReferenceSearcher() : QueryExecutorBase