diff --git a/src/share/classes/com/sun/tools/javac/code/Source.java b/src/share/classes/com/sun/tools/javac/code/Source.java index 58fa9a7694a485a2e81e7d4976d7afebe498e943..3a21ce7213570b563d67239ace89782965873d86 100644 --- a/src/share/classes/com/sun/tools/javac/code/Source.java +++ b/src/share/classes/com/sun/tools/javac/code/Source.java @@ -25,11 +25,14 @@ package com.sun.tools.javac.code; -import com.sun.tools.javac.util.*; -import com.sun.tools.javac.jvm.Target; +import java.util.*; import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; -import java.util.*; + +import com.sun.tools.javac.util.*; +import com.sun.tools.javac.jvm.Target; + +import static com.sun.tools.javac.main.OptionName.*; /** The source language version accepted. * @@ -71,7 +74,7 @@ public enum Source { Source instance = context.get(sourceKey); if (instance == null) { Options options = Options.instance(context); - String sourceString = options.get("-source"); + String sourceString = options.get(SOURCE); if (sourceString != null) instance = lookup(sourceString); if (instance == null) instance = DEFAULT; context.put(sourceKey, instance); diff --git a/src/share/classes/com/sun/tools/javac/comp/Attr.java b/src/share/classes/com/sun/tools/javac/comp/Attr.java index ab6c322e7db513bfa7499897bdd1ebc2ced5863f..7e80d2693cbf25c26215a3fea521f9870845f935 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -119,10 +119,10 @@ public class Attr extends JCTree.Visitor { allowAnonOuterThis = source.allowAnonOuterThis(); allowStringsInSwitch = source.allowStringsInSwitch(); sourceName = source.name; - relax = (options.get("-retrofit") != null || - options.get("-relax") != null); - useBeforeDeclarationWarning = options.get("useBeforeDeclarationWarning") != null; - enableSunApiLintControl = options.get("enableSunApiLintControl") != null; + relax = (options.isSet("-retrofit") || + options.isSet("-relax")); + useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning"); + enableSunApiLintControl = options.isSet("enableSunApiLintControl"); } /** Switch: relax some constraints for retrofit mode. diff --git a/src/share/classes/com/sun/tools/javac/comp/Check.java b/src/share/classes/com/sun/tools/javac/comp/Check.java index de78acb5097b0f330586ab78e3fdba7a6009a417..07d95cc5c1e9150ab0eb725aefff13dde2839c76 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java @@ -25,7 +25,6 @@ package com.sun.tools.javac.comp; -import com.sun.source.tree.AssignmentTree; import java.util.*; import java.util.Set; @@ -46,6 +45,8 @@ import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Kinds.*; import static com.sun.tools.javac.code.TypeTags.*; +import static com.sun.tools.javac.main.OptionName.*; + /** Type checking helper class for the attribution phase. * *
This is NOT part of any supported API. @@ -99,10 +100,10 @@ public class Check { allowGenerics = source.allowGenerics(); allowAnnotations = source.allowAnnotations(); allowCovariantReturns = source.allowCovariantReturns(); - complexInference = options.get("-complexinference") != null; - skipAnnotations = options.get("skipAnnotations") != null; - warnOnSyntheticConflicts = options.get("warnOnSyntheticConflicts") != null; - suppressAbortOnBadClassFile = options.get("suppressAbortOnBadClassFile") != null; + complexInference = options.isSet(COMPLEXINFERENCE); + skipAnnotations = options.isSet("skipAnnotations"); + warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts"); + suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile"); Target target = Target.instance(context); syntheticNameChar = target.syntheticNameChar(); diff --git a/src/share/classes/com/sun/tools/javac/comp/Lower.java b/src/share/classes/com/sun/tools/javac/comp/Lower.java index 67f42b821a42ace20854f3c3a25e78aa2a1c2f62..9498781064e3839a60e58c371677d2ddbcae470e 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java @@ -109,7 +109,7 @@ public class Lower extends TreeTranslator { types = Types.instance(context); Options options = Options.instance(context); - debugLower = options.get("debuglower") != null; + debugLower = options.isSet("debuglower"); pkginfoOpt = PkgInfo.get(options); } diff --git a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java index 09cd303b80e9761c780351917912537c80894026..73fe36cbf7d9794c4b6f63835ad6252966981ff9 100644 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java @@ -102,7 +102,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer { diags = JCDiagnostic.Factory.instance(context); target = Target.instance(context); Options options = Options.instance(context); - skipAnnotations = options.get("skipAnnotations") != null; + skipAnnotations = options.isSet("skipAnnotations"); } /** A queue for classes whose members still need to be entered into the diff --git a/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/share/classes/com/sun/tools/javac/comp/Resolve.java index 10141b1e58f5c8b5251a3c223027562dc92b8059..85d8161dac6dea4fe55e05afb71ea53943b6dd02 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -110,14 +110,14 @@ public class Resolve { boxingEnabled = source.allowBoxing(); varargsEnabled = source.allowVarargs(); Options options = Options.instance(context); - debugResolve = options.get("debugresolve") != null; - allowTransitionalJSR292 = options.get("allowTransitionalJSR292") != null; + debugResolve = options.isSet("debugresolve"); + allowTransitionalJSR292 = options.isSet("allowTransitionalJSR292"); Target target = Target.instance(context); allowMethodHandles = allowTransitionalJSR292 || target.hasMethodHandles(); allowInvokeDynamic = (allowTransitionalJSR292 || target.hasInvokedynamic()) && - options.get("invokedynamic") != null; + options.isSet("invokedynamic"); polymorphicSignatureScope = new Scope(syms.noSymbol); inapplicableMethodException = new InapplicableMethodException(diags); diff --git a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java index afa40d10d3713078c3807bbc15676b1d3788cb3c..5fec67baecc83683dc926e0aa724c1727d227a1c 100644 --- a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java +++ b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java @@ -150,8 +150,8 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil useZipFileIndex = System.getProperty("useJavaUtilZip") == null;// TODO: options.get("useJavaUtilZip") == null; - mmappedIO = options.get("mmappedIO") != null; - ignoreSymbolFile = options.get("ignore.symbol.file") != null; + mmappedIO = options.isSet("mmappedIO"); + ignoreSymbolFile = options.isSet("ignore.symbol.file"); } public JavaFileObject getFileForInput(String name) { @@ -435,7 +435,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil zdir = new ZipFile(zipFileName); } else { - usePreindexedCache = options.get("usezipindex") != null; + usePreindexedCache = options.isSet("usezipindex"); preindexCacheLocation = options.get("java.io.tmpdir"); String optCacheLoc = options.get("cachezipindexdir"); @@ -469,7 +469,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil null, usePreindexedCache, preindexCacheLocation, - options.get("writezipindexfiles") != null)); + options.isSet("writezipindexfiles"))); } } else { @@ -482,7 +482,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil symbolFilePrefix, usePreindexedCache, preindexCacheLocation, - options.get("writezipindexfiles") != null)); + options.isSet("writezipindexfiles"))); } } } catch (FileNotFoundException ex) { diff --git a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java index 4e76d78e2a5928e090ca21a2d43f668331ed7360..912d0dbf2937c66e8ec14645a250faff3ca4c8da 100644 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -56,6 +56,8 @@ import static com.sun.tools.javac.code.TypeTags.*; import static com.sun.tools.javac.jvm.ClassFile.*; import static com.sun.tools.javac.jvm.ClassFile.Version.*; +import static com.sun.tools.javac.main.OptionName.*; + /** This class provides operations to read a classfile into an internal * representation. The internal representation is anchored in a * ClassSymbol which contains in its scope symbol representations @@ -259,23 +261,23 @@ public class ClassReader implements Completer { Options options = Options.instance(context); annotate = Annotate.instance(context); - verbose = options.get("-verbose") != null; - checkClassFile = options.get("-checkclassfile") != null; + verbose = options.isSet(VERBOSE); + checkClassFile = options.isSet("-checkclassfile"); Source source = Source.instance(context); allowGenerics = source.allowGenerics(); allowVarargs = source.allowVarargs(); allowAnnotations = source.allowAnnotations(); - saveParameterNames = options.get("save-parameter-names") != null; - cacheCompletionFailure = options.get("dev") == null; + saveParameterNames = options.isSet("save-parameter-names"); + cacheCompletionFailure = options.isUnset("dev"); preferSource = "source".equals(options.get("-Xprefer")); completionFailureName = - (options.get("failcomplete") != null) + options.isSet("failcomplete") ? names.fromString(options.get("failcomplete")) : null; typevars = new Scope(syms.noSymbol); - debugJSR308 = options.get("TA:reader") != null; + debugJSR308 = options.isSet("TA:reader"); initAttributeReaders(); } diff --git a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java index a413b6fe1c738ed800251edba5bc410864484f3b..08797b63e69fa23c3209c4a1abae00b3d7e9127e 100644 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java @@ -45,8 +45,10 @@ import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Kinds.*; import static com.sun.tools.javac.code.TypeTags.*; import static com.sun.tools.javac.jvm.UninitializedType.*; +import static com.sun.tools.javac.main.OptionName.*; import static javax.tools.StandardLocation.CLASS_OUTPUT; + /** This class provides operations to map an internal symbol table graph * rooted in a ClassSymbol into a classfile. * @@ -178,15 +180,16 @@ public class ClassWriter extends ClassFile { types = Types.instance(context); fileManager = context.get(JavaFileManager.class); - debugJSR308 = options.get("TA:writer") != null; - verbose = options.get("-verbose") != null; - scramble = options.get("-scramble") != null; - scrambleAll = options.get("-scrambleAll") != null; - retrofit = options.get("-retrofit") != null; - genCrt = options.get("-Xjcov") != null; - debugstackmap = options.get("debugstackmap") != null; + debugJSR308 = options.isSet("TA:writer"); + verbose = options.isSet(VERBOSE); + scramble = options.isSet("-scramble"); + scrambleAll = options.isSet("-scrambleAll"); + retrofit = options.isSet("-retrofit"); + genCrt = options.isSet(XJCOV); + debugstackmap = options.isSet("debugstackmap"); - emitSourceFile = options.get("-g:")==null || options.get("-g:source")!=null; + emitSourceFile = options.isUnset(G_CUSTOM) || + options.isSet(G_CUSTOM, "source"); String dumpModFlags = options.get("dumpmodifiers"); dumpClassModifiers = diff --git a/src/share/classes/com/sun/tools/javac/jvm/Gen.java b/src/share/classes/com/sun/tools/javac/jvm/Gen.java index 188793a453aaccae81bfd00f401d4605274b3570..572380a49e1ff3197b9b781e0f784a4033b7cce7 100644 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -46,6 +46,7 @@ import static com.sun.tools.javac.code.Kinds.*; import static com.sun.tools.javac.code.TypeTags.*; import static com.sun.tools.javac.jvm.ByteCodes.*; import static com.sun.tools.javac.jvm.CRTFlags.*; +import static com.sun.tools.javac.main.OptionName.*; /** This pass maps flat Java (i.e. without inner classes) to bytecodes. * @@ -113,19 +114,19 @@ public class Gen extends JCTree.Visitor { Options options = Options.instance(context); lineDebugInfo = - options.get("-g:") == null || - options.get("-g:lines") != null; + options.isUnset(G_CUSTOM) || + options.isSet(G_CUSTOM, "lines"); varDebugInfo = - options.get("-g:") == null - ? options.get("-g") != null - : options.get("-g:vars") != null; - genCrt = options.get("-Xjcov") != null; - debugCode = options.get("debugcode") != null; - allowInvokedynamic = target.hasInvokedynamic() || options.get("invokedynamic") != null; + options.isUnset(G_CUSTOM) + ? options.isSet(G) + : options.isSet(G_CUSTOM, "vars"); + genCrt = options.isSet(XJCOV); + debugCode = options.isSet("debugcode"); + allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic"); generateIproxies = target.requiresIproxy() || - options.get("miranda") != null; + options.isSet("miranda"); if (target.generateStackMapTable()) { // ignore cldc because we cannot have both stackmap formats diff --git a/src/share/classes/com/sun/tools/javac/jvm/Target.java b/src/share/classes/com/sun/tools/javac/jvm/Target.java index 368c77d801c21ac41502ec4aa94337cec5503b13..9d09967b3dabfbfdc24b98d9ddb2946d88151680 100644 --- a/src/share/classes/com/sun/tools/javac/jvm/Target.java +++ b/src/share/classes/com/sun/tools/javac/jvm/Target.java @@ -31,6 +31,8 @@ import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.util.*; +import static com.sun.tools.javac.main.OptionName.*; + /** The classfile version target. * *
This is NOT part of any supported API.
@@ -73,7 +75,7 @@ public enum Target {
Target instance = context.get(targetKey);
if (instance == null) {
Options options = Options.instance(context);
- String targetString = options.get("-target");
+ String targetString = options.get(TARGET);
if (targetString != null) instance = lookup(targetString);
if (instance == null) instance = DEFAULT;
context.put(targetKey, instance);
diff --git a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
index 04924fb9818a6230d14a6335f88beb6f305cd953..7e1996a45d93cc06898cdf022b00897b06575dba 100644
--- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
+++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
@@ -26,45 +26,44 @@
package com.sun.tools.javac.main;
import java.io.*;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.MissingResourceException;
+import java.util.Queue;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.annotation.processing.Processor;
+import javax.lang.model.SourceVersion;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.DiagnosticListener;
-import com.sun.tools.javac.file.JavacFileManager;
import com.sun.source.util.TaskEvent;
import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.file.JavacFileManager;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.tree.*;
+import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.parser.*;
import com.sun.tools.javac.comp.*;
import com.sun.tools.javac.jvm.*;
-
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.tree.JCTree.*;
-
import com.sun.tools.javac.processing.*;
-import javax.annotation.processing.Processor;
import static javax.tools.StandardLocation.CLASS_OUTPUT;
+import static com.sun.tools.javac.main.OptionName.*;
import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
import static com.sun.tools.javac.util.ListBuffer.lb;
-import java.util.HashMap;
-import java.util.Queue;
-import javax.lang.model.SourceVersion;
/** This class could be the main entry point for GJC when GJC is used as a
* component in a larger software system. It provides operations to
@@ -356,22 +355,22 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
Options options = Options.instance(context);
- verbose = options.get("-verbose") != null;
- sourceOutput = options.get("-printsource") != null; // used to be -s
- stubOutput = options.get("-stubs") != null;
- relax = options.get("-relax") != null;
- printFlat = options.get("-printflat") != null;
- attrParseOnly = options.get("-attrparseonly") != null;
- encoding = options.get("-encoding");
- lineDebugInfo = options.get("-g:") == null ||
- options.get("-g:lines") != null;
- genEndPos = options.get("-Xjcov") != null ||
+ verbose = options.isSet(VERBOSE);
+ sourceOutput = options.isSet(PRINTSOURCE); // used to be -s
+ stubOutput = options.isSet("-stubs");
+ relax = options.isSet("-relax");
+ printFlat = options.isSet("-printflat");
+ attrParseOnly = options.isSet("-attrparseonly");
+ encoding = options.get(ENCODING);
+ lineDebugInfo = options.isUnset(G_CUSTOM) ||
+ options.isSet(G_CUSTOM, "lines");
+ genEndPos = options.isSet(XJCOV) ||
context.get(DiagnosticListener.class) != null;
- devVerbose = options.get("dev") != null;
- processPcks = options.get("process.packages") != null;
- werror = options.get("-Werror") != null;
+ devVerbose = options.isSet("dev");
+ processPcks = options.isSet("process.packages");
+ werror = options.isSet(WERROR);
- verboseCompilePolicy = options.get("verboseCompilePolicy") != null;
+ verboseCompilePolicy = options.isSet("verboseCompilePolicy");
if (attrParseOnly)
compilePolicy = CompilePolicy.ATTR_ONLY;
@@ -381,15 +380,15 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
implicitSourcePolicy = ImplicitSourcePolicy.decode(options.get("-implicit"));
completionFailureName =
- (options.get("failcomplete") != null)
+ options.isSet("failcomplete")
? names.fromString(options.get("failcomplete"))
: null;
shouldStopPolicy =
- (options.get("shouldStopPolicy") != null)
+ options.isSet("shouldStopPolicy")
? CompileState.valueOf(options.get("shouldStopPolicy"))
: null;
- if (options.get("oldDiags") == null)
+ if (options.isUnset("oldDiags"))
log.setDiagnosticFormatter(RichDiagnosticFormatter.instance(context));
}
@@ -954,7 +953,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
// Process annotations if processing is not disabled and there
// is at least one Processor available.
Options options = Options.instance(context);
- if (options.get("-proc:none") != null) {
+ if (options.isSet(PROC, "none")) {
processAnnotations = false;
} else if (procEnvImpl == null) {
procEnvImpl = new JavacProcessingEnvironment(context, processors);
@@ -1013,7 +1012,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
// annotation processing is to occur with compilation,
// emit a warning.
Options options = Options.instance(context);
- if (options.get("-proc:only") != null) {
+ if (options.isSet(PROC, "only")) {
log.warning("proc.proc-only.requested.no.procs");
todo.clear();
}
@@ -1101,10 +1100,10 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
Options options = Options.instance(context);
return
explicitAnnotationProcessingRequested ||
- options.get("-processor") != null ||
- options.get("-processorpath") != null ||
- options.get("-proc:only") != null ||
- options.get("-Xprint") != null;
+ options.isSet(PROCESSOR) ||
+ options.isSet(PROCESSORPATH) ||
+ options.isSet(PROC, "only") ||
+ options.isSet(XPRINT);
}
/**
diff --git a/src/share/classes/com/sun/tools/javac/main/Main.java b/src/share/classes/com/sun/tools/javac/main/Main.java
index 2c89774790daf843d3f904a6e81181fccea61064..e5e53dc1ad356838db7ce358314af7479f52fd24 100644
--- a/src/share/classes/com/sun/tools/javac/main/Main.java
+++ b/src/share/classes/com/sun/tools/javac/main/Main.java
@@ -32,6 +32,9 @@ import java.net.URL;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.util.MissingResourceException;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.annotation.processing.Processor;
import com.sun.tools.javac.code.Source;
import com.sun.tools.javac.file.CacheFSInfo;
@@ -41,9 +44,8 @@ import com.sun.tools.javac.main.JavacOption.Option;
import com.sun.tools.javac.main.RecognizedOptions.OptionHelper;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.processing.AnnotationProcessingError;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.annotation.processing.Processor;
+
+import static com.sun.tools.javac.main.OptionName.*;
/** This class provides a commandline interface to the GJC compiler.
*
@@ -239,16 +241,16 @@ public class Main {
}
}
- if (!checkDirectory("-d"))
+ if (!checkDirectory(D))
return null;
- if (!checkDirectory("-s"))
+ if (!checkDirectory(S))
return null;
- String sourceString = options.get("-source");
+ String sourceString = options.get(SOURCE);
Source source = (sourceString != null)
? Source.lookup(sourceString)
: Source.DEFAULT;
- String targetString = options.get("-target");
+ String targetString = options.get(TARGET);
Target target = (targetString != null)
? Target.lookup(targetString)
: Target.DEFAULT;
@@ -285,7 +287,7 @@ public class Main {
// phase this out with JSR 292 PFD
if ("no".equals(options.get("allowTransitionalJSR292"))) {
options.put("allowTransitionalJSR292", null);
- } else if (target.hasInvokedynamic() && options.get("allowTransitionalJSR292") == null) {
+ } else if (target.hasInvokedynamic() && options.isUnset("allowTransitionalJSR292")) {
options.put("allowTransitionalJSR292", "allowTransitionalJSR292");
}
@@ -300,7 +302,7 @@ public class Main {
return filenames.toList();
}
// where
- private boolean checkDirectory(String optName) {
+ private boolean checkDirectory(OptionName optName) {
String value = options.get(optName);
if (value == null)
return true;
@@ -367,10 +369,10 @@ public class Main {
return EXIT_CMDERR;
} else if (files.isEmpty() && fileObjects.isEmpty() && classnames.isEmpty()) {
// it is allowed to compile nothing if just asking for help or version info
- if (options.get("-help") != null
- || options.get("-X") != null
- || options.get("-version") != null
- || options.get("-fullversion") != null)
+ if (options.isSet(HELP)
+ || options.isSet(X)
+ || options.isSet(VERSION)
+ || options.isSet(FULLVERSION))
return EXIT_OK;
error("err.no.source.files");
return EXIT_CMDERR;
@@ -382,7 +384,7 @@ public class Main {
return EXIT_SYSERR;
}
- boolean forceStdOut = options.get("stdout") != null;
+ boolean forceStdOut = options.isSet("stdout");
if (forceStdOut) {
out.flush();
out = new PrintWriter(System.out, true);
@@ -391,7 +393,7 @@ public class Main {
context.put(Log.outKey, out);
// allow System property in following line as a Mustang legacy
- boolean batchMode = (options.get("nonBatchMode") == null
+ boolean batchMode = (options.isUnset("nonBatchMode")
&& System.getProperty("nonBatchMode") == null);
if (batchMode)
CacheFSInfo.preRegister(context);
@@ -455,7 +457,7 @@ public class Main {
// for buggy compiler error recovery by swallowing thrown
// exceptions.
if (comp == null || comp.errorCount() == 0 ||
- options == null || options.get("dev") != null)
+ options == null || options.isSet("dev"))
bugMessage(ex);
return EXIT_ABNORMAL;
} finally {
@@ -478,7 +480,7 @@ public class Main {
*/
void feMessage(Throwable ex) {
Log.printLines(out, ex.getMessage());
- if (ex.getCause() != null && options.get("dev") != null) {
+ if (ex.getCause() != null && options.isSet("dev")) {
ex.getCause().printStackTrace(out);
}
}
diff --git a/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java b/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java
index 6b9ec8e1e54161c5308cd5db3afb7bd6a239231f..d02a9147d1dd4c49ca46af7d96380d401d799d5c 100644
--- a/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java
+++ b/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java
@@ -25,14 +25,6 @@
package com.sun.tools.javac.processing;
-import com.sun.tools.javac.util.*;
-import javax.annotation.processing.*;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.NestingKind;
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.Element;
-import java.util.*;
-
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.InputStream;
@@ -43,14 +35,26 @@ import java.io.Writer;
import java.io.FilterWriter;
import java.io.PrintWriter;
import java.io.IOException;
+import java.util.*;
-import javax.tools.*;
import static java.util.Collections.*;
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.NestingKind;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.Element;
+import javax.tools.*;
import javax.tools.JavaFileManager.Location;
+
import static javax.tools.StandardLocation.SOURCE_OUTPUT;
import static javax.tools.StandardLocation.CLASS_OUTPUT;
+import com.sun.tools.javac.code.Lint;
+import com.sun.tools.javac.util.*;
+
+import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
+
/**
* The FilerImplementation class must maintain a number of
* constraints. First, multiple attempts to open the same path within
@@ -366,7 +370,7 @@ public class JavacFiler implements Filer, Closeable {
aggregateGeneratedSourceNames = new LinkedHashSet