docs: private static boolean localVariableMatches(VariableTree tree, VisitorState state) {
      ExpressionTree expression = tree.getInitializer();
      if (expression == null) {
        Tree leaf = state.getPath().getParentPath().getLeaf();
        if (!(leaf instanceof EnhancedForLoopTree)) {
          return true;
        }
        EnhancedForLoopTree node = (EnhancedForLoopTree) leaf;
        Type expressionType = ASTHelpers.getType(node.getExpression());
        if (expressionType == null) {
          return false;
        }
        Type elemtype = state.getTypes().elemtype(expressionType);
        // Be conservative - if elemtype is null, treat it as if it is a loop over a wrapped type.
        return elemtype != null && elemtype.isPrimitive();
      }
      Type initializerType = ASTHelpers.getType(expression);
      if (initializerType == null) {
        return false;
      }
      if (initializerType.isPrimitive()) {
        return true;
      }
      // Don't count X.valueOf(...) as a boxed usage, since it can be replaced with X.parseX.
      return VALUE_OF_MATCHER.matches(expression, state);
    }