Skip to content

Commit

Permalink
Work around issues with plugins conflicting with classes used in the
Browse files Browse the repository at this point in the history
Error Prone API.

MOE_MIGRATED_REVID=142729297
  • Loading branch information
cushon authored and Eddie Aftandilian committed Jan 7, 2017
1 parent 600e6d6 commit cc2e663
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Expand Up @@ -20,7 +20,6 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.BugPattern.SeverityLevel;
import com.google.errorprone.dataflow.nullnesspropagation.NullnessAnalysis;
import com.google.errorprone.matchers.Description;
Expand Down Expand Up @@ -319,10 +318,10 @@ public String getSourceForNode(Tree tree) {
/**
* Returns the list of {@link Token}s for the given {@link JCTree}.
*
* <p>This is moderately expensive (the source of the node has to be re-lexed), so it should
* only be used if a fix is already going to be emitted.
* <p>This is moderately expensive (the source of the node has to be re-lexed), so it should only
* be used if a fix is already going to be emitted.
*/
public ImmutableList<ErrorProneToken> getTokensForNode(Tree tree) {
public java.util.List<ErrorProneToken> getTokensForNode(Tree tree) {
return ErrorProneTokens.getTokens(getSourceForNode(tree), context);
}

Expand Down
Expand Up @@ -148,7 +148,7 @@ public static SuggestedFix addModifiers(Tree tree, VisitorState state, Modifier.
for (Modifier mod : toAdd) {
modifierPositions.put(mod, -1);
}
ImmutableList<ErrorProneToken> tokens = state.getTokensForNode(originalModifiers);
List<ErrorProneToken> tokens = state.getTokensForNode(originalModifiers);
int base = ((JCTree) originalModifiers).getStartPosition();
for (ErrorProneToken tok : tokens) {
Modifier mod = getTokModifierKind(tok);
Expand Down Expand Up @@ -184,7 +184,7 @@ public static Fix removeModifiers(Tree tree, VisitorState state, Modifier... mod
return null;
}
SuggestedFix.Builder fix = SuggestedFix.builder();
ImmutableList<ErrorProneToken> tokens = state.getTokensForNode(originalModifiers);
List<ErrorProneToken> tokens = state.getTokensForNode(originalModifiers);
int basePos = ((JCTree) originalModifiers).getStartPosition();
boolean empty = true;
for (ErrorProneToken tok : tokens) {
Expand Down

0 comments on commit cc2e663

Please sign in to comment.