1 /** 2 * @(#)JavacTask.java 1.5 06/06/25 3 * 4 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 * 7 * Use and Distribution is subject to the Java Research License available 8 * at <http://wwws.sun.com/software/communitysource/jrl.html>. 9 */ 10 11 package com.sun.source.util; 12 13 import com.sun.source.tree.CompilationUnitTree; 14 import com.sun.source.tree.Tree; 15 import java.io.IOException; 16 import javax.lang.model.element.Element; 17 import javax.lang.model.type.TypeMirror; 18 import javax.lang.model.util.Elements; 19 import javax.lang.model.util.Types; 20 import javax.tools.JavaCompiler.CompilationTask; 21 import javax.tools.JavaFileObject; 22 23 /** 24 * Provides access to functionality specific to the Sun Java Compiler, javac. 25 * 26 * @author Peter von der Ahé 27 * @author Jonathan Gibbons 28 * @since 1.6 29 */ 30 public abstract class JavacTask implements CompilationTask { 31 32 /** 33 * Parse the specified files returning a list of abstract syntax trees. 34 * 35 * @return a list of abstract syntax trees 36 * @throws IOException if an unhandled I/O error occurred in the compiler. 37 */ 38 public abstract Iterable<? extends CompilationUnitTree> parse() 39 throws IOException; 40 41 /** 42 * Complete all analysis. 43 * 44 * @return a list of elements that were analyzed 45 * @throws IOException if an unhandled I/O error occurred in the compiler. 46 */ 47 public abstract Iterable<? extends Element> analyze() throws IOException; 48 49 /** 50 * Generate code. 51 * 52 * @return a list of files that were generated 53 * @throws IOException if an unhandled I/O error occurred in the compiler. 54 */ 55 public abstract Iterable<? extends JavaFileObject> generate() throws IOException; 56 57 /** 58 * The specified listener will receive events describing the progress of 59 * this compilation task. 60 */ 61 public abstract void setTaskListener(TaskListener taskListener); 62 63 /** 64 * Get a type mirror of the tree node determined by the specified path. 65 */ 66 public abstract TypeMirror getTypeMirror(Iterable<? extends Tree> path); 67 /** 68 * Get a utility object for dealing with program elements. 69 */ 70 public abstract Elements getElements(); 71 72 /** 73 * Get a utility object for dealing with type mirrors. 74 */ 75 public abstract Types getTypes(); 76 } 77