langtools/test/tools/javac/processing/options/testCommandLineClasses/Test.java
changeset 27319 030080f03e4f
parent 14963 974d4423c999
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.
    65     }
    65     }
    66 
    66 
    67     void test(List<String> names) throws Exception {
    67     void test(List<String> names) throws Exception {
    68         System.err.println("test: " + names);
    68         System.err.println("test: " + names);
    69         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    69         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    70         StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
    70         try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
    71         File testClasses = new File(System.getProperty("test.classes"));
    71             File testClasses = new File(System.getProperty("test.classes"));
    72         fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses));
    72             fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses));
    73         JavaCompiler.CompilationTask task = compiler.getTask(
    73             JavaCompiler.CompilationTask task = compiler.getTask(
    74                 null, null, null, Arrays.asList("-proc:only"), names, null);
    74                     null, null, null, Arrays.asList("-proc:only"), names, null);
    75         task.setProcessors(Arrays.asList(new Test()));
    75             task.setProcessors(Arrays.asList(new Test()));
    76         boolean ok = task.call();
    76             boolean ok = task.call();
    77         if (!ok)
    77             if (!ok)
    78             error("compilation failed");
    78                 error("compilation failed");
    79         System.err.println();
    79             System.err.println();
       
    80         }
    80     }
    81     }
    81 
    82 
    82     <T> List<T> reverse(List<T> list) {
    83     <T> List<T> reverse(List<T> list) {
    83         List<T> newList = new ArrayList<T>(list);
    84         List<T> newList = new ArrayList<T>(list);
    84         Collections.reverse(newList);
    85         Collections.reverse(newList);