Fix deprecated Kotlin constructs and remove unused code in Android plugins

This commit is contained in:
Yan Zhulanow
2015-03-23 15:27:58 +03:00
parent dd083c64cc
commit 638ec2ae92
5 changed files with 3 additions and 36 deletions
@@ -35,7 +35,7 @@ open class Context(val buffer: StringBuffer = StringBuffer(), private var indent
indentDepth--
if (indentDepth < 0)
throw InvalidIndent(indentDepth)
currentIndent = currentIndent.substring(0, currentIndent.length - indentUnit.length)
currentIndent = currentIndent.substring(0, currentIndent.length() - indentUnit.length())
}
public open fun write(what: String) {
@@ -26,28 +26,6 @@ class KotlinStringWriter : KotlinWriter {
private val imports = ctx.fork()
private val body = ctx.fork()
fun writeFunction(name: String,
args: Collection<String>?,
retType: String,
statements: Collection<String>) {
val returnTerm = if (retType == "" || retType == "Unit") "" else ": $retType"
val argStr = if (args != null) args.join(", ") else ""
body.writeln("fun $name($argStr)$returnTerm {")
body.incIndent()
for (stmt in statements)
body.writeln(stmt)
body.decIndent()
body.writeln("}")
}
fun writeExtensionFunction(receiver: String,
name: String,
args: Collection<String>?,
retType: String,
body: Collection<String>) {
writeFunction("$receiver.$name", args, retType, body)
}
fun writeImmutableProperty(name: String,
retType: String,
getterBody: Collection<String>) {
@@ -63,7 +63,7 @@ public abstract class AbstractAndroidBoxTest : AbstractBlackBoxCodegenTest() {
}
private fun needsInvocationTest(path: String): Boolean {
return !FileUtil.findFilesByMask(Pattern.compile("^0.kt$"), File(path)).empty
return !FileUtil.findFilesByMask(Pattern.compile("^0.kt$"), File(path)).isEmpty()
}
override fun codegenTestBasePath(): String {
@@ -28,10 +28,6 @@ public abstract class AbstractAndroidBytecodeShapeTest : AbstractBytecodeTextTes
return createEnvironmentForConfiguration(JetTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.ANDROID_API), path)
}
private fun createFakeAndroidEnvironment(path: String) {
return createEnvironmentForConfiguration(JetTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK), path)
}
private fun createEnvironmentForConfiguration(configuration: CompilerConfiguration, path: String) {
val resPath = path + "res/layout/"
val manifestPath = path + "../AndroidManifest.xml"