src/share/classes/javax/tools/JavaCompiler.java

changeset 1326
30c36e23f154
parent 1073
f85d980faaf8
child 1413
bdcef2ef52d2
equal deleted inserted replaced
1325:b2064a216117 1326:30c36e23f154
1 /* 1 /*
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 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. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
135 * JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); 135 * JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
136 * {@code DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();} 136 * {@code DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();}
137 * StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null); 137 * StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
138 * compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits).call(); 138 * compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits).call();
139 * 139 *
140 * for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) 140 * for ({@code Diagnostic<? extends JavaFileObject>} diagnostic : diagnostics.getDiagnostics())
141 * System.out.format("Error on line %d in %s%n", 141 * System.out.format("Error on line %d in %s%n",
142 * diagnostic.getLineNumber(), 142 * diagnostic.getLineNumber(),
143 * diagnostic.getSource().toUri()); 143 * diagnostic.getSource().toUri());
144 * 144 *
145 * fileManager.close();</pre> 145 * fileManager.close();</pre>

mercurial