JDK-6988436 : Cleanup javac option handling
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-09-29
  • Updated: 2011-05-18
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b114Fixed
Description
javac provides option handling through the Options class. Initially, all options were only identified by strings.  In JDK 6, the enum OptionName was added as part of the impl JSR 199. The Options.get method is now overloaded for either String or OptionName arguments.  For the standard options, it would be good to use the OptionName variant. This helps identify the use of standard options, and minimizes the risk of spelling errors in the strings.

The list of candidate sites is as follows:

Main.java:304: could use OptionName.D
Main.java:304: could use OptionName.S
Main.java:247: could use OptionName.SOURCE
Main.java:251: could use OptionName.TARGET
Log.java:132: could use OptionName.DOE
Log.java:133: could use OptionName.PROMPT
Log.java:154: could use OptionName.XMAXERRS
Log.java:154: could use OptionName.XMAXWARNS
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Lint.java:106: could use OptionName.XLINT
Target.java:76: could use OptionName.TARGET
Source.java:74: could use OptionName.SOURCE
Check.java:102: could use OptionName.COMPLEXINFERENCE
ClassReader.java:262: could use OptionName.VERBOSE
ClassWriter.java:182: could use OptionName.VERBOSE
ClassWriter.java:186: could use OptionName.XJCOV
ClassWriter.java:189: could use OptionName.G_CUSTOM
Gen.java:115: could use OptionName.G_CUSTOM
Gen.java:118: could use OptionName.G_CUSTOM
Gen.java:122: could use OptionName.XJCOV
JavaCompiler.java:359: could use OptionName.VERBOSE
JavaCompiler.java:360: could use OptionName.PRINTSOURCE
JavaCompiler.java:365: could use OptionName.ENCODING
JavaCompiler.java:366: could use OptionName.G_CUSTOM
JavaCompiler.java:368: could use OptionName.XJCOV
JavaCompiler.java:372: could use OptionName.WERROR
JavacProcessingEnvironment.java:163: could use OptionName.XPRINTPROCESSORINFO
JavacProcessingEnvironment.java:164: could use OptionName.XPRINTROUNDS
JavacProcessingEnvironment.java:165: could use OptionName.VERBOSE
JavacProcessingEnvironment.java:166: could use OptionName.XLINT
JavacProcessingEnvironment.java:167: could use OptionName.XPRINT
JavacProcessingEnvironment.java:171: could use OptionName.WERROR
JavacFiler.java:369: could use OptionName.XLINT
JavacProcessingEnvironment.java:203: could use OptionName.XPRINT
JavacProcessingEnvironment.java:216: could use OptionName.PROCESSOR
In addition, the large number of calls of the form 
	options.get("foo") != null
makes it worth adding convenience routines like
	options.isSet("foo")

Comments
EVALUATION Yes
30-09-2010