langtools/test/tools/javac/api/TestJavacTask_Multiple.java
changeset 27319 030080f03e4f
parent 9744 3e48977e539d
child 30730 d3ce7619db2c
equal deleted inserted replaced
27318:4660a5da7d90 27319:030080f03e4f
     1 /*
     1 /*
     2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2014, 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.
    66     int count;
    66     int count;
    67 
    67 
    68     void run() throws Exception {
    68     void run() throws Exception {
    69         JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
    69         JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
    70         StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
    70         StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
    71         for (TestKind tk: TestKind.values()) {
    71         try {
    72             test(comp, fm, tk);
    72             for (TestKind tk: TestKind.values()) {
       
    73                 test(comp, fm, tk);
       
    74             }
       
    75 
       
    76             int expect = TestKind.values().length * MAX_TASKS;
       
    77             if (count != expect) {
       
    78                 throw new Exception("Unexpected number of tests completed: " + count
       
    79                         + ", expected: " + expect);
       
    80             }
       
    81         } finally {
       
    82             fm.close();
    73         }
    83         }
    74 
       
    75         int expect = TestKind.values().length * MAX_TASKS;
       
    76         if (count != expect) {
       
    77             throw new Exception("Unexpected number of tests completed: " + count
       
    78                     + ", expected: " + expect);
       
    79         }
       
    80 
       
    81     }
    84     }
    82 
    85 
    83     void test(JavaCompiler comp, StandardJavaFileManager fm, TestKind tk) {
    86     void test(JavaCompiler comp, StandardJavaFileManager fm, TestKind tk) {
    84         System.err.println("test " + tk);
    87         System.err.println("test " + tk);
    85         File testSrc = new File(System.getProperty("test.src"));
    88         File testSrc = new File(System.getProperty("test.src"));