1 /* |
1 /* |
2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2006, 2012, 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. |
45 |
45 |
46 public class T6348499 { |
46 public class T6348499 { |
47 public static void main(String... args) { |
47 public static void main(String... args) { |
48 String testSrc = System.getProperty("test.src", "."); |
48 String testSrc = System.getProperty("test.src", "."); |
49 String testClasses = System.getProperty("test.classes"); |
49 String testClasses = System.getProperty("test.classes"); |
|
50 String testClassPath = System.getProperty("test.class.path", testClasses); |
50 String A_java = new File(testSrc, "A.java").getPath(); |
51 String A_java = new File(testSrc, "A.java").getPath(); |
51 JavacTool tool = JavacTool.create(); |
52 JavacTool tool = JavacTool.create(); |
52 MyDiagListener dl = new MyDiagListener(); |
53 MyDiagListener dl = new MyDiagListener(); |
53 StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null); |
54 StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null); |
54 Iterable<? extends JavaFileObject> files = |
55 Iterable<? extends JavaFileObject> files = |
55 fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "A.java"))); |
56 fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "A.java"))); |
56 Iterable<String> opts = Arrays.asList("-proc:only", |
57 Iterable<String> opts = Arrays.asList("-proc:only", |
57 "-processor", "A", |
58 "-processor", "A", |
58 "-processorpath", testClasses); |
59 "-processorpath", testClassPath); |
59 StringWriter out = new StringWriter(); |
60 StringWriter out = new StringWriter(); |
60 JavacTask task = tool.getTask(out, fm, dl, opts, null, files); |
61 JavacTask task = tool.getTask(out, fm, dl, opts, null, files); |
61 task.call(); |
62 task.call(); |
62 String s = out.toString(); |
63 String s = out.toString(); |
63 System.err.print(s); |
64 System.err.print(s); |