Fix handling Boolean? arguments Boolean? arguments are seen through java reflection as having type java.lang.Boolean::class.java, whereas Boolean arguments are seen as kotlin.Boolean::class.java. This fix moves the type comparision back to kotlin-types, since both map to kotlin.Boolean::class.
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/parseCommandLineArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/parseCommandLineArguments.kt index d2866ac..c72cc0e 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/parseCommandLineArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/parseCommandLineArguments.kt
@@ -153,7 +153,7 @@ } if (argument.value == arg) { - if (argument.isAdvanced && getter.returnType != Boolean::class.java) { + if (argument.isAdvanced && getter.returnType.kotlin != Boolean::class) { errors.value.extraArgumentsPassedInObsoleteForm.add(arg) } return true @@ -211,7 +211,7 @@ val (getter, setter, argument) = argumentField val value: Any = when { - getter.returnType == Boolean::class.java -> { + getter.returnType.kotlin == Boolean::class -> { if (arg.startsWith(argument.value + "=")) { // Can't use toBooleanStrict yet because this part of the compiler is used in Gradle and needs API version 1.4. when (arg.substring(argument.value.length + 1)) { @@ -272,9 +272,9 @@ delimiter: String?, overrideArguments: Boolean ) { - when (getter.returnType) { - Boolean::class.java, String::class.java -> setter(result, value) - Array<String>::class.java -> { + when (getter.returnType.kotlin) { + Boolean::class, String::class -> setter(result, value) + Array<String>::class -> { val newElements = if (delimiter.isNullOrEmpty()) { arrayOf(value as String) } else {