8149772: cleanup handling of -encoding in JavacFileManager
Reviewed-by: jlahoda
This commit is contained in:
parent
68832ef0f6
commit
bf5a096440
@ -267,7 +267,14 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
* @return true if successful, and false otherwise
|
||||
*/
|
||||
public boolean handleOption(Option option, String value) {
|
||||
return locations.handleOption(option, value);
|
||||
switch (option) {
|
||||
case ENCODING:
|
||||
encodingName = value;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return locations.handleOption(option, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,6 +292,7 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Encoding">
|
||||
private String encodingName;
|
||||
private String defaultEncodingName;
|
||||
private String getDefaultEncodingName() {
|
||||
if (defaultEncodingName == null) {
|
||||
@ -295,11 +303,7 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
}
|
||||
|
||||
public String getEncodingName() {
|
||||
String encName = options.get(Option.ENCODING);
|
||||
if (encName == null)
|
||||
return getDefaultEncodingName();
|
||||
else
|
||||
return encName;
|
||||
return (encodingName != null) ? encodingName : getDefaultEncodingName();
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
|
@ -389,7 +389,6 @@ public class JavaCompiler {
|
||||
|
||||
verbose = options.isSet(VERBOSE);
|
||||
sourceOutput = options.isSet(PRINTSOURCE); // used to be -s
|
||||
encoding = options.get(ENCODING);
|
||||
lineDebugInfo = options.isUnset(G_CUSTOM) ||
|
||||
options.isSet(G_CUSTOM, "lines");
|
||||
genEndPos = options.isSet(XJCOV) ||
|
||||
@ -444,9 +443,6 @@ public class JavaCompiler {
|
||||
*/
|
||||
public boolean sourceOutput;
|
||||
|
||||
/** The encoding to be used for source input.
|
||||
*/
|
||||
public String encoding;
|
||||
|
||||
/** Generate code with the LineNumberTable attribute for debugging
|
||||
*/
|
||||
|
@ -238,13 +238,7 @@ public enum Option {
|
||||
|
||||
IMPLICIT("-implicit:", "opt.implicit", STANDARD, BASIC, ONEOF, "none", "class"),
|
||||
|
||||
ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option, String operand) {
|
||||
return super.process(helper, option, operand);
|
||||
}
|
||||
|
||||
},
|
||||
ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER),
|
||||
|
||||
SOURCE("-source", "opt.arg.release", "opt.source", STANDARD, BASIC) {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user