From 7c1bc432db08ceb689fa8323dea9dc720befdaf1 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Wed, 26 Nov 2014 16:37:41 +0300 Subject: [PATCH] Removed reflection-based hack for IDEA 12. --- .../org/jetbrains/jet/jps/build/KotlinBuilder.kt | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/jps-plugin/src/org/jetbrains/jet/jps/build/KotlinBuilder.kt b/jps-plugin/src/org/jetbrains/jet/jps/build/KotlinBuilder.kt index 860211c60d6..b5ae442a302 100644 --- a/jps-plugin/src/org/jetbrains/jet/jps/build/KotlinBuilder.kt +++ b/jps-plugin/src/org/jetbrains/jet/jps/build/KotlinBuilder.kt @@ -85,7 +85,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR val messageCollector = MessageCollectorAdapter(context) // Workaround for Android Studio - if (!isJavaPluginEnabled(context)) { + if (!JavaBuilder.IS_ENABLED[context, true]) { messageCollector.report(INFO, "Kotlin JPS plugin is disabled", NO_LOCATION) return NOTHING_DONE } @@ -430,16 +430,3 @@ private fun hasKotlinDirtyOrRemovedFiles( return chunk.getTargets().any { !KotlinSourceFileCollector.getRemovedKotlinFiles(dirtyFilesHolder, it).isEmpty() } } - -private fun isJavaPluginEnabled(context: CompileContext): Boolean { - try { - // Using reflection for backward compatibility with IDEA 12 - val javaPluginIsEnabledField = javaClass().getDeclaredField("IS_ENABLED") - return if (Modifier.isPublic(javaPluginIsEnabledField.getModifiers())) JavaBuilder.IS_ENABLED[context, true] else true - } - catch (e: NoSuchFieldException) { - throw IllegalArgumentException("Cannot check if Java Jps Plugin is enabled", e) - } - -} -