src/share/classes/com/sun/tools/javac/main/JavaCompiler.java

changeset 2047
5f915a0c9615
parent 2007
a76c663a9cac
child 2082
c0d44b1e6b6a
     1.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Sep 23 10:10:07 2013 +0200
     1.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Sep 23 10:42:38 2013 +0200
     1.3 @@ -67,7 +67,6 @@
     1.4  import static com.sun.tools.javac.code.TypeTag.CLASS;
     1.5  import static com.sun.tools.javac.main.Option.*;
     1.6  import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
     1.7 -import static com.sun.tools.javac.util.ListBuffer.lb;
     1.8  
     1.9  
    1.10  /** This class could be the main entry point for GJC when GJC is used as a
    1.11 @@ -586,7 +585,7 @@
    1.12      }
    1.13  
    1.14      protected final <T> Queue<T> stopIfError(CompileState cs, Queue<T> queue) {
    1.15 -        return shouldStop(cs) ? ListBuffer.<T>lb() : queue;
    1.16 +        return shouldStop(cs) ? new ListBuffer<T>() : queue;
    1.17      }
    1.18  
    1.19      protected final <T> List<T> stopIfError(CompileState cs, List<T> list) {
    1.20 @@ -952,7 +951,7 @@
    1.21             return List.nil();
    1.22  
    1.23          //parse all files
    1.24 -        ListBuffer<JCCompilationUnit> trees = lb();
    1.25 +        ListBuffer<JCCompilationUnit> trees = new ListBuffer<>();
    1.26          Set<JavaFileObject> filesSoFar = new HashSet<JavaFileObject>();
    1.27          for (JavaFileObject fileObject : fileObjects) {
    1.28              if (!filesSoFar.contains(fileObject)) {
    1.29 @@ -1002,7 +1001,7 @@
    1.30          // then remember the classes declared in
    1.31          // the original compilation units listed on the command line.
    1.32          if (needRootClasses || sourceOutput || stubOutput) {
    1.33 -            ListBuffer<JCClassDecl> cdefs = lb();
    1.34 +            ListBuffer<JCClassDecl> cdefs = new ListBuffer<>();
    1.35              for (JCCompilationUnit unit : roots) {
    1.36                  for (List<JCTree> defs = unit.defs;
    1.37                       defs.nonEmpty();
    1.38 @@ -1226,7 +1225,7 @@
    1.39       * @returns a list of environments for attributd classes.
    1.40       */
    1.41      public Queue<Env<AttrContext>> attribute(Queue<Env<AttrContext>> envs) {
    1.42 -        ListBuffer<Env<AttrContext>> results = lb();
    1.43 +        ListBuffer<Env<AttrContext>> results = new ListBuffer<>();
    1.44          while (!envs.isEmpty())
    1.45              results.append(attribute(envs.remove()));
    1.46          return stopIfError(CompileState.ATTR, results);
    1.47 @@ -1291,7 +1290,7 @@
    1.48       * @returns the list of attributed parse trees
    1.49       */
    1.50      public Queue<Env<AttrContext>> flow(Queue<Env<AttrContext>> envs) {
    1.51 -        ListBuffer<Env<AttrContext>> results = lb();
    1.52 +        ListBuffer<Env<AttrContext>> results = new ListBuffer<>();
    1.53          for (Env<AttrContext> env: envs) {
    1.54              flow(env, results);
    1.55          }
    1.56 @@ -1302,7 +1301,7 @@
    1.57       * Perform dataflow checks on an attributed parse tree.
    1.58       */
    1.59      public Queue<Env<AttrContext>> flow(Env<AttrContext> env) {
    1.60 -        ListBuffer<Env<AttrContext>> results = lb();
    1.61 +        ListBuffer<Env<AttrContext>> results = new ListBuffer<>();
    1.62          flow(env, results);
    1.63          return stopIfError(CompileState.FLOW, results);
    1.64      }
    1.65 @@ -1356,7 +1355,7 @@
    1.66       * @returns a list containing the classes to be generated
    1.67       */
    1.68      public Queue<Pair<Env<AttrContext>, JCClassDecl>> desugar(Queue<Env<AttrContext>> envs) {
    1.69 -        ListBuffer<Pair<Env<AttrContext>, JCClassDecl>> results = lb();
    1.70 +        ListBuffer<Pair<Env<AttrContext>, JCClassDecl>> results = new ListBuffer<>();
    1.71          for (Env<AttrContext> env: envs)
    1.72              desugar(env, results);
    1.73          return stopIfError(CompileState.FLOW, results);
    1.74 @@ -1605,7 +1604,7 @@
    1.75                  }
    1.76                  @Override
    1.77                  public void visitClassDef(JCClassDecl tree) {
    1.78 -                    ListBuffer<JCTree> newdefs = lb();
    1.79 +                    ListBuffer<JCTree> newdefs = new ListBuffer<>();
    1.80                      for (List<JCTree> it = tree.defs; it.tail != null; it = it.tail) {
    1.81                          JCTree t = it.head;
    1.82                          switch (t.getTag()) {

mercurial