code: JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
          return attribSpeculative(tree, env, resultInfo, treeCopier,
                  (newTree)->new DeferredAttrDiagHandler(log, newTree), null);
      }
docs: Routine that performs speculative type-checking; the input AST node is
  cloned (to avoid side-effects cause by Attr) and compiler state is
  restored after type-checking. All diagnostics (but critical ones) are
  disabled during speculative type-checking.