File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ case "$1" in
9595 # break out -D and -J options and add them to JAVA_OPTS as well
9696 # so they reach the JVM in time to do some good. The -D options
9797 # will be available as system properties.
98- -D* ) addJava " $1 " && addScala " $1 " && shift ;;
99- -J* ) addJava " ${1: 2} " && addScala " $1 " && shift ;;
98+ -D* ) addJava " $1 " && shift ;;
99+ -J* ) addJava " ${1: 2} " && shift ;;
100100 * ) addResidual " $1 " && shift ;;
101101 esac
102102done
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ addJvmOptions () {
3131 jvm_options+=(" $1 " )
3232}
3333
34+ addRawJvmOptions () {
35+ java_options+=(" $1 " )
36+ }
37+
3438source " $PROG_HOME /bin/common"
3539
3640declare -a residual_args
@@ -40,6 +44,11 @@ with_compiler=false
4044class_path_count=0
4145CLASS_PATH=" "
4246
47+ # Little hack to check if all arguments are options
48+ all_params=" $* "
49+ truncated_params=" ${*# -} "
50+ not_only_options=$(( ${# all_params} - ${# truncated_params} - $# ))
51+
4352while [[ $# -gt 0 ]]; do
4453 case " $1 " in
4554 -repl)
@@ -65,7 +74,8 @@ while [[ $# -gt 0 ]]; do
6574 shift
6675 ;;
6776 -J* )
68- addJvmOptions " -${1: 2} "
77+ addJvmOptions " ${1: 2} "
78+ addRawJvmOptions " ${1} "
6979 shift ;;
7080 * )
7181 residual_args+=(" $1 " )
@@ -74,13 +84,12 @@ while [[ $# -gt 0 ]]; do
7484
7585 esac
7686done
77-
78- if [ $execute_repl == true ] || ([ $execute_run == false ] && [ ${# residual_args[@]} -eq 0 ]); then
87+ if [ $execute_repl == true ] || ([ $execute_run == false ] && [ $not_only_options == 0 ]); then
7988 if [ " $CLASS_PATH " ]; then
8089 cp_arg=" -classpath \" $CLASS_PATH \" "
8190 fi
8291 echo " Starting dotty REPL..."
83- eval " \" $PROG_HOME /bin/dotc\" $cp_arg -repl ${residual_args[@]} "
92+ eval " \" $PROG_HOME /bin/dotc\" $cp_arg ${java_options[@]} -repl ${residual_args[@]} "
8493elif [ $execute_repl == true ] || [ ${# residual_args[@]} -ne 0 ]; then
8594 cp_arg=" $DOTTY_LIB$PSEP$SCALA_LIB "
8695 if [ -z " $CLASS_PATH " ]; then
You can’t perform that action at this time.
0 commit comments