fix 2 problems plus add workaround for #13760 #14252
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
replaces #14241
These changes fix 2 problems, and add a workaround for #13760.
MainGenericRunner, when running from a compiled jar.-saveoption is not specified at runtime, execution should not be from a previously compiled jarThe
-savebehavior matches the expectation inscala2.This PR displays all exceptions on the Console when running from a
jarfile.This PR executes from the
jaronly if the-saveoption is specified at runtime. Problem scripts (i.e., with references tojava.sql.Date) can now selectively disable the -save option.The
-saveoption change provides a workaround for theClassNotFound: java.sql.Dateproblem, which affects jdk 9+.A new command line option
-nosaveis provided, for undoing a-saveoption on the command line (e.g., inSCALA_OPTS) This provides a way for individual scripts to override the-saveoption.Adding
-savetoSCALA_OPTSwill typically reduce script startup time by a couple of seconds. This PR provides per-script granularity for overriding the '-save' option. Scripts that would otherwise throw an exception when running from a compiled jar may specify-nosavein the hashbang line. This avoids having to remove the-saveoption fromSCALA_OPTS.The
-nosaveoption can be added to the hashbang line, as in these two example hashbang lines:The first version requires
/usr/bin/envversion8.30or later:#!/usr/bin/env -S scala -nosaveThis version uses the path to the scala wrapper:
#!/opt/scala3/bin/scala -nosave