0 Replies Latest reply: Nov 25, 2009 3:51 AM by 843810 RSS

    How do I change javac compile policy

    843810
      private void compile2() {
                try {
                     switch (compilePolicy) {
                     case ATTR_ONLY:
                          attribute(todo);
                          break;

                     case CHECK_ONLY:
                          Queue<Env<AttrContext>> trees = flow(attribute(todo));
                          if(trees.peek() != null) {
                          new UnParser(trees.peek().toplevel,this.context);
                          }
      //                    wrapperObj.dumpToBDF(unparserObj.fileName);
      //                    wrapperObj.dumpToCDIF(unparserObj.fileName);
                          break;

                     case SIMPLE:
                          generate(desugar(flow(attribute(todo))));
                          break;

                     case BY_FILE: {
                          Queue<Queue<Env<AttrContext>>> q = todo.groupByFile();
                          while (!q.isEmpty() && errorCount() == 0) {
                               generate(desugar(flow(attribute(q.remove()))));
                          }
                     }
                     break;

                     case BY_TODO:
                          while (!todo.isEmpty())
                          {
                               generate(desugar(flow(attribute(todo.remove()))));
                          }
                          break;

                     default:
                          assert false: "unknown compile policy";
                     }
                } catch (Abort ex) {
                     if (devVerbose)
                          ex.printStackTrace();
                }

                if (verbose) {
                     elapsed_msec = elapsed(start_msec);
                     printVerbose("total", Long.toString(elapsed_msec));
                }

                reportDeferredDiagnostics();

                if (!log.hasDiagnosticListener()) {
                     printCount("error", errorCount());
                     printCount("warn", warningCount());
                }
           }

      This piece code is taken from javac source code. It uses different compile policies. The default compile policy is "BY_TODO". Can you please help me understand the significance of each these policies and steps to invoke them from command line? Any help will be appreciated. Thanks.