diff --git a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/AndroidXmlHandler.kt b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/AndroidXmlHandler.kt index fad9efbc8a7..85f0208226c 100644 --- a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/AndroidXmlHandler.kt +++ b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/AndroidXmlHandler.kt @@ -23,11 +23,11 @@ import java.util.HashMap class AndroidXmlHandler(private val elementCallback: (String, String) -> Unit) : DefaultHandler() { override fun startDocument() { - super.startDocument() + super.startDocument() } override fun endDocument() { - super.endDocument() + super.endDocument() } override fun startElement(uri: String, localName: String, qName: String, attributes: Attributes) { @@ -47,7 +47,7 @@ class AndroidXmlHandler(private val elementCallback: (String, String) -> Unit) : public fun Attributes.toMap(): HashMap { val res = HashMap() - for (index in 0..getLength() - 1) { + for (index in 0..length - 1) { val attrName = getLocalName(index)!! val attrVal = getValue(index)!! res[attrName] = attrVal diff --git a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/Context.kt b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/Context.kt index adf0a8ecd50..45845560db5 100644 --- a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/Context.kt +++ b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/Context.kt @@ -67,12 +67,6 @@ open class Context(val buffer: StringBuffer = StringBuffer(), private var indent return child } - public fun adopt(c: T, inheritIndent: Boolean = true): T { - children.add(c) - if (inheritIndent) c.currentIndent = currentIndent - return c - } - public fun absorbChildren(noIndent: Boolean = true) { for (child in children) { child.absorbChildren() diff --git a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt index 0956656a1a5..3636d54ccf9 100644 --- a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt +++ b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt @@ -45,7 +45,7 @@ public class AndroidOnDestroyClassBuilderInterceptorExtension : ClassBuilderInte return AndroidOnDestroyCollectorClassBuilder(delegateFactory.newClassBuilder(origin), bindingContext) } - override fun getClassBuilderMode() = delegateFactory.getClassBuilderMode() + override fun getClassBuilderMode() = delegateFactory.classBuilderMode override fun asText(builder: ClassBuilder?): String? { return delegateFactory.asText((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) diff --git a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/diagnostic/AndroidExtensionPropertiesCallChecked.kt b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/diagnostic/AndroidExtensionPropertiesCallChecked.kt index 341534bdc44..4dfe6216892 100644 --- a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/diagnostic/AndroidExtensionPropertiesCallChecked.kt +++ b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/diagnostic/AndroidExtensionPropertiesCallChecked.kt @@ -16,9 +16,7 @@ package org.jetbrains.kotlin.android.synthetic.diagnostic -import com.intellij.openapi.project.Project import org.jetbrains.kotlin.android.synthetic.AndroidConst -import org.jetbrains.kotlin.android.synthetic.CliAndroidDeclarationsProvider import org.jetbrains.kotlin.android.synthetic.res.SyntheticFileGenerator import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker @@ -26,7 +24,6 @@ import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.constants.StringValue import org.jetbrains.kotlin.android.synthetic.diagnostic.ErrorsAndroid.* -import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider public class AndroidExtensionPropertiesCallChecker : CallChecker { override fun check(resolvedCall: ResolvedCall, context: BasicCallResolutionContext) { diff --git a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/res/AndroidLayoutXmlFileManager.kt b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/res/AndroidLayoutXmlFileManager.kt index fb95ef87657..bda004db6f4 100644 --- a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/res/AndroidLayoutXmlFileManager.kt +++ b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/res/AndroidLayoutXmlFileManager.kt @@ -65,17 +65,17 @@ public abstract class AndroidLayoutXmlFileManager(val project: Project) { list } - val layoutNameToXmls = allLayoutPsiFiles + val layoutNameToXmlFiles = allLayoutPsiFiles .groupBy { it.name.substringBeforeLast('.') } .mapValues { it.getValue().sortedBy { it.parent!!.name.length() } } - return layoutNameToXmls + return layoutNameToXmlFiles } companion object { - public fun getInstance(module: Module): AndroidLayoutXmlFileManager { - val service = ModuleServiceManager.getService(module, javaClass()) - return service ?: module.getComponent(javaClass())!! + public fun getInstance(module: Module): AndroidLayoutXmlFileManager? { + val service = ModuleServiceManager.getService(module, AndroidLayoutXmlFileManager::class.java) + return service ?: module.getComponent(AndroidLayoutXmlFileManager::class.java) } } diff --git a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/res/CliSyntheticFileGenerator.kt b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/res/CliSyntheticFileGenerator.kt index 5bc17da480a..d0b2b05fea1 100644 --- a/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/res/CliSyntheticFileGenerator.kt +++ b/plugins/android-compiler-plugin/src/org/jetbrains/kotlin/android/synthetic/res/CliSyntheticFileGenerator.kt @@ -85,7 +85,7 @@ public open class CliSyntheticFileGenerator( } private companion object { - private val LOG: Logger = Logger.getInstance(javaClass) + private val LOG: Logger = Logger.getInstance(CliSyntheticFileGenerator::class.java) } } diff --git a/plugins/android-compiler-plugin/tests/org/jetbrains/kotlin/lang/resolve/android/test/AbstractAndroidBoxTest.kt b/plugins/android-compiler-plugin/tests/org/jetbrains/kotlin/lang/resolve/android/test/AbstractAndroidBoxTest.kt index ec02d07fd05..90f8e4582f5 100644 --- a/plugins/android-compiler-plugin/tests/org/jetbrains/kotlin/lang/resolve/android/test/AbstractAndroidBoxTest.kt +++ b/plugins/android-compiler-plugin/tests/org/jetbrains/kotlin/lang/resolve/android/test/AbstractAndroidBoxTest.kt @@ -41,7 +41,7 @@ public abstract class AbstractAndroidBoxTest : AbstractBlackBoxCodegenTest() { } private fun createEnvironmentForConfiguration(configuration: CompilerConfiguration, path: String) { - val layoutPaths = File(path).listFiles { it.name.startsWith("layout") && it.isDirectory() }!!.map { "$path${it.name}/" } + val layoutPaths = File(path).listFiles { it.name.startsWith("layout") && it.isDirectory }!!.map { "$path${it.name}/" } val manifestPath = path + "AndroidManifest.xml" val supportV4 = File(path).name.startsWith("support") myEnvironment = createAndroidTestEnvironment(configuration, layoutPaths, manifestPath, supportV4) @@ -83,7 +83,7 @@ public abstract class AbstractAndroidBoxTest : AbstractBlackBoxCodegenTest() { if (additionalFiles != null) files.add(relativePath(file)) } else -> { - if (file.getName().endsWith(".kt")) files.add(relativePath(file)) + if (file.name.endsWith(".kt")) files.add(relativePath(file)) } } return true diff --git a/plugins/android-compiler-plugin/tests/org/jetbrains/kotlin/lang/resolve/android/test/AbstractAndroidXml2KConversionTest.kt b/plugins/android-compiler-plugin/tests/org/jetbrains/kotlin/lang/resolve/android/test/AbstractAndroidXml2KConversionTest.kt index 1b48ed43606..a6a5f3b1553 100644 --- a/plugins/android-compiler-plugin/tests/org/jetbrains/kotlin/lang/resolve/android/test/AbstractAndroidXml2KConversionTest.kt +++ b/plugins/android-compiler-plugin/tests/org/jetbrains/kotlin/lang/resolve/android/test/AbstractAndroidXml2KConversionTest.kt @@ -41,9 +41,9 @@ public abstract class AbstractAndroidXml2KConversionTest : UsefulTestCase() { val actual = parser.gen().toMap { it.name } - val expectedLayoutFiles = testDirectory.listFiles { - it.isFile() && it.name.endsWith(".kt") - }?.toMap { it.name.substringBefore(".kt") } ?: mapOf() + val expectedLayoutFiles = testDirectory + .listFiles { it.isFile && it.name.endsWith(".kt") } + ?.toMap { it.name.substringBefore(".kt") } ?: mapOf() assertEquals(expectedLayoutFiles.size(), actual.size()) @@ -59,12 +59,11 @@ public abstract class AbstractAndroidXml2KConversionTest : UsefulTestCase() { doTest(path) fail("NoAndroidManifestFound not thrown") } - catch (e: SyntheticFileGenerator.NoAndroidManifestFound) { - } + catch (e: SyntheticFileGenerator.NoAndroidManifestFound) {} } private fun getEnvironment(): KotlinCoreEnvironment { val configuration = KotlinTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.ANDROID_API) - return KotlinCoreEnvironment.createForTests(getTestRootDisposable()!!, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES) + return KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES) } } \ No newline at end of file diff --git a/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/AndroidGotoDeclarationHandler.kt b/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/AndroidGotoDeclarationHandler.kt index 7786cb02510..002a55b17b7 100644 --- a/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/AndroidGotoDeclarationHandler.kt +++ b/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/AndroidGotoDeclarationHandler.kt @@ -33,16 +33,16 @@ import org.jetbrains.kotlin.psi.KtSimpleNameExpression public class AndroidGotoDeclarationHandler : GotoDeclarationHandler { override fun getGotoDeclarationTargets(sourceElement: PsiElement?, offset: Int, editor: Editor?): Array? { - if (sourceElement is LeafPsiElement && sourceElement.getParent() is KtSimpleNameExpression) { - val resolved = KtSimpleNameReference(sourceElement.getParent() as KtSimpleNameExpression).resolve() + if (sourceElement is LeafPsiElement && sourceElement.parent is KtSimpleNameExpression) { + val resolved = KtSimpleNameReference(sourceElement.parent as KtSimpleNameExpression).resolve() val property = resolved as? KtProperty ?: return null val moduleInfo = sourceElement.getModuleInfo() if (moduleInfo !is ModuleSourceInfo) return null - val parser = ModuleServiceManager.getService(moduleInfo.module, javaClass())!! + val parser = ModuleServiceManager.getService(moduleInfo.module, SyntheticFileGenerator::class.java)!! val psiElements = parser.layoutXmlFileManager.propertyToXmlAttributes(property) - val valueElements = psiElements.map { (it as? XmlAttribute)?.getValueElement() as? PsiElement }.filterNotNull() + val valueElements = psiElements.map { (it as? XmlAttribute)?.valueElement as? PsiElement }.filterNotNull() if (valueElements.isNotEmpty()) return valueElements.toTypedArray() } return null diff --git a/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/AndroidPsiTreeChangePreprocessor.kt b/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/AndroidPsiTreeChangePreprocessor.kt index a9c732c8800..d399c080d30 100644 --- a/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/AndroidPsiTreeChangePreprocessor.kt +++ b/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/AndroidPsiTreeChangePreprocessor.kt @@ -75,7 +75,7 @@ public class AndroidPsiTreeChangePreprocessor : PsiTreeChangePreprocessor, Simpl val module = projectFileIndex.getModuleForFile(xmlFile.virtualFile) if (module != null) { - val resourceManager = AndroidLayoutXmlFileManager.getInstance(module) + val resourceManager = AndroidLayoutXmlFileManager.getInstance(module) ?: return false val resDirectories = resourceManager.getModuleResDirectories() val baseDirectory = xmlFile.parent?.parent?.virtualFile diff --git a/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/IDEAndroidExternalDeclarationsProvider.kt b/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/IDEAndroidExternalDeclarationsProvider.kt index 3082a324efd..737ff4453ea 100644 --- a/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/IDEAndroidExternalDeclarationsProvider.kt +++ b/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/IDEAndroidExternalDeclarationsProvider.kt @@ -31,7 +31,7 @@ public class IDEAndroidExternalDeclarationsProvider(private val project: Project if (moduleInfo !is ModuleSourceInfo) return listOf() val module = moduleInfo.module - val parser = ModuleServiceManager.getService(module, javaClass()) as? IDESyntheticFileGenerator + val parser = ModuleServiceManager.getService(module, SyntheticFileGenerator::class.java) as? IDESyntheticFileGenerator val syntheticFiles = parser?.getSyntheticFiles() syntheticFiles?.forEach { it.moduleInfo = moduleInfo } diff --git a/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/res/IDEAndroidLayoutXmlFileManager.kt b/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/res/IDEAndroidLayoutXmlFileManager.kt index f684862e5a8..0223c9209e4 100644 --- a/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/res/IDEAndroidLayoutXmlFileManager.kt +++ b/plugins/android-idea-plugin/src/org/jetbrains/kotlin/android/synthetic/idea/res/IDEAndroidLayoutXmlFileManager.kt @@ -30,7 +30,7 @@ public class IDEAndroidLayoutXmlFileManager(val module: Module) : AndroidLayoutX override val androidModuleInfo: AndroidModuleInfo? by lazy { module.androidFacet?.toAndroidModuleInfo() } override fun propertyToXmlAttributes(property: KtProperty): List { - val fqPath = property.getFqName()?.pathSegments() ?: return listOf() + val fqPath = property.fqName?.pathSegments() ?: return listOf() if (fqPath.size() <= AndroidConst.SYNTHETIC_PACKAGE_PATH_LENGTH) return listOf() val layoutPackageName = fqPath[AndroidConst.SYNTHETIC_PACKAGE_PATH_LENGTH].asString() diff --git a/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidCompletionTest.kt b/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidCompletionTest.kt index eacd88e917c..b290cc6c73f 100644 --- a/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidCompletionTest.kt +++ b/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidCompletionTest.kt @@ -61,6 +61,6 @@ public abstract class AbstractAndroidCompletionTest : KotlinAndroidTestCase() { settings.AUTOCOMPLETE_ON_CODE_COMPLETION = codeCompletionOldValue settings.AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = smartTypeCompletionOldValue - super.tearDown() + super.tearDown() } } diff --git a/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidFindUsagesTest.kt b/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidFindUsagesTest.kt index 4634964b9ad..618f5a989c4 100644 --- a/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidFindUsagesTest.kt +++ b/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidFindUsagesTest.kt @@ -16,7 +16,7 @@ package org.jetbrains.kotlin.android -import com.intellij.codeInsight.TargetElementUtilBase +import com.intellij.codeInsight.TargetElementUtil import kotlin.test.* public abstract class AbstractAndroidFindUsagesTest : KotlinAndroidTestCase() { @@ -29,8 +29,8 @@ public abstract class AbstractAndroidFindUsagesTest : KotlinAndroidTestCase() { val virtualFile = f.copyFileToProject(path + getTestName(true) + ".kt", "src/" + getTestName(true) + ".kt"); f.configureFromExistingVirtualFile(virtualFile) - val targetElement = TargetElementUtilBase.findTargetElement( - f.getEditor(), TargetElementUtilBase.ELEMENT_NAME_ACCEPTED or TargetElementUtilBase.REFERENCED_ELEMENT_ACCEPTED) + val targetElement = TargetElementUtil.findTargetElement( + f.editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED) assertNotNull(targetElement) val propUsages = f.findUsages(targetElement!!) diff --git a/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidGotoTest.kt b/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidGotoTest.kt index 7cd20ba8531..b0e845cdbda 100644 --- a/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidGotoTest.kt +++ b/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/AbstractAndroidGotoTest.kt @@ -31,9 +31,9 @@ public abstract class AbstractAndroidGotoTest : KotlinAndroidTestCase() { val virtualFile = f.copyFileToProject(path + getTestName(true) + ".kt", "src/" + getTestName(true) + ".kt"); f.configureFromExistingVirtualFile(virtualFile) - val resolved = GotoDeclarationAction.findTargetElement(f.getProject(), f.getEditor(), f.getCaretOffset()) - if (f.getElementAtCaret() !is KtProperty) kotlin.test.fail("element at caret must be a property, not a ${f.getElementAtCaret().javaClass}") - kotlin.test.assertEquals("\"@+id/${(f.getElementAtCaret() as KtProperty).getName()}\"", resolved?.getText()) + val resolved = GotoDeclarationAction.findTargetElement(f.project, f.editor, f.caretOffset) + if (f.elementAtCaret !is KtProperty) kotlin.test.fail("element at caret must be a property, not a ${f.elementAtCaret.javaClass}") + kotlin.test.assertEquals("\"@+id/${(f.elementAtCaret as KtProperty).name}\"", resolved?.text) } } \ No newline at end of file diff --git a/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/SamePluginVersionsTest.kt b/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/SamePluginVersionsTest.kt index 3ea234dcf61..499c0e500b3 100644 --- a/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/SamePluginVersionsTest.kt +++ b/plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/SamePluginVersionsTest.kt @@ -30,13 +30,13 @@ public class SamePluginVersionsTest { private fun extractIdeaVersion(pluginFile: File, pluginXml: String): Pair { val matcher = IDEA_VERSION_PATTERN.matcher(pluginXml) - assertTrue("Can't find tag in ${pluginFile.getAbsolutePath()}", matcher.find()) + assertTrue("Can't find tag in ${pluginFile.absolutePath}", matcher.find()) return matcher.group(1) to matcher.group(2) } private fun extractPluginVersion(pluginFile: File, pluginXml: String): String { val matcher = PLUGIN_VERSION_PATTERN.matcher(pluginXml) - assertTrue("Can't find tag in ${pluginFile.getAbsolutePath()}", matcher.find()) + assertTrue("Can't find tag in ${pluginFile.absolutePath}", matcher.find()) return matcher.group(1) } diff --git a/plugins/android-jps-plugin/src/KotlinAndroidJpsPlugin.kt b/plugins/android-jps-plugin/src/KotlinAndroidJpsPlugin.kt index 0bd08c62912..a803cb966b5 100644 --- a/plugins/android-jps-plugin/src/KotlinAndroidJpsPlugin.kt +++ b/plugins/android-jps-plugin/src/KotlinAndroidJpsPlugin.kt @@ -26,7 +26,7 @@ import com.intellij.util.PathUtil public class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider { override fun getExtraArguments(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List { - val module = moduleBuildTarget.getModule() + val module = moduleBuildTarget.module val pluginId = ANDROID_COMPILER_PLUGIN_ID val resPath = getAndroidResPath(module) val manifestFile = getAndroidManifest(module) @@ -38,17 +38,17 @@ public class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider { } override fun getClasspath(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List { - val inJar = File(PathUtil.getJarPathForClass(javaClass)).isFile() - val manifestFile = getAndroidManifest(moduleBuildTarget.getModule()) + val inJar = File(PathUtil.getJarPathForClass(javaClass)).isFile + val manifestFile = getAndroidManifest(moduleBuildTarget.module) return if (manifestFile != null) { listOf( if (inJar) { - val libDirectory = File(PathUtil.getJarPathForClass(javaClass)).getParentFile().getParentFile() - File(libDirectory, JAR_FILE_NAME).getAbsolutePath() + val libDirectory = File(PathUtil.getJarPathForClass(javaClass)).parentFile.parentFile + File(libDirectory, JAR_FILE_NAME).absolutePath } else { // We're in tests now (in out/production/android-jps-plugin) - val kotlinProjectDirectory = File(PathUtil.getJarPathForClass(javaClass)).getParentFile().getParentFile().getParentFile() - File(kotlinProjectDirectory, "dist/kotlinc/lib/$JAR_FILE_NAME").getAbsolutePath() + val kotlinProjectDirectory = File(PathUtil.getJarPathForClass(javaClass)).parentFile.parentFile.parentFile + File(kotlinProjectDirectory, "dist/kotlinc/lib/$JAR_FILE_NAME").absolutePath }) } else listOf() @@ -57,12 +57,12 @@ public class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider { private fun getAndroidResPath(module: JpsModule): String? { val extension = AndroidJpsUtil.getExtension(module) ?: return null val path = AndroidJpsUtil.getResourceDirForCompilationPath(extension) - return File(path!!.getAbsolutePath() + "/layout").getAbsolutePath() + return File(path!!.absolutePath + "/layout").absolutePath } private fun getAndroidManifest(module: JpsModule): String? { val extension = AndroidJpsUtil.getExtension(module) ?: return null - return AndroidJpsUtil.getManifestFileForCompilationPath(extension)!!.getAbsolutePath() + return AndroidJpsUtil.getManifestFileForCompilationPath(extension)!!.absolutePath } companion object { diff --git a/plugins/android-jps-plugin/tests/org/jetbrains/kotlin/jps/build/android/AbstractAndroidJpsTestCase.kt b/plugins/android-jps-plugin/tests/org/jetbrains/kotlin/jps/build/android/AbstractAndroidJpsTestCase.kt index 6a13411fffc..3b7a3c6d9c8 100644 --- a/plugins/android-jps-plugin/tests/org/jetbrains/kotlin/jps/build/android/AbstractAndroidJpsTestCase.kt +++ b/plugins/android-jps-plugin/tests/org/jetbrains/kotlin/jps/build/android/AbstractAndroidJpsTestCase.kt @@ -43,10 +43,10 @@ public abstract class AbstractAndroidJpsTestCase : JpsBuildTestCase() { } public fun deleteDirectory(path: File): Boolean { - if (path.exists() && path.isDirectory()) { + if (path.exists() && path.isDirectory) { val files = path.listFiles() for (i in files.indices) { - if (files[i].isDirectory()) { + if (files[i].isDirectory) { deleteDirectory(files[i]) } else { @@ -61,9 +61,9 @@ public abstract class AbstractAndroidJpsTestCase : JpsBuildTestCase() { val jdkName = "java_sdk" addJdk(jdkName) val properties = JpsAndroidSdkProperties("android-21", jdkName) - val sdkPath = getHomePath() + "/../dependencies/androidSDK" - val library = myModel.getGlobal().addSdk(SDK_NAME, sdkPath, "", JpsAndroidSdkType.INSTANCE, JpsSimpleElementImpl(properties)) + val sdkPath = homePath + "/../dependencies/androidSDK" + val library = myModel.global.addSdk(SDK_NAME, sdkPath, "", JpsAndroidSdkType.INSTANCE, JpsSimpleElementImpl(properties)) library.addRoot(File(sdkPath + "/platforms/android-21/android.jar"), JpsOrderRootType.COMPILED) - return library.getProperties() + return library.properties } }