-
Notifications
You must be signed in to change notification settings - Fork 744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --release
flag support
#1473
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,7 @@ | |
import com.sun.tools.javac.code.Type; | ||
import com.sun.tools.javac.code.Types.DefaultTypeVisitor; | ||
import com.sun.tools.javac.main.Arguments; | ||
import com.sun.tools.javac.main.Option; | ||
import com.sun.tools.javac.parser.Tokens; | ||
import com.sun.tools.javac.parser.Tokens.Comment; | ||
import com.sun.tools.javac.parser.Tokens.TokenKind; | ||
|
@@ -1023,11 +1024,17 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept | |
Options originalOptions = Options.instance(javacTask.getContext()); | ||
for (String key : originalOptions.keySet()) { | ||
String value = originalOptions.get(key); | ||
if (key.equals("-Xplugin:") && value.startsWith("ErrorProne")) { | ||
if (key.equals(Option.PLUGIN.getPrimaryName()) && value.startsWith("ErrorProne")) { | ||
// When using the -Xplugin Error Prone integration, disable Error Prone for speculative | ||
// recompiles to avoid infinite recursion. | ||
continue; | ||
} | ||
if ((key.equals(Option.SOURCE.getPrimaryName()) || key.equals(Option.TARGET.getPrimaryName())) | ||
&& originalOptions.isSet(Option.RELEASE)) { | ||
Comment on lines
+1032
to
+1033
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code can be optimized by factoring out |
||
// javac does not allow -source and -target to be specified explicitly when --release is, | ||
// but does add them in response to passing --release. Here we invert that operation. | ||
continue; | ||
} | ||
options.put(key, value); | ||
} | ||
JavacTask newTask = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather use the string names of the flags here.
com.sun.tools.javac.main.Optionn
is an unsupported internal API that has changed in the past, and the literal flag names are part of javac's supported API.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack! Since you assigned the PR to yourself: want me to update this, or have you already applied those changes internally?