/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Provides access to functionality specific to the JDK Java Compiler, javac.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own
* risk. This code and its internal interfaces are subject to change
* or deletion without notice.</b></p>
*
* @author Peter von der Ahé
* @author Jonathan Gibbons
*/
String[] classNames,
this.compilerMain = compilerMain;
this.classNames = classNames;
this.fileObjects = fileObjects;
// null checks
}
}
}
if (fileObjects == null)
}
initContext();
compilerMain.setAPIMode(true);
cleanup();
return result == 0;
} else {
throw new IllegalStateException("multiple calls to method 'call'");
}
}
// not mt-safe
throw new IllegalStateException();
this.processors = processors;
}
throw new IllegalStateException();
}
throw new IllegalStateException();
} else {
initContext();
compiler.keepComments = true;
// NOTE: this value will be updated after annotation processing
// endContext will be called when all classes have been generated
// TODO: should handle the case after each phase if errors have occurred
classNames = null;
}
}
}
}
private void initContext() {
if (taskListener != null)
//initialize compiler's default locale
}
void cleanup() {
compilerMain = null;
classNames = null;
fileObjects = null;
}
/**
* Construct a JavaFileObject from the given file.
*
* <p><b>TODO: this method is useless here</b></p>
*
* @param file a file
* @return a JavaFileObject from the standard file manager.
*/
}
this.taskListener = taskListener;
}
/**
* Parse the specified files returning a list of abstract syntax trees.
*
* @throws java.io.IOException TODO
* @return a list of abstract syntax trees
*/
try {
}
return units;
}
finally {
parsed = true;
}
}
private boolean parsed = false;
/**
* Translate all the abstract syntax trees to elements.
*
* @throws IOException TODO
* @return a list of elements corresponding to the top level
* classes in the abstract syntax trees
*/
}
/**
* Translate the given abstract syntax trees to elements.
*
* @param trees a list of abstract syntax trees.
* @throws java.io.IOException TODO
* @return a list of elements corresponding to the top level
* classes in the abstract syntax trees
*/
throws IOException
{
// If there are still files which were specified to be compiled
// (i.e. in fileObjects) but which have not yet been entered,
// then we make sure they have been parsed and add them to the
// list to be entered.
if (!parsed)
parse(); // TODO would be nice to specify files needed to be parsed
}
}
}
}
else {
if (cu instanceof JCCompilationUnit) {
}
else
}
}
try {
if (notYetEntered.isEmpty())
}
}
}
}
finally {
}
}
/**
* Complete all analysis.
* @throws IOException TODO
*/
}
/**
* Complete all analysis on the given classes.
* This can be used to ensure that all compile time errors are reported.
* The classes must have previously been returned from {@link #enter}.
* If null is specified, all outstanding classes will be analyzed.
*
* @param classes a list of class elements
*/
// This implementation requires that we open up privileges on JavaCompiler.
// An alternative implementation would be to move this code to JavaCompiler and
// wrap it here
public Iterable<? extends Element> analyze(Iterable<? extends TypeElement> classes) throws IOException {
try {
} else {
}
};
}
} finally {
}
return results;
}
// where
break;
break;
}
}
}
/**
* Generate code.
* @throws IOException TODO
*/
}
/**
* Generate code corresponding to the given classes.
* The classes must have previously been returned from {@link #enter}.
* If there are classes outstanding to be analyzed, that will be done before
* any classes are generated.
* If null is specified, code will be generated for all outstanding classes.
*
* @param classes a list of class elements
*/
public Iterable<? extends JavaFileObject> generate(Iterable<? extends TypeElement> classes) throws IOException {
try {
}
else {
}
};
}
cleanup();
}
}
finally {
}
return results;
}
// TODO: Should complete attribution if necessary
}
throw new IllegalStateException();
}
throw new IllegalStateException();
}
}
abstract class Filter {
else
}
}
}
/**
* For internal use only. This method will be
* removed without warning.
*/
return context;
}
/**
* For internal use only. This method will be
* removed without warning.
*/
}
/**
* For internal use only. This method will be
* removed without warning.
*/
throw new IllegalArgumentException();
try {
} finally {
}
}
}