Finish off old deprecated function/extension function classes
This reverts commit d14e5b8a72.
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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("}")
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
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
|
||||
@@ -35,7 +34,6 @@ 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
|
||||
@@ -45,7 +43,7 @@ abstract class BuiltInsSourceGenerator(val out: PrintWriter) {
|
||||
protected open val language: Language = Language.KOTLIN
|
||||
|
||||
enum class Language {
|
||||
KOTLIN,
|
||||
KOTLIN
|
||||
JAVA
|
||||
}
|
||||
|
||||
@@ -77,13 +75,6 @@ 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<String>) {
|
||||
|
||||
Reference in New Issue
Block a user