CLI: do not pass -noverify to java process starting from JDK 13
#KT-44232 Fixed
This commit is contained in:
@@ -21,6 +21,17 @@ findKotlinHome() {
|
||||
(cd -P "$(dirname "$source")/.." && pwd)
|
||||
}
|
||||
|
||||
findJavaVersion() {
|
||||
# Note that this only loads the first component of the version, so "1.8.0_265" -> "1".
|
||||
# But it's fine because major version is 9 for JDK 9, and so on.
|
||||
regex='^.*version "([[:digit:]]+).*$'
|
||||
while read -r line; do
|
||||
if [[ "$line" =~ $regex ]]; then
|
||||
echo ${BASH_REMATCH[1]}
|
||||
fi
|
||||
done <<< $("${JAVACMD:=java}" -version 2>&1)
|
||||
}
|
||||
|
||||
KOTLIN_HOME="$(findKotlinHome)"
|
||||
|
||||
if $cygwin; then
|
||||
@@ -56,17 +67,19 @@ fi
|
||||
|
||||
declare -a kotlin_app
|
||||
|
||||
if [ -n "$KOTLIN_RUNNER" ];
|
||||
then
|
||||
if [ -n "$KOTLIN_RUNNER" ]; then
|
||||
java_args=("${java_args[@]}" "-Dkotlin.home=${KOTLIN_HOME}")
|
||||
kotlin_app=("${KOTLIN_HOME}/lib/kotlin-runner.jar" "org.jetbrains.kotlin.runner.Main")
|
||||
else
|
||||
[ -n "$KOTLIN_COMPILER" ] || KOTLIN_COMPILER=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
java_args=("${java_args[@]}" "-noverify")
|
||||
|
||||
java_version="$(findJavaVersion)"
|
||||
if [[ $java_version < 13 ]]; then
|
||||
java_args=("${java_args[@]}" "-noverify")
|
||||
fi
|
||||
|
||||
declare additional_classpath=""
|
||||
if [ -n "$KOTLIN_TOOL" ];
|
||||
then
|
||||
if [ -n "$KOTLIN_TOOL" ]; then
|
||||
additional_classpath=":${KOTLIN_HOME}/lib/${KOTLIN_TOOL}"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user