From d14e5b8a727bdad3416ae08314a85275e9082b3b Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 25 May 2015 21:56:48 +0300 Subject: [PATCH] Restore and deprecate Function{n}/ExtensionFunction{n} classes for easier migration Users' Java code will not break in common cases (when passing functions to Kotlin), and deprecation warnings will be reported. Provide an inspection with a quick fix which allows to replace deprecated function class usages to the new classes. Include this fix to the "code cleanup" action --- build.xml | 15 ++- .../java/structure/impl/JavaPackageImpl.kt | 12 ++- .../load/kotlin/KotlinJvmCheckerProvider.kt | 34 ++++++- .../diagnostics/DefaultErrorMessagesJvm.java | 8 +- .../resolve/jvm/diagnostics/ErrorsJvm.java | 2 + .../DeprecatedFunctionClasses.kt | 35 +++++++ .../DeprecatedFunctionClasses.txt | 19 ++++ ...JetDiagnosticsTestWithStdLibGenerated.java | 6 ++ .../DeprecatedFunctionClassFqNameParser.kt | 53 +++++++++++ .../kotlin/load/java/lazy/resolvers.kt | 8 ++ .../src/kotlin/ExtensionFunction0.java | 26 ++++++ .../src/kotlin/ExtensionFunction1.java | 26 ++++++ .../src/kotlin/ExtensionFunction10.java | 26 ++++++ .../src/kotlin/ExtensionFunction11.java | 26 ++++++ .../src/kotlin/ExtensionFunction12.java | 26 ++++++ .../src/kotlin/ExtensionFunction13.java | 26 ++++++ .../src/kotlin/ExtensionFunction14.java | 26 ++++++ .../src/kotlin/ExtensionFunction15.java | 26 ++++++ .../src/kotlin/ExtensionFunction16.java | 26 ++++++ .../src/kotlin/ExtensionFunction17.java | 26 ++++++ .../src/kotlin/ExtensionFunction18.java | 26 ++++++ .../src/kotlin/ExtensionFunction19.java | 26 ++++++ .../src/kotlin/ExtensionFunction2.java | 26 ++++++ .../src/kotlin/ExtensionFunction20.java | 26 ++++++ .../src/kotlin/ExtensionFunction21.java | 26 ++++++ .../src/kotlin/ExtensionFunction3.java | 26 ++++++ .../src/kotlin/ExtensionFunction4.java | 26 ++++++ .../src/kotlin/ExtensionFunction5.java | 26 ++++++ .../src/kotlin/ExtensionFunction6.java | 26 ++++++ .../src/kotlin/ExtensionFunction7.java | 26 ++++++ .../src/kotlin/ExtensionFunction8.java | 26 ++++++ .../src/kotlin/ExtensionFunction9.java | 26 ++++++ .../src/kotlin/Function0.java | 26 ++++++ .../src/kotlin/Function1.java | 26 ++++++ .../src/kotlin/Function10.java | 26 ++++++ .../src/kotlin/Function11.java | 26 ++++++ .../src/kotlin/Function12.java | 26 ++++++ .../src/kotlin/Function13.java | 26 ++++++ .../src/kotlin/Function14.java | 26 ++++++ .../src/kotlin/Function15.java | 26 ++++++ .../src/kotlin/Function16.java | 26 ++++++ .../src/kotlin/Function17.java | 26 ++++++ .../src/kotlin/Function18.java | 26 ++++++ .../src/kotlin/Function19.java | 26 ++++++ .../src/kotlin/Function2.java | 26 ++++++ .../src/kotlin/Function20.java | 26 ++++++ .../src/kotlin/Function21.java | 26 ++++++ .../src/kotlin/Function22.java | 26 ++++++ .../src/kotlin/Function3.java | 26 ++++++ .../src/kotlin/Function4.java | 26 ++++++ .../src/kotlin/Function5.java | 26 ++++++ .../src/kotlin/Function6.java | 26 ++++++ .../src/kotlin/Function7.java | 26 ++++++ .../src/kotlin/Function8.java | 26 ++++++ .../src/kotlin/Function9.java | 26 ++++++ .../builtins/deprecatedJavaFunctions.kt | 43 +++++++++ .../generators/builtins/generateBuiltIns.kt | 11 ++- idea/src/META-INF/plugin.xml | 6 ++ .../inspections/KotlinCleanupInspection.kt | 15 ++- .../ReplaceDeprecatedFunctionClassUsages.kt | 91 +++++++++++++++++++ .../cleanup/DeprecatedFunctionClasses.java | 33 +++++++ .../DeprecatedFunctionClasses.java.after | 32 +++++++ .../KotlinCleanupInspectionTest.kt | 16 +++- libraries/tools/runtime/pom.xml | 1 + 64 files changed, 1596 insertions(+), 14 deletions(-) create mode 100644 compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.txt create mode 100644 core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/DeprecatedFunctionClassFqNameParser.kt create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction0.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction1.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction10.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction11.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction12.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction13.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction14.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction15.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction16.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction17.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction18.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction19.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction2.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction20.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction21.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction3.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction4.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction5.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction6.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction7.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction8.java create mode 100644 core/functions.migration/src/kotlin/ExtensionFunction9.java create mode 100644 core/functions.migration/src/kotlin/Function0.java create mode 100644 core/functions.migration/src/kotlin/Function1.java create mode 100644 core/functions.migration/src/kotlin/Function10.java create mode 100644 core/functions.migration/src/kotlin/Function11.java create mode 100644 core/functions.migration/src/kotlin/Function12.java create mode 100644 core/functions.migration/src/kotlin/Function13.java create mode 100644 core/functions.migration/src/kotlin/Function14.java create mode 100644 core/functions.migration/src/kotlin/Function15.java create mode 100644 core/functions.migration/src/kotlin/Function16.java create mode 100644 core/functions.migration/src/kotlin/Function17.java create mode 100644 core/functions.migration/src/kotlin/Function18.java create mode 100644 core/functions.migration/src/kotlin/Function19.java create mode 100644 core/functions.migration/src/kotlin/Function2.java create mode 100644 core/functions.migration/src/kotlin/Function20.java create mode 100644 core/functions.migration/src/kotlin/Function21.java create mode 100644 core/functions.migration/src/kotlin/Function22.java create mode 100644 core/functions.migration/src/kotlin/Function3.java create mode 100644 core/functions.migration/src/kotlin/Function4.java create mode 100644 core/functions.migration/src/kotlin/Function5.java create mode 100644 core/functions.migration/src/kotlin/Function6.java create mode 100644 core/functions.migration/src/kotlin/Function7.java create mode 100644 core/functions.migration/src/kotlin/Function8.java create mode 100644 core/functions.migration/src/kotlin/Function9.java create mode 100644 generators/src/org/jetbrains/kotlin/generators/builtins/deprecatedJavaFunctions.kt create mode 100644 idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceDeprecatedFunctionClassUsages.kt create mode 100644 idea/testData/inspections/cleanup/DeprecatedFunctionClasses.java create mode 100644 idea/testData/inspections/cleanup/DeprecatedFunctionClasses.java.after diff --git a/build.xml b/build.xml index cb75d671a5b..96fa1343110 100644 --- a/build.xml +++ b/build.xml @@ -666,6 +666,17 @@ + + + + + + + + + + + @@ -736,6 +747,7 @@ + @@ -804,6 +816,7 @@ + @@ -813,7 +826,7 @@ + depends="builtins,functions-migration,stdlib,core,reflection,pack-runtime,pack-runtime-sources"/> (psiPackage), JavaPackage { override fun getClasses(nameFilter: (Name) -> Boolean): Collection { val psiClasses = getPsi().getClasses(scope).filter { val name = it.getName() - name != null && nameFilter(Name.identifier(name)) + name != null && nameFilter(Name.identifier(name)) && it.getQualifiedName()?.let { + // TODO: drop after M12 + !DeprecatedFunctionClassFqNameParser.isDeprecatedFunctionClassFqName(it) + } ?: true } return classes(psiClasses) } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmCheckerProvider.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmCheckerProvider.kt index f14942c099f..ecd7f28db26 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmCheckerProvider.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmCheckerProvider.kt @@ -21,8 +21,14 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.diagnostics.DiagnosticSink import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.lexer.JetTokens +import org.jetbrains.kotlin.load.java.lazy.DeprecatedFunctionClassFqNameParser import org.jetbrains.kotlin.load.java.lazy.types.isMarkedNotNull import org.jetbrains.kotlin.load.java.lazy.types.isMarkedNullable +import org.jetbrains.kotlin.load.java.sources.JavaSourceElement +import org.jetbrains.kotlin.load.java.structure.JavaClass +import org.jetbrains.kotlin.load.java.structure.JavaClassifierType +import org.jetbrains.kotlin.load.java.structure.JavaMethod +import org.jetbrains.kotlin.load.java.structure.JavaType import org.jetbrains.kotlin.load.kotlin.nativeDeclarations.NativeFunChecker import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* @@ -34,8 +40,11 @@ import org.jetbrains.kotlin.resolve.annotations.hasInlineAnnotation import org.jetbrains.kotlin.resolve.annotations.hasIntrinsicAnnotation import org.jetbrains.kotlin.resolve.annotations.hasPlatformStaticAnnotation import org.jetbrains.kotlin.resolve.calls.checkers.AdditionalTypeChecker +import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker +import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext import org.jetbrains.kotlin.resolve.calls.context.CallResolutionContext import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory @@ -51,6 +60,7 @@ import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.expressions.SenselessComparisonChecker import org.jetbrains.kotlin.types.flexibility import org.jetbrains.kotlin.types.isFlexible +import java.util.ArrayList public object KotlinJvmCheckerProvider : AdditionalCheckerProvider( additionalDeclarationCheckers = listOf(PlatformStaticAnnotationChecker(), @@ -60,7 +70,8 @@ public object KotlinJvmCheckerProvider : AdditionalCheckerProvider( OverloadsAnnotationChecker()), additionalCallCheckers = listOf(NeedSyntheticChecker(), JavaAnnotationCallChecker(), - JavaAnnotationMethodCallChecker(), TraitDefaultMethodCallChecker()), + JavaAnnotationMethodCallChecker(), TraitDefaultMethodCallChecker(), + DeprecatedFunctionClassChecker()), additionalTypeCheckers = listOf(JavaNullabilityWarningsChecker()), additionalSymbolUsageValidators = listOf() @@ -322,3 +333,24 @@ public class JavaNullabilityWarningsChecker : AdditionalTypeChecker { } } } + +public class DeprecatedFunctionClassChecker : CallChecker { + override fun check(resolvedCall: ResolvedCall, c: BasicCallResolutionContext) { + val javaMethod = (resolvedCall.getResultingDescriptor().getSource() as? JavaSourceElement)?.javaElement as? JavaMethod ?: return + + val fqNames = ArrayList>(0) + + fun processType(type: JavaType) { + val javaClass = (type as? JavaClassifierType)?.getClassifier() as? JavaClass ?: return + val fqName = javaClass.getFqName()?.asString() ?: return + fqNames.add(DeprecatedFunctionClassFqNameParser.extractOldAndNewFqName(fqName) ?: return) + } + + javaMethod.getValueParameters().forEach { processType(it.getType()) } + javaMethod.getReturnType()?.let { processType(it) } + + for ((oldFqName, newFqName) in fqNames) { + c.trace.report(ErrorsJvm.JAVA_METHOD_USES_DEPRECATED_FUNCTION_CLASS.on(c.call.getCallElement(), oldFqName, newFqName)) + } + } +} diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index dc932a06aa7..a501cc06841 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -60,7 +60,8 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(ErrorsJvm.JAVA_LANG_CLASS_ARGUMENT_IN_ANNOTATION, "Usage of `javaClass()` in annotations is deprecated. Use T::class instead"); MAP.put(ErrorsJvm.DEPRECATED_ANNOTATION_METHOD_CALL, "Annotation methods are deprecated. Use property instead"); - MAP.put(ErrorsJvm.NO_REFLECTION_IN_CLASS_PATH, "Expression ''{0}'' uses reflection which is not found in compilation classpath. Make sure you have kotlin-reflect.jar in the classpath", Renderers.ELEMENT_TEXT); + MAP.put(ErrorsJvm.NO_REFLECTION_IN_CLASS_PATH, "Expression ''{0}'' uses reflection which is not found in compilation classpath. " + + "Make sure you have kotlin-reflect.jar in the classpath", Renderers.ELEMENT_TEXT); MAP.put(ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, "Expected type does not accept nulls in {0}, but the value may be null in {1}", Renderers.TO_STRING, Renderers.TO_STRING); @@ -68,8 +69,11 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(ErrorsJvm.TRAIT_CANT_CALL_DEFAULT_METHOD_VIA_SUPER, "Interfaces can't call Java default methods via super"); MAP.put(ErrorsJvm.WHEN_ENUM_CAN_BE_NULL_IN_JAVA, "Enum argument ''{0}'' can be null in Java, but exhaustive when contains no null branch"); - } + MAP.put(ErrorsJvm.JAVA_METHOD_USES_DEPRECATED_FUNCTION_CLASS, + "This Java method uses the deprecated {0} class, which will be removed soon. " + + "Please change the signature to use the new {1} class instead", Renderers.TO_STRING, Renderers.TO_STRING); + } @NotNull @Override diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index ec66ca22976..1a2f34c6e6a 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -57,6 +57,8 @@ public interface ErrorsJvm { DiagnosticFactory0 TRAIT_CANT_CALL_DEFAULT_METHOD_VIA_SUPER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory2 JAVA_METHOD_USES_DEPRECATED_FUNCTION_CLASS = DiagnosticFactory2.create(ERROR); + // TODO: make this a warning DiagnosticFactory1 NO_REFLECTION_IN_CLASS_PATH = DiagnosticFactory1.create(ERROR); diff --git a/compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.kt b/compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.kt new file mode 100644 index 00000000000..58725780825 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.kt @@ -0,0 +1,35 @@ +// FILE: J.java + +import kotlin.ExtensionFunction0; +import kotlin.ExtensionFunction1; +import kotlin.Function0; +import kotlin.Function1; +import kotlin.Unit; + +public class J { + public static void f1(Function0 f) { + f.invoke(); + } + + public static void f2(Function1 f) { + f.invoke(""); + } + + public static void ef1(ExtensionFunction1 ef) { + ef.invoke(42, -42); + } + + public static ExtensionFunction0 ef2() { + return null; + } +} + +// FILE: K.kt + +fun foo() = J.f1 { } + +fun bar() = J.f2 { it } + +fun baz() = J.ef1 { this } + +fun quux() = J.ef2() diff --git a/compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.txt b/compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.txt new file mode 100644 index 00000000000..9eb47801260 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.txt @@ -0,0 +1,19 @@ +package + +internal fun bar(): kotlin.Unit +internal fun baz(): kotlin.Unit +internal fun foo(): kotlin.Unit +internal fun quux(): kotlin.ExtensionFunction0! + +public open class J { + public constructor J() + 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 + + // Static members + public open fun ef1(/*0*/ ef: kotlin.ExtensionFunction1!): kotlin.Unit + public open fun ef2(): kotlin.ExtensionFunction0! + public open fun f1(/*0*/ f: (() -> kotlin.Unit!)!): kotlin.Unit + public open fun f2(/*0*/ f: ((kotlin.String!) -> kotlin.String!)!): kotlin.Unit +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java index 60be0d73c8a..28333b5357f 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java @@ -35,6 +35,12 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("DeprecatedFunctionClasses.kt") + public void testDeprecatedFunctionClasses() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/DeprecatedFunctionClasses.kt"); + doTest(fileName); + } + @TestMetadata("instar.kt") public void testInstar() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/instar.kt"); diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/DeprecatedFunctionClassFqNameParser.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/DeprecatedFunctionClassFqNameParser.kt new file mode 100644 index 00000000000..26d255727ab --- /dev/null +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/DeprecatedFunctionClassFqNameParser.kt @@ -0,0 +1,53 @@ +/* + * 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.load.java.lazy + +public object DeprecatedFunctionClassFqNameParser { + /** + * Checks that the given FQ name denotes some deprecated function class and returns the old and the new FQ name of the class + * in case it does, or null otherwise, e.g.: + * "kotlin.Function1" -> ("kotlin.Function1", "kotlin.jvm.functions.Function1") + * "kotlin.ExtensionFunction1" -> ("kotlin.ExtensionFunction1", "kotlin.jvm.functions.Function2") + * "kotlin.jvm.functions.Function1" -> null + */ + public fun extractOldAndNewFqName(fqName: String): Pair? { + val arity = fqName.removePrefix("kotlin.Function") + if (arity != fqName && arity.isInt()) { + return Pair(fqName, "kotlin.jvm.functions.Function$arity") + } + + val extensionArity = fqName.removePrefix("kotlin.ExtensionFunction") + if (extensionArity != fqName && extensionArity.isInt()) { + return Pair(fqName, "kotlin.jvm.functions.Function${extensionArity.toInt() + 1}") + } + + return null + } + + public fun isDeprecatedFunctionClassFqName(fqName: String): Boolean { + return extractOldAndNewFqName(fqName) != null + } + + private fun String.isInt() = + try { + toInt() + true + } + catch (e: NumberFormatException) { + false + } +} diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/resolvers.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/resolvers.kt index e177aaae1ac..7b19133b7bc 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/resolvers.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/resolvers.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.load.java.lazy +import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor @@ -76,6 +77,13 @@ fun LazyJavaResolverContext.findClassInJava(classId: ClassId): JavaClassLookupRe val binaryClassResult = resolveBinaryClass(kotlinClass) if (binaryClassResult != null) return binaryClassResult + if (!classId.isLocal() && !classId.isNestedClass() && + DeprecatedFunctionClassFqNameParser.isDeprecatedFunctionClassFqName(classId.asSingleFqName().asString())) { + // Ignore deprecated kotlin.Function{n} / kotlin.ExtensionFunction{n} Java classes + // TODO: drop after M12 + return JavaClassLookupResult.EMPTY + } + val javaClass = finder.findClass(classId) if (javaClass != null) return JavaClassLookupResult(javaClass) diff --git a/core/functions.migration/src/kotlin/ExtensionFunction0.java b/core/functions.migration/src/kotlin/ExtensionFunction0.java new file mode 100644 index 00000000000..0ede4aac681 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction0.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction0 extends kotlin.jvm.functions.Function1 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction1.java b/core/functions.migration/src/kotlin/ExtensionFunction1.java new file mode 100644 index 00000000000..f070964fc7f --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction1.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction1 extends kotlin.jvm.functions.Function2 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction10.java b/core/functions.migration/src/kotlin/ExtensionFunction10.java new file mode 100644 index 00000000000..9d5b6841448 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction10.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction10 extends kotlin.jvm.functions.Function11 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction11.java b/core/functions.migration/src/kotlin/ExtensionFunction11.java new file mode 100644 index 00000000000..6f5a4c7fb70 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction11.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction11 extends kotlin.jvm.functions.Function12 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction12.java b/core/functions.migration/src/kotlin/ExtensionFunction12.java new file mode 100644 index 00000000000..74c60f1fba1 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction12.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction12 extends kotlin.jvm.functions.Function13 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction13.java b/core/functions.migration/src/kotlin/ExtensionFunction13.java new file mode 100644 index 00000000000..34803fac2c5 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction13.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction13 extends kotlin.jvm.functions.Function14 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction14.java b/core/functions.migration/src/kotlin/ExtensionFunction14.java new file mode 100644 index 00000000000..3bef63f4b56 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction14.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction14 extends kotlin.jvm.functions.Function15 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction15.java b/core/functions.migration/src/kotlin/ExtensionFunction15.java new file mode 100644 index 00000000000..a13a34e6844 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction15.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction15 extends kotlin.jvm.functions.Function16 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction16.java b/core/functions.migration/src/kotlin/ExtensionFunction16.java new file mode 100644 index 00000000000..674af8bd4a0 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction16.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction16 extends kotlin.jvm.functions.Function17 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction17.java b/core/functions.migration/src/kotlin/ExtensionFunction17.java new file mode 100644 index 00000000000..d07cfdbf788 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction17.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction17 extends kotlin.jvm.functions.Function18 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction18.java b/core/functions.migration/src/kotlin/ExtensionFunction18.java new file mode 100644 index 00000000000..a1a0f745b5f --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction18.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction18 extends kotlin.jvm.functions.Function19 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction19.java b/core/functions.migration/src/kotlin/ExtensionFunction19.java new file mode 100644 index 00000000000..ca4221473c6 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction19.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction19 extends kotlin.jvm.functions.Function20 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction2.java b/core/functions.migration/src/kotlin/ExtensionFunction2.java new file mode 100644 index 00000000000..51e77283f05 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction2.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction2 extends kotlin.jvm.functions.Function3 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction20.java b/core/functions.migration/src/kotlin/ExtensionFunction20.java new file mode 100644 index 00000000000..c3471422277 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction20.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction20 extends kotlin.jvm.functions.Function21 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction21.java b/core/functions.migration/src/kotlin/ExtensionFunction21.java new file mode 100644 index 00000000000..540e685f1a3 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction21.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction21 extends kotlin.jvm.functions.Function22 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction3.java b/core/functions.migration/src/kotlin/ExtensionFunction3.java new file mode 100644 index 00000000000..33eabc18fd5 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction3.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction3 extends kotlin.jvm.functions.Function4 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction4.java b/core/functions.migration/src/kotlin/ExtensionFunction4.java new file mode 100644 index 00000000000..7f394b69bf2 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction4.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction4 extends kotlin.jvm.functions.Function5 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction5.java b/core/functions.migration/src/kotlin/ExtensionFunction5.java new file mode 100644 index 00000000000..8c68fd0c632 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction5.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction5 extends kotlin.jvm.functions.Function6 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction6.java b/core/functions.migration/src/kotlin/ExtensionFunction6.java new file mode 100644 index 00000000000..97bf91d6874 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction6.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction6 extends kotlin.jvm.functions.Function7 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction7.java b/core/functions.migration/src/kotlin/ExtensionFunction7.java new file mode 100644 index 00000000000..40fb0b621ac --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction7.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction7 extends kotlin.jvm.functions.Function8 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction8.java b/core/functions.migration/src/kotlin/ExtensionFunction8.java new file mode 100644 index 00000000000..31baf904bb6 --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction8.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction8 extends kotlin.jvm.functions.Function9 { +} diff --git a/core/functions.migration/src/kotlin/ExtensionFunction9.java b/core/functions.migration/src/kotlin/ExtensionFunction9.java new file mode 100644 index 00000000000..5df1b733a2f --- /dev/null +++ b/core/functions.migration/src/kotlin/ExtensionFunction9.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface ExtensionFunction9 extends kotlin.jvm.functions.Function10 { +} diff --git a/core/functions.migration/src/kotlin/Function0.java b/core/functions.migration/src/kotlin/Function0.java new file mode 100644 index 00000000000..1c4207f2b9d --- /dev/null +++ b/core/functions.migration/src/kotlin/Function0.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function0 extends kotlin.jvm.functions.Function0 { +} diff --git a/core/functions.migration/src/kotlin/Function1.java b/core/functions.migration/src/kotlin/Function1.java new file mode 100644 index 00000000000..db4f342e723 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function1.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function1 extends kotlin.jvm.functions.Function1 { +} diff --git a/core/functions.migration/src/kotlin/Function10.java b/core/functions.migration/src/kotlin/Function10.java new file mode 100644 index 00000000000..50eff7a96e2 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function10.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function10 extends kotlin.jvm.functions.Function10 { +} diff --git a/core/functions.migration/src/kotlin/Function11.java b/core/functions.migration/src/kotlin/Function11.java new file mode 100644 index 00000000000..3b2ed2d62ac --- /dev/null +++ b/core/functions.migration/src/kotlin/Function11.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function11 extends kotlin.jvm.functions.Function11 { +} diff --git a/core/functions.migration/src/kotlin/Function12.java b/core/functions.migration/src/kotlin/Function12.java new file mode 100644 index 00000000000..ca94dfea2df --- /dev/null +++ b/core/functions.migration/src/kotlin/Function12.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function12 extends kotlin.jvm.functions.Function12 { +} diff --git a/core/functions.migration/src/kotlin/Function13.java b/core/functions.migration/src/kotlin/Function13.java new file mode 100644 index 00000000000..6aabf40753e --- /dev/null +++ b/core/functions.migration/src/kotlin/Function13.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function13 extends kotlin.jvm.functions.Function13 { +} diff --git a/core/functions.migration/src/kotlin/Function14.java b/core/functions.migration/src/kotlin/Function14.java new file mode 100644 index 00000000000..06c73088b12 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function14.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function14 extends kotlin.jvm.functions.Function14 { +} diff --git a/core/functions.migration/src/kotlin/Function15.java b/core/functions.migration/src/kotlin/Function15.java new file mode 100644 index 00000000000..f87a808d948 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function15.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function15 extends kotlin.jvm.functions.Function15 { +} diff --git a/core/functions.migration/src/kotlin/Function16.java b/core/functions.migration/src/kotlin/Function16.java new file mode 100644 index 00000000000..80bddb22654 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function16.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function16 extends kotlin.jvm.functions.Function16 { +} diff --git a/core/functions.migration/src/kotlin/Function17.java b/core/functions.migration/src/kotlin/Function17.java new file mode 100644 index 00000000000..84db4f50384 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function17.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function17 extends kotlin.jvm.functions.Function17 { +} diff --git a/core/functions.migration/src/kotlin/Function18.java b/core/functions.migration/src/kotlin/Function18.java new file mode 100644 index 00000000000..1167fbeaf0b --- /dev/null +++ b/core/functions.migration/src/kotlin/Function18.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function18 extends kotlin.jvm.functions.Function18 { +} diff --git a/core/functions.migration/src/kotlin/Function19.java b/core/functions.migration/src/kotlin/Function19.java new file mode 100644 index 00000000000..5103ce96579 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function19.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function19 extends kotlin.jvm.functions.Function19 { +} diff --git a/core/functions.migration/src/kotlin/Function2.java b/core/functions.migration/src/kotlin/Function2.java new file mode 100644 index 00000000000..731d0633019 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function2.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function2 extends kotlin.jvm.functions.Function2 { +} diff --git a/core/functions.migration/src/kotlin/Function20.java b/core/functions.migration/src/kotlin/Function20.java new file mode 100644 index 00000000000..f834a43f0cc --- /dev/null +++ b/core/functions.migration/src/kotlin/Function20.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function20 extends kotlin.jvm.functions.Function20 { +} diff --git a/core/functions.migration/src/kotlin/Function21.java b/core/functions.migration/src/kotlin/Function21.java new file mode 100644 index 00000000000..dfad50b521f --- /dev/null +++ b/core/functions.migration/src/kotlin/Function21.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function21 extends kotlin.jvm.functions.Function21 { +} diff --git a/core/functions.migration/src/kotlin/Function22.java b/core/functions.migration/src/kotlin/Function22.java new file mode 100644 index 00000000000..7ce9d8b4144 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function22.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function22 extends kotlin.jvm.functions.Function22 { +} diff --git a/core/functions.migration/src/kotlin/Function3.java b/core/functions.migration/src/kotlin/Function3.java new file mode 100644 index 00000000000..4716734d9cd --- /dev/null +++ b/core/functions.migration/src/kotlin/Function3.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function3 extends kotlin.jvm.functions.Function3 { +} diff --git a/core/functions.migration/src/kotlin/Function4.java b/core/functions.migration/src/kotlin/Function4.java new file mode 100644 index 00000000000..a231e78c9b8 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function4.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function4 extends kotlin.jvm.functions.Function4 { +} diff --git a/core/functions.migration/src/kotlin/Function5.java b/core/functions.migration/src/kotlin/Function5.java new file mode 100644 index 00000000000..1dacf2c7493 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function5.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function5 extends kotlin.jvm.functions.Function5 { +} diff --git a/core/functions.migration/src/kotlin/Function6.java b/core/functions.migration/src/kotlin/Function6.java new file mode 100644 index 00000000000..6526cda8cae --- /dev/null +++ b/core/functions.migration/src/kotlin/Function6.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function6 extends kotlin.jvm.functions.Function6 { +} diff --git a/core/functions.migration/src/kotlin/Function7.java b/core/functions.migration/src/kotlin/Function7.java new file mode 100644 index 00000000000..7c745bd22fb --- /dev/null +++ b/core/functions.migration/src/kotlin/Function7.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function7 extends kotlin.jvm.functions.Function7 { +} diff --git a/core/functions.migration/src/kotlin/Function8.java b/core/functions.migration/src/kotlin/Function8.java new file mode 100644 index 00000000000..ef5e17283a5 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function8.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function8 extends kotlin.jvm.functions.Function8 { +} diff --git a/core/functions.migration/src/kotlin/Function9.java b/core/functions.migration/src/kotlin/Function9.java new file mode 100644 index 00000000000..049f50ed7f2 --- /dev/null +++ b/core/functions.migration/src/kotlin/Function9.java @@ -0,0 +1,26 @@ +/* + * 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. + */ + +// Auto-generated file. DO NOT EDIT! + +package kotlin; + +/** + * @deprecated Use the new function classes from the package kotlin.jvm.functions. + */ +@Deprecated +public interface Function9 extends kotlin.jvm.functions.Function9 { +} diff --git a/generators/src/org/jetbrains/kotlin/generators/builtins/deprecatedJavaFunctions.kt b/generators/src/org/jetbrains/kotlin/generators/builtins/deprecatedJavaFunctions.kt new file mode 100644 index 00000000000..a8ccd0cce1d --- /dev/null +++ b/generators/src/org/jetbrains/kotlin/generators/builtins/deprecatedJavaFunctions.kt @@ -0,0 +1,43 @@ +/* + * 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.generators.builtins + +import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsSourceGenerator +import java.io.PrintWriter + +class GenerateDeprecatedJavaFunction( + out: PrintWriter, + private val arity: Int, + private val extension: Boolean +) : BuiltInsSourceGenerator(out) { + override val language = BuiltInsSourceGenerator.Language.JAVA + + override fun generateBody() { + val params = (1..arity).map { "P$it" } + val generics = "<" + ((if (extension) listOf("E") else listOf()) + params + listOf("R")).join() + ">" + + val name = if (extension) "ExtensionFunction" else "Function" + val superArity = if (extension) arity + 1 else arity + + out.println("/**") + out.println(" * @deprecated Use the new function classes from the package kotlin.jvm.functions.") + out.println(" */") + out.println("@Deprecated") + out.println("public interface $name$arity$generics extends kotlin.jvm.functions.Function$superArity$generics {") + out.println("}") + } +} diff --git a/generators/src/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt b/generators/src/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt index b34f6c8ad41..935595c835f 100644 --- a/generators/src/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt +++ b/generators/src/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.generators.builtins.generateBuiltIns +import org.jetbrains.kotlin.generators.builtins.GenerateDeprecatedJavaFunction import org.jetbrains.kotlin.generators.builtins.arrayIterators.GenerateArrayIterators import org.jetbrains.kotlin.generators.builtins.arrays.GenerateArrays import org.jetbrains.kotlin.generators.builtins.functionImpl.GenerateFunctionImpl @@ -34,6 +35,7 @@ fun assertExists(file: File): Unit = val BUILT_INS_NATIVE_DIR = File("core/builtins/native/") val BUILT_INS_SRC_DIR = File("core/builtins/src/") val RUNTIME_JVM_DIR = File("core/runtime.jvm/src/") +val FUNCTIONS_MIGRATION_DIR = File("core/functions.migration/src/") abstract class BuiltInsSourceGenerator(val out: PrintWriter) { protected abstract fun generateBody(): Unit @@ -43,7 +45,7 @@ abstract class BuiltInsSourceGenerator(val out: PrintWriter) { protected open val language: Language = Language.KOTLIN enum class Language { - KOTLIN + KOTLIN, JAVA } @@ -75,6 +77,13 @@ fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsSourceGenerator) generate(File(BUILT_INS_SRC_DIR, "kotlin/ProgressionIterators.kt")) { GenerateProgressionIterators(it) } generate(File(BUILT_INS_SRC_DIR, "kotlin/Progressions.kt")) { GenerateProgressions(it) } generate(File(BUILT_INS_SRC_DIR, "kotlin/Ranges.kt")) { GenerateRanges(it) } + + for (i in 0..22) { + generate(File(FUNCTIONS_MIGRATION_DIR, "kotlin/Function$i.java")) { GenerateDeprecatedJavaFunction(it, i, false) } + } + for (i in 0..21) { + generate(File(FUNCTIONS_MIGRATION_DIR, "kotlin/ExtensionFunction$i.java")) { GenerateDeprecatedJavaFunction(it, i, true) } + } } fun main(args: Array) { diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index a32bd223686..e44d891983b 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -1027,6 +1027,12 @@ cleanupTool="true" level="WARNING"/> + + diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt index e236cfad60c..d3e0495459c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt @@ -20,6 +20,7 @@ import com.intellij.codeInspection.* import com.intellij.openapi.progress.ProcessCanceledException import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile +import com.intellij.psi.PsiJavaFile import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages @@ -39,9 +40,17 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe override fun getDisplayName(): String = "Usage of redundant or deprecated syntax" override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array? { - if (isOnTheFly || file !is JetFile || !ProjectRootsUtil.isInProjectSource(file)) { + if (isOnTheFly || !ProjectRootsUtil.isInProjectSource(file)) { return null } + return when (file) { + is JetFile -> checkKotlinFile(file, manager) + is PsiJavaFile -> checkJavaFile(file, manager) + else -> null + } + } + + private fun checkKotlinFile(file: JetFile, manager: InspectionManager): Array? { val analysisResult = file.analyzeFullyAndGetResult() if (analysisResult.isError()) { throw ProcessCanceledException(analysisResult.error) @@ -61,6 +70,10 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe return problemDescriptors.toTypedArray() } + private fun checkJavaFile(file: PsiJavaFile, manager: InspectionManager): Array? { + return ReplaceDeprecatedFunctionClassUsages().checkFile(file, manager)?.let { arrayOf(it) } + } + private fun Diagnostic.isCleanup() = getFactory() in cleanupDiagnosticsFactories || isObsoleteLabel() private val cleanupDiagnosticsFactories = setOf( diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceDeprecatedFunctionClassUsages.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceDeprecatedFunctionClassUsages.kt new file mode 100644 index 00000000000..3d4ecff3341 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceDeprecatedFunctionClassUsages.kt @@ -0,0 +1,91 @@ +/* + * 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.idea.inspections + +import com.intellij.codeInspection.* +import com.intellij.openapi.project.Project +import com.intellij.psi.* +import com.intellij.psi.codeStyle.JavaCodeStyleManager +import com.intellij.psi.impl.compiled.ClsClassImpl +import org.jetbrains.kotlin.idea.util.ProjectRootsUtil +import org.jetbrains.kotlin.load.java.lazy.DeprecatedFunctionClassFqNameParser +import java.util.ArrayList + +public class ReplaceDeprecatedFunctionClassUsages : LocalInspectionTool() { + override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array? { + if (isOnTheFly || !ProjectRootsUtil.isInProjectSource(file) || file !is PsiJavaFile) { + return null + } + return checkFile(file, manager)?.let { arrayOf(it) } + } + + public fun checkFile(file: PsiJavaFile, manager: InspectionManager): ProblemDescriptor? { + val references = ArrayList(0) + + file.acceptChildren(object : JavaRecursiveElementVisitor() { + override fun visitReferenceElement(reference: PsiJavaCodeReferenceElement) { + if ("Function" in reference.getText() && extractFunctionClassFqName(reference) != null) { + references.add(reference) + } + + super.visitElement(reference) + } + + override fun visitImportList(list: PsiImportList?) { + // Skip import list for simplicity, update all other references instead and invoke "Optimize Imports" + } + }) + + return if (references.isEmpty()) null else manager.createProblemDescriptor( + file, MESSAGE, false, arrayOf(Fix(references)), ProblemHighlightType.GENERIC_ERROR_OR_WARNING + ) + } + + private class Fix(val references: List) : LocalQuickFix { + override fun getName() = MESSAGE + override fun getFamilyName() = MESSAGE + + override fun applyFix(project: Project, problem: ProblemDescriptor) { + val psiFacade = JavaPsiFacade.getInstance(project) + val codeStyleManager = JavaCodeStyleManager.getInstance(project) + + val newReferences = ArrayList(references.size()) + for (reference in references) { + val newFqName = extractFunctionClassFqName(reference) ?: continue + val newClass = psiFacade.findClass(newFqName, reference.getResolveScope()) + if (newClass != null) { + newReferences.add(reference.bindToElement(newClass)) + } + } + + codeStyleManager.optimizeImports(problem.getPsiElement().getContainingFile()) + + for (reference in newReferences) { + codeStyleManager.shortenClassReferences(reference) + } + } + } + + companion object { + val MESSAGE = "Replace usages of deprecated Kotlin function classes in Java sources" + + fun extractFunctionClassFqName(reference: PsiReference): String? { + val fqName = (reference.resolve() as? ClsClassImpl)?.getQualifiedName() ?: return null + return DeprecatedFunctionClassFqNameParser.extractOldAndNewFqName(fqName)?.second + } + } +} diff --git a/idea/testData/inspections/cleanup/DeprecatedFunctionClasses.java b/idea/testData/inspections/cleanup/DeprecatedFunctionClasses.java new file mode 100644 index 00000000000..5abacb6b974 --- /dev/null +++ b/idea/testData/inspections/cleanup/DeprecatedFunctionClasses.java @@ -0,0 +1,33 @@ +import kotlin.Function0; +import kotlin.Function1; +import kotlin.KotlinPackage; +import kotlin.ExtensionFunction0; +import kotlin.Unit; +import kotlin.jvm.functions.Function2; + +public class DeprecatedFunctionClasses { + void f1(Function0 f) { + f.invoke(); + } + + void f2() { + KotlinPackage.map(new int[]{}, new Function1() { + @Override + public Object invoke(Integer integer) { + return null; + } + }); + } + + void f3(Function2 f) { + } + + void f4(kotlin.Function0 g) { + } + + void f5(kotlin.jvm.functions.Function1 f) { + } + + void f6(ExtensionFunction0 e) { + } +} diff --git a/idea/testData/inspections/cleanup/DeprecatedFunctionClasses.java.after b/idea/testData/inspections/cleanup/DeprecatedFunctionClasses.java.after new file mode 100644 index 00000000000..e9a93327c08 --- /dev/null +++ b/idea/testData/inspections/cleanup/DeprecatedFunctionClasses.java.after @@ -0,0 +1,32 @@ +import kotlin.KotlinPackage; +import kotlin.Unit; +import kotlin.jvm.functions.Function0; +import kotlin.jvm.functions.Function1; +import kotlin.jvm.functions.Function2; + +public class DeprecatedFunctionClasses { + void f1(Function0 f) { + f.invoke(); + } + + void f2() { + KotlinPackage.map(new int[]{}, new Function1() { + @Override + public Object invoke(Integer integer) { + return null; + } + }); + } + + void f3(Function2 f) { + } + + void f4(Function0 g) { + } + + void f5(kotlin.jvm.functions.Function1 f) { + } + + void f6(Function1 e) { + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspectionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspectionTest.kt index bad28259b7d..1cce2b66e24 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspectionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspectionTest.kt @@ -31,9 +31,9 @@ class KotlinCleanupInspectionTest(): JetLightCodeInsightFixtureTestCase() { override fun getProjectDescriptor(): LightProjectDescriptor = JetWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - public fun testCleanup() { + private fun doTest(result: String, vararg files: String) { myFixture.enableInspections(javaClass()) - myFixture.configureByFiles("cleanup.kt", "JavaAnn.java") + myFixture.configureByFiles(*files) val project = myFixture.getProject() val managerEx = InspectionManager.getInstance(project) @@ -42,6 +42,14 @@ class KotlinCleanupInspectionTest(): JetLightCodeInsightFixtureTestCase() { val profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile() globalContext.codeCleanup(project, analysisScope, profile, "Cleanup", null, true) - myFixture.checkResultByFile("cleanup.kt.after") + myFixture.checkResultByFile(result) } -} \ No newline at end of file + + public fun testCleanup() { + doTest("cleanup.kt.after", "cleanup.kt", "JavaAnn.java") + } + + public fun testDeprecatedFunctionClasses() { + doTest("DeprecatedFunctionClasses.java.after", "DeprecatedFunctionClasses.java") + } +} diff --git a/libraries/tools/runtime/pom.xml b/libraries/tools/runtime/pom.xml index 90537f85832..0ca3b677ed0 100644 --- a/libraries/tools/runtime/pom.xml +++ b/libraries/tools/runtime/pom.xml @@ -46,6 +46,7 @@ +