795 if (option.endsWith(".java") ) {
796 try {
797 Path p = Paths.get(option);
798 if (!Files.exists(p)) {
799 throw helper.newInvalidValueException(Errors.FileNotFound(p.toString()));
800 }
801 if (!Files.isRegularFile(p)) {
802 throw helper.newInvalidValueException(Errors.FileNotFile(p));
803 }
804 helper.addFile(p);
805 } catch (InvalidPathException ex) {
806 throw helper.newInvalidValueException(Errors.InvalidPath(option));
807 }
808 } else {
809 helper.addClassName(option);
810 }
811 }
812 },
813
814 MULTIRELEASE("--multi-release", "opt.arg.multi-release", "opt.multi-release", HIDDEN, FILEMANAGER),
815
816 INHERIT_RUNTIME_ENVIRONMENT("--inherit-runtime-environment", "opt.inherit_runtime_environment",
817 HIDDEN, BASIC) {
818 @Override
819 public void process(OptionHelper helper, String option) throws InvalidValueException {
820 String[] runtimeArgs = VM.getRuntimeArguments();
821 for (String arg : runtimeArgs) {
822 // Handle any supported runtime options; ignore all others.
823 // The runtime arguments always use the single token form, e.g. "--name=value".
824 for (Option o : getSupportedRuntimeOptions()) {
825 if (o.matches(arg)) {
826 switch (o) {
827 case ADD_MODULES:
828 int eq = arg.indexOf('=');
829 Assert.check(eq > 0, () -> ("invalid runtime option:" + arg));
830 // --add-modules=ALL-DEFAULT is not supported at compile-time
831 // so remove it from list, and only process the rest
832 // if the set is non-empty.
833 // Note that --add-modules=ALL-DEFAULT is automatically added
834 // by the standard javac launcher.
|
795 if (option.endsWith(".java") ) {
796 try {
797 Path p = Paths.get(option);
798 if (!Files.exists(p)) {
799 throw helper.newInvalidValueException(Errors.FileNotFound(p.toString()));
800 }
801 if (!Files.isRegularFile(p)) {
802 throw helper.newInvalidValueException(Errors.FileNotFile(p));
803 }
804 helper.addFile(p);
805 } catch (InvalidPathException ex) {
806 throw helper.newInvalidValueException(Errors.InvalidPath(option));
807 }
808 } else {
809 helper.addClassName(option);
810 }
811 }
812 },
813
814 MULTIRELEASE("--multi-release", "opt.arg.multi-release", "opt.multi-release", HIDDEN, FILEMANAGER),
815 PREVIEWMODE("--preview-mode", "opt.arg.preview-mode", "opt.preview-mode", HIDDEN, FILEMANAGER),
816
817 INHERIT_RUNTIME_ENVIRONMENT("--inherit-runtime-environment", "opt.inherit_runtime_environment",
818 HIDDEN, BASIC) {
819 @Override
820 public void process(OptionHelper helper, String option) throws InvalidValueException {
821 String[] runtimeArgs = VM.getRuntimeArguments();
822 for (String arg : runtimeArgs) {
823 // Handle any supported runtime options; ignore all others.
824 // The runtime arguments always use the single token form, e.g. "--name=value".
825 for (Option o : getSupportedRuntimeOptions()) {
826 if (o.matches(arg)) {
827 switch (o) {
828 case ADD_MODULES:
829 int eq = arg.indexOf('=');
830 Assert.check(eq > 0, () -> ("invalid runtime option:" + arg));
831 // --add-modules=ALL-DEFAULT is not supported at compile-time
832 // so remove it from list, and only process the rest
833 // if the set is non-empty.
834 // Note that --add-modules=ALL-DEFAULT is automatically added
835 // by the standard javac launcher.
|