code: public Item genExpr(JCTree tree, Type pt) {
          Type prevPt = this.pt;
          try {
              if (tree.type.constValue() != null) {
                  // Short circuit any expressions which are constants
                  tree.accept(classReferenceVisitor);
                  checkStringConstant(tree.pos(), tree.type.constValue());
                  result = items.makeImmediateItem(tree.type, tree.type.constValue());
              } else {
                  this.pt = pt;
                  tree.accept(this);
              }
              return result.coerce(pt);
          } catch (CompletionFailure ex) {
              chk.completionError(tree.pos(), ex);
              code.state.stacksize = 1;
              return items.makeStackItem(pt);
          } finally {
              this.pt = prevPt;
          }
      }
docs: Visitor method: generate code for an expression, catching and reporting
  any completion failures.
  @param tree    The expression to be visited.
  @param pt      The expression's expected type (proto-type).