Skip to content

Commit

Permalink
Work around changes to Source constants in JDK 10
Browse files Browse the repository at this point in the history
MOE_MIGRATED_REVID=207597981
  • Loading branch information
cushon committed Aug 6, 2018
1 parent 8fc5373 commit 564dbd3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private Fix buildFix(NewClassTree tree, VisitorState state) {
}

private static boolean shouldUseGuavaHashCode(Context context) {
return Source.instance(context).compareTo(Source.JDK1_7) <= 0; // 7 or below
return Source.instance(context).compareTo(Source.lookup("1.7")) <= 0; // 7 or below
}

private String maybeCast(VisitorState state, Type type, Type argType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ boolean forLoopVariable(VariableTree tree, TreePath path) {

private Description handleLocalOrParam(VariableTree tree, VisitorState state, Symbol sym) {
if (sym.getModifiers().contains(Modifier.FINAL)) {
if (Source.instance(state.context).allowEffectivelyFinalInInnerClasses()) {
if (Source.instance(state.context).compareTo(Source.lookup("1.8")) >= 0) {
// In Java 8, the final modifier is never necessary on locals/parameters because
// effectively final variables can be used anywhere a final variable is required.
Optional<SuggestedFix> fix = SuggestedFixes.removeModifiers(tree, state, Modifier.FINAL);
Expand Down

0 comments on commit 564dbd3

Please sign in to comment.