ToStringKind isToString ( Tree parent , ExpressionTree tree , VisitorState state ) { // is the enclosing expression string concat? if ( isStringConcat ( parent , state ) ) { return ToStringKind . IMPLICIT ; } if ( parent instanceof ExpressionTree ) { ExpressionTree parentExpression = ( ExpressionTree ) parent ; // the enclosing method is print() or println() if ( PRINT_STRING . matches ( parentExpression , state ) ) { return ToStringKind . IMPLICIT ; } // the enclosing method is String.valueOf() if ( VALUE_OF . matches ( parentExpression , state ) ) { return ToStringKind . EXPLICIT ; } } return ToStringKind . NONE ; }
Classifies expressions that are converted to strings by their enclosing expression .