code: Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) {
          Env<AttrContext> localEnv =
              env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym)));
          localEnv.enclMethod = tree;
          if (tree.sym.type != null) {
              //when this is called in the enter stage, there's no type to be set
              localEnv.info.returnResult = attr.new ResultInfo(KindSelector.VAL,
                                                               tree.sym.type.getReturnType());
          }
          if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++;
          return localEnv;
      }
docs: Create a fresh environment for method bodies.
  @param tree     The method definition.
  @param env      The environment current outside of the method definition.