/**
     * Get the context for the next round of processing. Important values are propogated from round
     * to round; other values are implicitly reset.
     */
    private Context nextContext() {
      Context next = new Context(context);

      Options options = Options.instance(context);
      Assert.checkNonNull(options);
      next.put(Options.optionsKey, options);

      PrintWriter out = context.get(Log.outKey);
      Assert.checkNonNull(out);
      next.put(Log.outKey, out);
      Locale locale = context.get(Locale.class);
      if (locale != null) next.put(Locale.class, locale);
      Assert.checkNonNull(messages);
      next.put(JavacMessages.messagesKey, messages);

      final boolean shareNames = true;
      if (shareNames) {
        Names names = Names.instance(context);
        Assert.checkNonNull(names);
        next.put(Names.namesKey, names);
      }

      DiagnosticListener<?> dl = context.get(DiagnosticListener.class);
      if (dl != null) next.put(DiagnosticListener.class, dl);

      TaskListener tl = context.get(TaskListener.class);
      if (tl != null) next.put(TaskListener.class, tl);

      FSInfo fsInfo = context.get(FSInfo.class);
      if (fsInfo != null) next.put(FSInfo.class, fsInfo);

      JavaFileManager jfm = context.get(JavaFileManager.class);
      Assert.checkNonNull(jfm);
      next.put(JavaFileManager.class, jfm);
      if (jfm instanceof JavacFileManager) {
        ((JavacFileManager) jfm).setContext(next);
      }

      Names names = Names.instance(context);
      Assert.checkNonNull(names);
      next.put(Names.namesKey, names);

      Keywords keywords = Keywords.instance(context);
      Assert.checkNonNull(keywords);
      next.put(Keywords.keywordsKey, keywords);

      JavaCompiler oldCompiler = JavaCompiler.instance(context);
      JavaCompiler nextCompiler = JavaCompiler.instance(next);
      nextCompiler.initRound(oldCompiler);

      filer.newRound(next);
      messager.newRound(next);
      elementUtils.setContext(next);
      typeUtils.setContext(next);

      JavacTaskImpl task = context.get(JavacTaskImpl.class);
      if (task != null) {
        next.put(JavacTaskImpl.class, task);
        task.updateContext(next);
      }

      JavacTrees trees = context.get(JavacTrees.class);
      if (trees != null) {
        next.put(JavacTrees.class, trees);
        trees.updateContext(next);
      }

      context.clear();
      return next;
    }