langtools/test/tools/javac/failover/CheckAttributedTree.java
changeset 29776 984a79b71cfe
parent 26264 a09fedde76be
child 30730 d3ce7619db2c
equal deleted inserted replaced
29775:dc7df633fea1 29776:984a79b71cfe
     1 /*
     1 /*
     2  * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 6970584 8006694
    26  * @bug 6970584 8006694 8062373
    27  * @summary assorted position errors in compiler syntax trees
    27  * @summary assorted position errors in compiler syntax trees
    28  *  temporarily workaround combo tests are causing time out in several platforms
    28  *  temporarily workaround combo tests are causing time out in several platforms
    29  * @library ../lib
    29  * @library ../lib
    30  * @build JavacTestingAbstractThreadedTest
    30  * @build JavacTestingAbstractThreadedTest
    31  * @run main/othervm CheckAttributedTree -q -r -et ERRONEOUS .
    31  * @run main/othervm CheckAttributedTree -q -r -et ERRONEOUS .
   288                 if (e.getKind() == TaskEvent.Kind.ANALYZE)
   288                 if (e.getKind() == TaskEvent.Kind.ANALYZE)
   289                     analyzedElems.add(e.getTypeElement());
   289                     analyzedElems.add(e.getTypeElement());
   290             }
   290             }
   291             public void finished(TaskEvent e) { }
   291             public void finished(TaskEvent e) { }
   292         });
   292         });
   293 
   293         int i = 0;
   294         try {
   294         try {
   295             Iterable<? extends CompilationUnitTree> trees = task.parse();
   295             Iterable<? extends CompilationUnitTree> trees = task.parse();
   296 //            JavaCompiler c = JavaCompiler.instance(((JavacTaskImpl) task).getContext());
   296 //            JavaCompiler c = JavaCompiler.instance(((JavacTaskImpl) task).getContext());
   297 //            System.err.println("verboseCompilePolicy: " + c.verboseCompilePolicy);
   297 //            System.err.println("verboseCompilePolicy: " + c.verboseCompilePolicy);
   298 //            System.err.println("shouldStopIfError: " + c.shouldStopPolicyIfError);
   298 //            System.err.println("shouldStopIfError: " + c.shouldStopPolicyIfError);
   306                JCCompilationUnit cu = (JCCompilationUnit)t;
   306                JCCompilationUnit cu = (JCCompilationUnit)t;
   307                for (JCTree def : cu.defs) {
   307                for (JCTree def : cu.defs) {
   308                    if (def.hasTag(CLASSDEF) &&
   308                    if (def.hasTag(CLASSDEF) &&
   309                            analyzedElems.contains(((JCTree.JCClassDecl)def).sym)) {
   309                            analyzedElems.contains(((JCTree.JCClassDecl)def).sym)) {
   310                        //System.err.println("Adding pair..." + cu.sourcefile + " " + ((JCTree.JCClassDecl) def).name);
   310                        //System.err.println("Adding pair..." + cu.sourcefile + " " + ((JCTree.JCClassDecl) def).name);
   311                        res.add(new Pair<>(cu, def));
   311                        res.add((i++ % 2) == 0 ? new Pair<>(cu, def) {} : new Pair<>(cu, def));
   312                    }
   312                    }
   313                }
   313                }
   314             }
   314             }
   315             return res;
   315             return res;
   316         }
   316         }