< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
Print this page
*** 25,34 ****
--- 25,35 ----
package com.sun.tools.javac.main;
import java.io.FileWriter;
import java.io.PrintWriter;
+ import java.lang.module.ModuleDescriptor;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.Collator;
import java.util.Arrays;
*** 45,65 ****
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.lang.model.SourceVersion;
import com.sun.tools.doclint.DocLint;
import com.sun.tools.javac.code.Lint;
import com.sun.tools.javac.code.Lint.LintCategory;
import com.sun.tools.javac.code.Source;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.javac.jvm.Target;
import com.sun.tools.javac.platform.PlatformProvider;
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
import com.sun.tools.javac.util.Assert;
- import com.sun.tools.javac.util.JDK9Wrappers;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Log.PrefixKind;
import com.sun.tools.javac.util.Log.WriterKind;
import com.sun.tools.javac.util.Options;
import com.sun.tools.javac.util.StringUtils;
--- 46,67 ----
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.lang.model.SourceVersion;
+ import jdk.internal.misc.VM;
+
import com.sun.tools.doclint.DocLint;
import com.sun.tools.javac.code.Lint;
import com.sun.tools.javac.code.Lint.LintCategory;
import com.sun.tools.javac.code.Source;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.jvm.Profile;
import com.sun.tools.javac.jvm.Target;
import com.sun.tools.javac.platform.PlatformProvider;
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
import com.sun.tools.javac.util.Assert;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Log.PrefixKind;
import com.sun.tools.javac.util.Log.WriterKind;
import com.sun.tools.javac.util.Options;
import com.sun.tools.javac.util.StringUtils;
*** 648,673 ****
@Override
public void process(OptionHelper helper, String option, String arg) throws InvalidValueException {
if (arg.isEmpty()) {
throw helper.newInvalidValueException("err.no.value.for.option", option);
} else {
- try {
- Class.forName(JDK9Wrappers.ModuleDescriptor.Version.CLASSNAME);
// use official parser if available
try {
! JDK9Wrappers.ModuleDescriptor.Version.parse(arg);
} catch (IllegalArgumentException e) {
throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
}
- } catch (ClassNotFoundException ex) {
- // fall-back to simplistic rules when running on older platform
- if (!(arg.charAt(0) >= '0' && arg.charAt(0) <= '9') ||
- arg.endsWith("-") ||
- arg.endsWith("+")) {
- throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
- }
- }
}
super.process(helper, option, arg);
}
},
--- 650,665 ----
@Override
public void process(OptionHelper helper, String option, String arg) throws InvalidValueException {
if (arg.isEmpty()) {
throw helper.newInvalidValueException("err.no.value.for.option", option);
} else {
// use official parser if available
try {
! ModuleDescriptor.Version.parse(arg);
} catch (IllegalArgumentException e) {
throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
}
}
super.process(helper, option, arg);
}
},
*** 715,727 ****
INHERIT_RUNTIME_ENVIRONMENT("--inherit-runtime-environment", "opt.inherit_runtime_environment",
HIDDEN, BASIC) {
@Override
public void process(OptionHelper helper, String option) throws InvalidValueException {
! try {
! Class.forName(JDK9Wrappers.VMHelper.CLASSNAME);
! String[] runtimeArgs = JDK9Wrappers.VMHelper.getRuntimeArguments();
for (String arg : runtimeArgs) {
// Handle any supported runtime options; ignore all others.
// The runtime arguments always use the single token form, e.g. "--name=value".
for (Option o : getSupportedRuntimeOptions()) {
if (o.matches(arg)) {
--- 707,717 ----
INHERIT_RUNTIME_ENVIRONMENT("--inherit-runtime-environment", "opt.inherit_runtime_environment",
HIDDEN, BASIC) {
@Override
public void process(OptionHelper helper, String option) throws InvalidValueException {
! String[] runtimeArgs = VM.getRuntimeArguments();
for (String arg : runtimeArgs) {
// Handle any supported runtime options; ignore all others.
// The runtime arguments always use the single token form, e.g. "--name=value".
for (Option o : getSupportedRuntimeOptions()) {
if (o.matches(arg)) {
*** 748,760 ****
}
break;
}
}
}
- } catch (ClassNotFoundException | SecurityException e) {
- throw helper.newInvalidValueException("err.cannot.access.runtime.env");
- }
}
private Option[] getSupportedRuntimeOptions() {
Option[] supportedRuntimeOptions = {
ADD_EXPORTS,
--- 738,747 ----
< prev index next >