code: public static DiagnosticPosition diagnosticPositionFor(final Symbol sym, final JCTree tree) {
          JCTree decl = declarationFor(sym, tree);
          return ((decl != null) ? decl : tree).pos();
      }
docs: Find the position for reporting an error about a symbol, where
  that symbol is defined somewhere in the given tree.