Tree#toString shouldn’t be used for Trees deriving from the code being
compiled, as it discards whitespace and comments.
This check only runs inside Error Prone code. Suggested replacements include:
VisitorState#getConstantExpression for escaping constants in
generated code.VisitorState#getSourceForNode : it will give you the original source text.
Note that for synthetic trees (e.g.: implicit constructors), that source may
be null.this and super, try tree.getName().contentEquals("this")ASTHelpers.getSymbol(tree).getSimpleName().toString()Suppress false positives by adding the suppression annotation @SuppressWarnings("TreeToString") to the enclosing element.