Initial load

This commit is contained in:
J. Duke 2007-12-01 00:00:00 +00:00
parent 686d76f772
commit f57b87e8f6
2973 changed files with 295817 additions and 0 deletions

View file

@ -0,0 +1,48 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for an annotation.
*
* For example:
* <pre>
* {@code @}<em>annotationType</em>
* {@code @}<em>annotationType</em> ( <em>arguments</em> )
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 9.7"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface AnnotationTree extends ExpressionTree {
Tree getAnnotationType();
List<? extends ExpressionTree> getArguments();
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an array access expression.
*
* For example:
* <pre>
* <em>expression</em> [ <em>index</em> ]
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.13"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ArrayAccessTree extends ExpressionTree {
ExpressionTree getExpression();
ExpressionTree getIndex();
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an array type.
*
* For example:
* <pre>
* <em>type</em> []
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 10.1"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ArrayTypeTree extends Tree {
Tree getType();
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an 'assert' statement.
*
* For example:
* <pre>
* assert <em>condition</em> ;
*
* assert <em>condition</em> : <em>detail</em> ;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.10"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface AssertTree extends StatementTree {
ExpressionTree getCondition();
ExpressionTree getDetail();
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an assignment expression.
*
* For example:
* <pre>
* <em>variable</em> = <em>expression</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.26.1"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface AssignmentTree extends ExpressionTree {
ExpressionTree getVariable();
ExpressionTree getExpression();
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a binary expression.
* Use {@link #getKind getKind} to determine the kind of operator.
*
* For example:
* <pre>
* <em>leftOperand</em> <em>operator</em> <em>rightOperand</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, sections 15.17 to 15.24"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface BinaryTree extends ExpressionTree {
ExpressionTree getLeftOperand();
ExpressionTree getRightOperand();
}

View file

@ -0,0 +1,51 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for a statement block.
*
* For example:
* <pre>
* { }
*
* { <em>statements</em> }
*
* static { <em>statements</em> }
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.2"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface BlockTree extends StatementTree {
boolean isStatic();
List<? extends StatementTree> getStatements();
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import javax.lang.model.element.Name;
/**
* A tree node for a 'break' statement.
*
* For example:
* <pre>
* break;
*
* break <em>label</em> ;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.15"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface BreakTree extends StatementTree {
Name getLabel();
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for a 'case' in a 'switch' statement.
*
* For example:
* <pre>
* case <em>expression</em> :
* <em>statements</em>
*
* default :
* <em>statements</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.11"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface CaseTree extends Tree {
/**
* @return null if and only if this Case is {@code default:}
*/
ExpressionTree getExpression();
List<? extends StatementTree> getStatements();
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a 'catch' block in a 'try' statement.
*
* For example:
* <pre>
* catch ( <em>parameter</em> )
* <em>block</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.20"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface CatchTree extends Tree {
VariableTree getParameter();
BlockTree getBlock();
}

View file

@ -0,0 +1,59 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
import javax.lang.model.element.Name;
/**
* A tree node for a class, interface, enum, or annotation
* type declaration.
*
* For example:
* <pre>
* <em>modifiers</em> class <em>simpleName</em> <em>typeParameters</em>
* extends <em>extendsClause</em>
* implements <em>implementsClause</em>
* {
* <em>members</em>
* }
* </pre>
*
* @see "The Java Language Specification, 3rd ed,
* sections 8.1, 8.9, 9.1, and 9.6"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ClassTree extends StatementTree {
ModifiersTree getModifiers();
Name getSimpleName();
List<? extends TypeParameterTree> getTypeParameters();
Tree getExtendsClause();
List<? extends Tree> getImplementsClause();
List<? extends Tree> getMembers();
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
import javax.tools.JavaFileObject;
import com.sun.source.tree.LineMap;
/**
* Represents the abstract syntax tree for compilation units (source
* files) and package declarations (package-info.java).
*
* @see "The Java Language Specification, 3rd ed, sections 7.3, and 7.4"
*
* @author Peter von der Ah&eacute;
* @since 1.6
*/
public interface CompilationUnitTree extends Tree {
List<? extends AnnotationTree> getPackageAnnotations();
ExpressionTree getPackageName();
List<? extends ImportTree> getImports();
List<? extends Tree> getTypeDecls();
JavaFileObject getSourceFile();
/**
* Gets the line map for this compilation unit, if available.
* Returns null if the line map is not available.
* @return the line map for this compilation unit
*/
LineMap getLineMap();
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for compound assignment operator.
* Use {@link #getKind getKind} to determine the kind of operator.
*
* For example:
* <pre>
* <em>variable</em> <em>operator</em> <em>expression</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.26.2"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface CompoundAssignmentTree extends ExpressionTree {
ExpressionTree getVariable();
ExpressionTree getExpression();
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for the conditional operator ? :.
*
* For example:
* <pre>
* <em>condition</em> ? <em>trueExpression</em> : <em>falseExpression</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.25"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ConditionalExpressionTree extends ExpressionTree {
ExpressionTree getCondition();
ExpressionTree getTrueExpression();
ExpressionTree getFalseExpression();
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import javax.lang.model.element.Name;
/**
* A tree node for a 'continue' statement.
*
* For example:
* <pre>
* continue;
* continue <em>label</em> ;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.16"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ContinueTree extends StatementTree {
Name getLabel();
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a 'do' statement.
*
* For example:
* <pre>
* do
* <em>statement</em>
* while ( <em>expression</em> );
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.13"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface DoWhileLoopTree extends StatementTree {
ExpressionTree getCondition();
StatementTree getStatement();
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an empty (skip) statement.
*
* For example:
* <pre>
* ;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.6"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface EmptyStatementTree extends StatementTree {}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an "enhanced" 'for' loop statement.
*
* For example:
* <pre>
* for ( <em>variable</em> : <em>expression</em> )
* <em>statement</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.14.2"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface EnhancedForLoopTree extends StatementTree {
VariableTree getVariable();
ExpressionTree getExpression();
StatementTree getStatement();
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node to stand in for a malformed expression.
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ErroneousTree extends ExpressionTree {
List<? extends Tree> getErrorTrees();
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an expression statement.
*
* For example:
* <pre>
* <em>expression</em> ;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.8"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ExpressionStatementTree extends StatementTree {
ExpressionTree getExpression();
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node used as the base class for the different types of
* expressions.
*
* @see "The Java Language Specification, 3rd ed, chapter 15"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ExpressionTree extends Tree {}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for a basic 'for' loop statement.
*
* For example:
* <pre>
* for ( <em>initializer</em> ; <em>condition</em> ; <em>update</em> )
* <em>statement</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.14.1"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ForLoopTree extends StatementTree {
List<? extends StatementTree> getInitializer();
ExpressionTree getCondition();
List<? extends ExpressionStatementTree> getUpdate();
StatementTree getStatement();
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import javax.lang.model.element.Name;
/**
* A tree node for an identifier expression.
*
* For example:
* <pre>
* <em>name</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 6.5.6.1"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface IdentifierTree extends ExpressionTree {
Name getName();
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an 'if' statement.
*
* For example:
* <pre>
* if ( <em>condition</em> )
* <em>thenStatement</em>
*
* if ( <em>condition</em> )
* <em>thenStatement</em>
* else
* <em>elseStatement</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.9"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface IfTree extends StatementTree {
ExpressionTree getCondition();
StatementTree getThenStatement();
/**
* @return null if this if statement has no else branch.
*/
StatementTree getElseStatement();
}

View file

@ -0,0 +1,51 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an import statement.
*
* For example:
* <pre>
* import <em>qualifiedIdentifier</em> ;
*
* static import <em>qualifiedIdentifier</em> ;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 7.5"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ImportTree extends Tree {
boolean isStatic();
/**
* @return a qualified identifier ending in "*" if and only if
* this is an import-on-demand.
*/
Tree getQualifiedIdentifier();
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for an 'instanceof' expression.
*
* For example:
* <pre>
* <em>expression</em> instanceof <em>type</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.20.2"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface InstanceOfTree extends ExpressionTree {
ExpressionTree getExpression();
Tree getType();
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import javax.lang.model.element.Name;
/**
* A tree node for a labeled statement.
*
* For example:
* <pre>
* <em>label</em> : <em>statement</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.7"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface LabeledStatementTree extends StatementTree {
Name getLabel();
StatementTree getStatement();
}

View file

@ -0,0 +1,78 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* Provides methods to convert between character positions and line numbers
* for a compilation unit.
*
* @since 1.6
*/
public interface LineMap {
/**
* Find the start position of a line.
*
* @param line line number (beginning at 1)
* @return position of first character in line
* @throws IndexOutOfBoundsException
* if <tt>lineNumber < 1</tt>
* if <tt>lineNumber > no. of lines</tt>
*/
long getStartPosition(long line);
/**
* Find the position corresponding to a (line,column).
*
* @param line line number (beginning at 1)
* @param column tab-expanded column number (beginning 1)
*
* @return position of character
* @throws IndexOutOfBoundsException
* if {@code line < 1}
* if {@code line > no. of lines}
*/
long getPosition(long line, long column);
/**
* Find the line containing a position; a line termination
* character is on the line it terminates.
*
* @param pos character offset of the position
* @return the line number of pos (first line is 1)
*/
long getLineNumber(long pos);
/**
* Find the column for a character position.
* Tab characters preceding the position on the same line
* will be expanded when calculating the column number.
*
* @param pos character offset of the position
* @return the tab-expanded column number of pos (first column is 1)
*/
long getColumnNumber(long pos);
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a literal expression.
* Use {@link #getKind getKind} to determine the kind of literal.
*
* For example:
* <pre>
* <em>value</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.28"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface LiteralTree extends ExpressionTree {
Object getValue();
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import javax.lang.model.element.Name;
/**
* A tree node for a member access expression.
*
* For example:
* <pre>
* <em>expression</em> . <em>identifier</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, sections 6.5,
* 15.11, and 15.12"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface MemberSelectTree extends ExpressionTree {
ExpressionTree getExpression();
Name getIdentifier();
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for a method invocation expression.
*
* For example:
* <pre>
* <em>identifier</em> ( <em>arguments</em> )
*
* this . <em>typeArguments</em> <em>identifier</em> ( <em>arguments</em> )
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.12"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface MethodInvocationTree extends ExpressionTree {
List<? extends Tree> getTypeArguments();
ExpressionTree getMethodSelect();
List<? extends ExpressionTree> getArguments();
}

View file

@ -0,0 +1,59 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
import javax.lang.model.element.Name;
/**
* A tree node for a method or annotation type element declaration.
*
* For example:
* <pre>
* <em>modifiers</em> <em>typeParameters</em> <em>type</em> <em>name</em>
* ( <em>parameters</em> )
* <em>body</em>
*
* <em>modifiers</em> <em>type</em> <em>name</em> () default <em>defaultValue</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, sections 8.4, 8.6, 8.7,
* 9.4, and 9.6"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface MethodTree extends Tree {
ModifiersTree getModifiers();
Name getName();
Tree getReturnType();
List<? extends TypeParameterTree> getTypeParameters();
List<? extends VariableTree> getParameters();
List<? extends ExpressionTree> getThrows();
BlockTree getBody();
Tree getDefaultValue(); // for annotation types
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
import java.util.Set;
import javax.lang.model.element.Modifier;
/**
* A tree node for the modifiers, including annotations, for a declaration.
*
* For example:
* <pre>
* <em>flags</em>
*
* <em>flags</em> <em>annotations</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, sections
* 8.1.1, 8.3.1, 8.4.3, 8.5.1, 8.8.3, 9.1.1, and 9.7"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ModifiersTree extends Tree {
Set<Modifier> getFlags();
List<? extends AnnotationTree> getAnnotations();
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for an expression to create a new instance of an array.
*
* For example:
* <pre>
* new <em>type</em> <em>dimensions</em> <em>initializers</em>
*
* new <em>type</em> <em>dimensions</em> [ ] <em>initializers</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.10"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface NewArrayTree extends ExpressionTree {
Tree getType();
List<? extends ExpressionTree> getDimensions();
List<? extends ExpressionTree> getInitializers();
}

View file

@ -0,0 +1,57 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node to declare a new instance of a class.
*
* For example:
* <pre>
* new <em>identifier</em> ( )
*
* new <em>identifier</em> ( <em>arguments</em> )
*
* new <em>typeArguments</em> <em>identifier</em> ( <em>arguments</em> )
* <em>classBody</em>
*
* <em>enclosingExpression</em>.new <em>identifier</em> ( <em>arguments</em> )
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.9"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface NewClassTree extends ExpressionTree {
ExpressionTree getEnclosingExpression();
List<? extends Tree> getTypeArguments();
ExpressionTree getIdentifier();
List<? extends ExpressionTree> getArguments();
ClassTree getClassBody();
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for a type expression involving type parameters.
*
* For example:
* <pre>
* <em>type</em> &lt; <em>typeArguments</em> &gt;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 4.5.1"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ParameterizedTypeTree extends Tree {
Tree getType();
List<? extends Tree> getTypeArguments();
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a parenthesized expression. Note: parentheses
* not be preserved by the parser.
*
* For example:
* <pre>
* ( <em>expression</em> )
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.8.5"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ParenthesizedTree extends ExpressionTree {
ExpressionTree getExpression();
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import javax.lang.model.type.TypeKind;
/**
* A tree node for a primitive type.
*
* For example:
* <pre>
* <em>primitiveTypeKind</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 4.2"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface PrimitiveTypeTree extends Tree {
TypeKind getPrimitiveTypeKind();
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a 'return' statement.
*
* For example:
* <pre>
* return;
* return <em>expression</em>;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.17"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ReturnTree extends StatementTree {
ExpressionTree getExpression();
}

View file

@ -0,0 +1,73 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import com.sun.source.tree.Tree;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
/**
* Interface for determining locally available program elements, such as
* local variables and imports.
* Upon creation, a Scope is associated with a given program position;
* for example, a {@linkplain Tree tree node}. This position may be used to
* infer an enclosing method and/or class.
*
* <p>A Scope does not itself contain the details of the elements corresponding
* to the parameters, methods and fields of the methods and classes containing
* its position. However, these elements can be determined from the enclosing
* elements.
*
* <p>Scopes may be contained in an enclosing scope. The outermost scope contains
* those elements available via "star import" declarations; the scope within that
* contains the top level elements of the compilation unit, including any named
* imports.
*
* @since 1.6
*/
public interface Scope {
/**
* Returns the enclosing scope.
*/
public Scope getEnclosingScope();
/**
* Returns the innermost type element containing the position of this scope
*/
public TypeElement getEnclosingClass();
/**
* Returns the innermost executable element containing the position of this scope.
*/
public ExecutableElement getEnclosingMethod();
/**
* Returns the elements directly contained in this scope.
*/
public Iterable<? extends Element> getLocalElements();
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node used as the base class for the different kinds of
* statements.
*
* @see "The Java Language Specification, 3rd ed, chapter 14"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface StatementTree extends Tree {}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for a 'switch' statement.
*
* For example:
* <pre>
* switch ( <em>expression</em> ) {
* <em>cases</em>
* }
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.11"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface SwitchTree extends StatementTree {
ExpressionTree getExpression();
List<? extends CaseTree> getCases();
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a 'synchronized' statement.
*
* For example:
* <pre>
* synchronized ( <em>expression</em> )
* </em>block</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.19"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface SynchronizedTree extends StatementTree {
ExpressionTree getExpression();
BlockTree getBlock();
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a 'throw' statement.
*
* For example:
* <pre>
* throw <em>expression</em>;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.18"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface ThrowTree extends StatementTree {
ExpressionTree getExpression();
}

View file

@ -0,0 +1,585 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* Common interface for all nodes in an abstract syntax tree.
*
* <p><b>WARNING:</b> This interface and its sub-interfaces are
* subject to change as the Java&trade; programming language evolves.
* These interfaces are implemented by Sun's Java compiler (javac)
* and should not be implemented either directly or indirectly by
* other applications.
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
*
* @since 1.6
*/
public interface Tree {
/**
* Enumerates all kinds of trees.
*/
public enum Kind {
/**
* Used for instances of {@link AnnotationTree}.
*/
ANNOTATION(AnnotationTree.class),
/**
* Used for instances of {@link ArrayAccessTree}.
*/
ARRAY_ACCESS(ArrayAccessTree.class),
/**
* Used for instances of {@link ArrayTypeTree}.
*/
ARRAY_TYPE(ArrayTypeTree.class),
/**
* Used for instances of {@link AssertTree}.
*/
ASSERT(AssertTree.class),
/**
* Used for instances of {@link AssignmentTree}.
*/
ASSIGNMENT(AssignmentTree.class),
/**
* Used for instances of {@link BlockTree}.
*/
BLOCK(BlockTree.class),
/**
* Used for instances of {@link BreakTree}.
*/
BREAK(BreakTree.class),
/**
* Used for instances of {@link CaseTree}.
*/
CASE(CaseTree.class),
/**
* Used for instances of {@link CatchTree}.
*/
CATCH(CatchTree.class),
/**
* Used for instances of {@link ClassTree}.
*/
CLASS(ClassTree.class),
/**
* Used for instances of {@link CompilationUnitTree}.
*/
COMPILATION_UNIT(CompilationUnitTree.class),
/**
* Used for instances of {@link ConditionalExpressionTree}.
*/
CONDITIONAL_EXPRESSION(ConditionalExpressionTree.class),
/**
* Used for instances of {@link ContinueTree}.
*/
CONTINUE(ContinueTree.class),
/**
* Used for instances of {@link DoWhileLoopTree}.
*/
DO_WHILE_LOOP(DoWhileLoopTree.class),
/**
* Used for instances of {@link EnhancedForLoopTree}.
*/
ENHANCED_FOR_LOOP(EnhancedForLoopTree.class),
/**
* Used for instances of {@link ExpressionStatementTree}.
*/
EXPRESSION_STATEMENT(ExpressionStatementTree.class),
/**
* Used for instances of {@link MemberSelectTree}.
*/
MEMBER_SELECT(MemberSelectTree.class),
/**
* Used for instances of {@link ForLoopTree}.
*/
FOR_LOOP(ForLoopTree.class),
/**
* Used for instances of {@link IdentifierTree}.
*/
IDENTIFIER(IdentifierTree.class),
/**
* Used for instances of {@link IfTree}.
*/
IF(IfTree.class),
/**
* Used for instances of {@link ImportTree}.
*/
IMPORT(ImportTree.class),
/**
* Used for instances of {@link InstanceOfTree}.
*/
INSTANCE_OF(InstanceOfTree.class),
/**
* Used for instances of {@link LabeledStatementTree}.
*/
LABELED_STATEMENT(LabeledStatementTree.class),
/**
* Used for instances of {@link MethodTree}.
*/
METHOD(MethodTree.class),
/**
* Used for instances of {@link MethodInvocationTree}.
*/
METHOD_INVOCATION(MethodInvocationTree.class),
/**
* Used for instances of {@link ModifiersTree}.
*/
MODIFIERS(ModifiersTree.class),
/**
* Used for instances of {@link NewArrayTree}.
*/
NEW_ARRAY(NewArrayTree.class),
/**
* Used for instances of {@link NewClassTree}.
*/
NEW_CLASS(NewClassTree.class),
/**
* Used for instances of {@link ParenthesizedTree}.
*/
PARENTHESIZED(ParenthesizedTree.class),
/**
* Used for instances of {@link PrimitiveTypeTree}.
*/
PRIMITIVE_TYPE(PrimitiveTypeTree.class),
/**
* Used for instances of {@link ReturnTree}.
*/
RETURN(ReturnTree.class),
/**
* Used for instances of {@link EmptyStatementTree}.
*/
EMPTY_STATEMENT(EmptyStatementTree.class),
/**
* Used for instances of {@link SwitchTree}.
*/
SWITCH(SwitchTree.class),
/**
* Used for instances of {@link SynchronizedTree}.
*/
SYNCHRONIZED(SynchronizedTree.class),
/**
* Used for instances of {@link ThrowTree}.
*/
THROW(ThrowTree.class),
/**
* Used for instances of {@link TryTree}.
*/
TRY(TryTree.class),
/**
* Used for instances of {@link ParameterizedTypeTree}.
*/
PARAMETERIZED_TYPE(ParameterizedTypeTree.class),
/**
* Used for instances of {@link TypeCastTree}.
*/
TYPE_CAST(TypeCastTree.class),
/**
* Used for instances of {@link TypeParameterTree}.
*/
TYPE_PARAMETER(TypeParameterTree.class),
/**
* Used for instances of {@link VariableTree}.
*/
VARIABLE(VariableTree.class),
/**
* Used for instances of {@link WhileLoopTree}.
*/
WHILE_LOOP(WhileLoopTree.class),
/**
* Used for instances of {@link UnaryTree} representing postfix
* increment operator {@code ++}.
*/
POSTFIX_INCREMENT(UnaryTree.class),
/**
* Used for instances of {@link UnaryTree} representing postfix
* decrement operator {@code --}.
*/
POSTFIX_DECREMENT(UnaryTree.class),
/**
* Used for instances of {@link UnaryTree} representing prefix
* increment operator {@code ++}.
*/
PREFIX_INCREMENT(UnaryTree.class),
/**
* Used for instances of {@link UnaryTree} representing prefix
* decrement operator {@code --}.
*/
PREFIX_DECREMENT(UnaryTree.class),
/**
* Used for instances of {@link UnaryTree} representing unary plus
* operator {@code +}.
*/
UNARY_PLUS(UnaryTree.class),
/**
* Used for instances of {@link UnaryTree} representing unary minus
* operator {@code -}.
*/
UNARY_MINUS(UnaryTree.class),
/**
* Used for instances of {@link UnaryTree} representing bitwise
* complement operator {@code ~}.
*/
BITWISE_COMPLEMENT(UnaryTree.class),
/**
* Used for instances of {@link UnaryTree} representing logical
* complement operator {@code !}.
*/
LOGICAL_COMPLEMENT(UnaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* multiplication {@code *}.
*/
MULTIPLY(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* division {@code /}.
*/
DIVIDE(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* remainder {@code %}.
*/
REMAINDER(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* addition or string concatenation {@code +}.
*/
PLUS(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* subtraction {@code -}.
*/
MINUS(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* left shift {@code <<}.
*/
LEFT_SHIFT(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* right shift {@code >>}.
*/
RIGHT_SHIFT(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* unsigned right shift {@code >>>}.
*/
UNSIGNED_RIGHT_SHIFT(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* less-than {@code <}.
*/
LESS_THAN(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* greater-than {@code >}.
*/
GREATER_THAN(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* less-than-equal {@code <=}.
*/
LESS_THAN_EQUAL(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* greater-than-equal {@code >=}.
*/
GREATER_THAN_EQUAL(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* equal-to {@code ==}.
*/
EQUAL_TO(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* not-equal-to {@code !=}.
*/
NOT_EQUAL_TO(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* bitwise and logical "and" {@code &}.
*/
AND(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* bitwise and logical "xor" {@code ^}.
*/
XOR(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* bitwise and logical "or" {@code |}.
*/
OR(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* conditional-and {@code &&}.
*/
CONDITIONAL_AND(BinaryTree.class),
/**
* Used for instances of {@link BinaryTree} representing
* conditional-or {@code ||}.
*/
CONDITIONAL_OR(BinaryTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* multiplication assignment {@code *=}.
*/
MULTIPLY_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* division assignment {@code /=}.
*/
DIVIDE_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* remainder assignment {@code %=}.
*/
REMAINDER_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* addition or string concatenation assignment {@code +=}.
*/
PLUS_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* subtraction assignment {@code -=}.
*/
MINUS_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* left shift assignment {@code <<=}.
*/
LEFT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* right shift assignment {@code >>=}.
*/
RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* unsigned right shift assignment {@code >>>=}.
*/
UNSIGNED_RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* bitwise and logical "and" assignment {@code &=}.
*/
AND_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* bitwise and logical "xor" assignment {@code ^=}.
*/
XOR_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link CompoundAssignmentTree} representing
* bitwise and logical "or" assignment {@code |=}.
*/
OR_ASSIGNMENT(CompoundAssignmentTree.class),
/**
* Used for instances of {@link LiteralTree} representing
* an integral literal expression of type {@code int}.
*/
INT_LITERAL(LiteralTree.class),
/**
* Used for instances of {@link LiteralTree} representing
* an integral literal expression of type {@code long}.
*/
LONG_LITERAL(LiteralTree.class),
/**
* Used for instances of {@link LiteralTree} representing
* a floating-point literal expression of type {@code float}.
*/
FLOAT_LITERAL(LiteralTree.class),
/**
* Used for instances of {@link LiteralTree} representing
* a floating-point literal expression of type {@code double}.
*/
DOUBLE_LITERAL(LiteralTree.class),
/**
* Used for instances of {@link LiteralTree} representing
* a boolean literal expression of type {@code boolean}.
*/
BOOLEAN_LITERAL(LiteralTree.class),
/**
* Used for instances of {@link LiteralTree} representing
* a character literal expression of type {@code char}.
*/
CHAR_LITERAL(LiteralTree.class),
/**
* Used for instances of {@link LiteralTree} representing
* a string literal expression of type {@link String}.
*/
STRING_LITERAL(LiteralTree.class),
/**
* Used for instances of {@link LiteralTree} representing
* the use of {@code null}.
*/
NULL_LITERAL(LiteralTree.class),
/**
* Used for instances of {@link WildcardTree} representing
* an unbounded wildcard type argument.
*/
UNBOUNDED_WILDCARD(WildcardTree.class),
/**
* Used for instances of {@link WildcardTree} representing
* an extends bounded wildcard type argument.
*/
EXTENDS_WILDCARD(WildcardTree.class),
/**
* Used for instances of {@link WildcardTree} representing
* a super bounded wildcard type argument.
*/
SUPER_WILDCARD(WildcardTree.class),
/**
* Used for instances of {@link ErroneousTree}.
*/
ERRONEOUS(ErroneousTree.class),
/**
* An implementation-reserved node. This is the not the node
* you are looking for.
*/
OTHER(null);
Kind(Class<? extends Tree> intf) {
associatedInterface = intf;
}
public Class<? extends Tree> asInterface() {
return associatedInterface;
}
private final Class<? extends Tree> associatedInterface;
}
/**
* Gets the kind of this tree.
*
* @return the kind of this tree.
*/
Kind getKind();
/**
* Accept method used to implement the visitor pattern. The
* visitor pattern is used to implement operations on trees.
*
* @param <R> result type of this operation.
* @param <D> type of additonal data.
*/
<R,D> R accept(TreeVisitor<R,D> visitor, D data);
}

View file

@ -0,0 +1,108 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A visitor of trees, in the style of the visitor design pattern.
* Classes implementing this interface are used to operate
* on a tree when the kind of tree is unknown at compile time.
* When a visitor is passed to an tree's {@link Tree#accept
* accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
* to that tree is invoked.
*
* <p> Classes implementing this interface may or may not throw a
* {@code NullPointerException} if the additional parameter {@code p}
* is {@code null}; see documentation of the implementing class for
* details.
*
* <p> <b>WARNING:</b> It is possible that methods will be added to
* this interface to accommodate new, currently unknown, language
* structures added to future versions of the Java&trade; programming
* language. Therefore, visitor classes directly implementing this
* interface may be source incompatible with future versions of the
* platform.
*
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
* methods. Use {@code Void} for visitors that do not need an
* additional parameter.
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
*
* @since 1.6
*/
public interface TreeVisitor<R,P> {
R visitAnnotation(AnnotationTree node, P p);
R visitMethodInvocation(MethodInvocationTree node, P p);
R visitAssert(AssertTree node, P p);
R visitAssignment(AssignmentTree node, P p);
R visitCompoundAssignment(CompoundAssignmentTree node, P p);
R visitBinary(BinaryTree node, P p);
R visitBlock(BlockTree node, P p);
R visitBreak(BreakTree node, P p);
R visitCase(CaseTree node, P p);
R visitCatch(CatchTree node, P p);
R visitClass(ClassTree node, P p);
R visitConditionalExpression(ConditionalExpressionTree node, P p);
R visitContinue(ContinueTree node, P p);
R visitDoWhileLoop(DoWhileLoopTree node, P p);
R visitErroneous(ErroneousTree node, P p);
R visitExpressionStatement(ExpressionStatementTree node, P p);
R visitEnhancedForLoop(EnhancedForLoopTree node, P p);
R visitForLoop(ForLoopTree node, P p);
R visitIdentifier(IdentifierTree node, P p);
R visitIf(IfTree node, P p);
R visitImport(ImportTree node, P p);
R visitArrayAccess(ArrayAccessTree node, P p);
R visitLabeledStatement(LabeledStatementTree node, P p);
R visitLiteral(LiteralTree node, P p);
R visitMethod(MethodTree node, P p);
R visitModifiers(ModifiersTree node, P p);
R visitNewArray(NewArrayTree node, P p);
R visitNewClass(NewClassTree node, P p);
R visitParenthesized(ParenthesizedTree node, P p);
R visitReturn(ReturnTree node, P p);
R visitMemberSelect(MemberSelectTree node, P p);
R visitEmptyStatement(EmptyStatementTree node, P p);
R visitSwitch(SwitchTree node, P p);
R visitSynchronized(SynchronizedTree node, P p);
R visitThrow(ThrowTree node, P p);
R visitCompilationUnit(CompilationUnitTree node, P p);
R visitTry(TryTree node, P p);
R visitParameterizedType(ParameterizedTypeTree node, P p);
R visitArrayType(ArrayTypeTree node, P p);
R visitTypeCast(TypeCastTree node, P p);
R visitPrimitiveType(PrimitiveTypeTree node, P p);
R visitTypeParameter(TypeParameterTree node, P p);
R visitInstanceOf(InstanceOfTree node, P p);
R visitUnary(UnaryTree node, P p);
R visitVariable(VariableTree node, P p);
R visitWhileLoop(WhileLoopTree node, P p);
R visitWildcard(WildcardTree node, P p);
R visitOther(Tree node, P p);
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for a 'try' statement.
*
* For example:
* <pre>
* try
* <em>block</em>
* <em>catches</em>
* finally
* <em>finallyBlock</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 14.20"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface TryTree extends StatementTree {
BlockTree getBlock();
List<? extends CatchTree> getCatches();
BlockTree getFinallyBlock();
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a type cast expression.
*
* For example:
* <pre>
* ( <em>type</em> ) <em>expression</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 15.16"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface TypeCastTree extends ExpressionTree {
Tree getType();
ExpressionTree getExpression();
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import java.util.List;
import javax.lang.model.element.Name;
/**
* A tree node for a type parameter.
*
* For example:
* <pre>
* <em>name</em>
*
* <em>name</em> extends <em>bounds</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 4.4"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface TypeParameterTree extends Tree {
Name getName();
List<? extends Tree> getBounds();
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for postfix and unary expressions.
* Use {@link #getKind getKind} to determine the kind of operator.
*
* For example:
* <pre>
* <em>operator</em> <em>expression</em>
*
* <em>expression</em> <em>operator</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, sections 15.14 and 15.15"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface UnaryTree extends ExpressionTree {
ExpressionTree getExpression();
}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
import javax.lang.model.element.Name;
/**
* A tree node for a variable declaration.
*
* For example:
* <pre>
* <em>modifiers</em> <em>type</em> <em>name</em> <em>initializer</em> ;
* </pre>
*
* @see "The Java Language Specification, 3rd ed, sections 8.3 and 14.4"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface VariableTree extends StatementTree {
ModifiersTree getModifiers();
Name getName();
Tree getType();
ExpressionTree getInitializer();
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a 'while' loop statement.
*
* For example:
* <pre>
* while ( <em>condition</em> )
* <em>statement</em>
* </pre>
*
*
* @see "The Java Language Specification, 3rd ed, section 14.12"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface WhileLoopTree extends StatementTree {
ExpressionTree getCondition();
StatementTree getStatement();
}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.tree;
/**
* A tree node for a wildcard type argument.
* Use {@link #getKind getKind} to determine the kind of bound.
*
* For example:
* <pre>
* ?
*
* ? extends <em>bound</em>
*
* ? super <em>bound</em>
* </pre>
*
* @see "The Java Language Specification, 3rd ed, section 4.5.1"
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public interface WildcardTree extends Tree {
Tree getBound();
}

View file

@ -0,0 +1,34 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* Provides interfaces to represent source code as abstract syntax
* trees (AST).
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
package com.sun.source.tree;

View file

@ -0,0 +1,91 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.Tree;
import java.io.IOException;
import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileObject;
/**
* Provides access to functionality specific to the Sun Java Compiler, javac.
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public abstract class JavacTask implements CompilationTask {
/**
* Parse the specified files returning a list of abstract syntax trees.
*
* @return a list of abstract syntax trees
* @throws IOException if an unhandled I/O error occurred in the compiler.
*/
public abstract Iterable<? extends CompilationUnitTree> parse()
throws IOException;
/**
* Complete all analysis.
*
* @return a list of elements that were analyzed
* @throws IOException if an unhandled I/O error occurred in the compiler.
*/
public abstract Iterable<? extends Element> analyze() throws IOException;
/**
* Generate code.
*
* @return a list of files that were generated
* @throws IOException if an unhandled I/O error occurred in the compiler.
*/
public abstract Iterable<? extends JavaFileObject> generate() throws IOException;
/**
* The specified listener will receive events describing the progress of
* this compilation task.
*/
public abstract void setTaskListener(TaskListener taskListener);
/**
* Get a type mirror of the tree node determined by the specified path.
*/
public abstract TypeMirror getTypeMirror(Iterable<? extends Tree> path);
/**
* Get a utility object for dealing with program elements.
*/
public abstract Elements getElements();
/**
* Get a utility object for dealing with type mirrors.
*/
public abstract Types getTypes();
}

View file

@ -0,0 +1,254 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
import com.sun.source.tree.*;
/**
* A simple visitor for tree nodes.
*
* @author Peter von der Ah&eacute;
* @since 1.6
*/
public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> {
protected final R DEFAULT_VALUE;
protected SimpleTreeVisitor() {
DEFAULT_VALUE = null;
}
protected SimpleTreeVisitor(R defaultValue) {
DEFAULT_VALUE = defaultValue;
}
protected R defaultAction(Tree node, P p) {
return DEFAULT_VALUE;
}
public final R visit(Tree node, P p) {
return (node == null) ? null : node.accept(this, p);
}
public final R visit(Iterable<? extends Tree> nodes, P p) {
R r = null;
if (nodes != null)
for (Tree node : nodes)
r = visit(node, p);
return r;
}
public R visitCompilationUnit(CompilationUnitTree node, P p) {
return defaultAction(node, p);
}
public R visitImport(ImportTree node, P p) {
return defaultAction(node, p);
}
public R visitClass(ClassTree node, P p) {
return defaultAction(node, p);
}
public R visitMethod(MethodTree node, P p) {
return defaultAction(node, p);
}
public R visitVariable(VariableTree node, P p) {
return defaultAction(node, p);
}
public R visitEmptyStatement(EmptyStatementTree node, P p) {
return defaultAction(node, p);
}
public R visitBlock(BlockTree node, P p) {
return defaultAction(node, p);
}
public R visitDoWhileLoop(DoWhileLoopTree node, P p) {
return defaultAction(node, p);
}
public R visitWhileLoop(WhileLoopTree node, P p) {
return defaultAction(node, p);
}
public R visitForLoop(ForLoopTree node, P p) {
return defaultAction(node, p);
}
public R visitEnhancedForLoop(EnhancedForLoopTree node, P p) {
return defaultAction(node, p);
}
public R visitLabeledStatement(LabeledStatementTree node, P p) {
return defaultAction(node, p);
}
public R visitSwitch(SwitchTree node, P p) {
return defaultAction(node, p);
}
public R visitCase(CaseTree node, P p) {
return defaultAction(node, p);
}
public R visitSynchronized(SynchronizedTree node, P p) {
return defaultAction(node, p);
}
public R visitTry(TryTree node, P p) {
return defaultAction(node, p);
}
public R visitCatch(CatchTree node, P p) {
return defaultAction(node, p);
}
public R visitConditionalExpression(ConditionalExpressionTree node, P p) {
return defaultAction(node, p);
}
public R visitIf(IfTree node, P p) {
return defaultAction(node, p);
}
public R visitExpressionStatement(ExpressionStatementTree node, P p) {
return defaultAction(node, p);
}
public R visitBreak(BreakTree node, P p) {
return defaultAction(node, p);
}
public R visitContinue(ContinueTree node, P p) {
return defaultAction(node, p);
}
public R visitReturn(ReturnTree node, P p) {
return defaultAction(node, p);
}
public R visitThrow(ThrowTree node, P p) {
return defaultAction(node, p);
}
public R visitAssert(AssertTree node, P p) {
return defaultAction(node, p);
}
public R visitMethodInvocation(MethodInvocationTree node, P p) {
return defaultAction(node, p);
}
public R visitNewClass(NewClassTree node, P p) {
return defaultAction(node, p);
}
public R visitNewArray(NewArrayTree node, P p) {
return defaultAction(node, p);
}
public R visitParenthesized(ParenthesizedTree node, P p) {
return defaultAction(node, p);
}
public R visitAssignment(AssignmentTree node, P p) {
return defaultAction(node, p);
}
public R visitCompoundAssignment(CompoundAssignmentTree node, P p) {
return defaultAction(node, p);
}
public R visitUnary(UnaryTree node, P p) {
return defaultAction(node, p);
}
public R visitBinary(BinaryTree node, P p) {
return defaultAction(node, p);
}
public R visitTypeCast(TypeCastTree node, P p) {
return defaultAction(node, p);
}
public R visitInstanceOf(InstanceOfTree node, P p) {
return defaultAction(node, p);
}
public R visitArrayAccess(ArrayAccessTree node, P p) {
return defaultAction(node, p);
}
public R visitMemberSelect(MemberSelectTree node, P p) {
return defaultAction(node, p);
}
public R visitIdentifier(IdentifierTree node, P p) {
return defaultAction(node, p);
}
public R visitLiteral(LiteralTree node, P p) {
return defaultAction(node, p);
}
public R visitPrimitiveType(PrimitiveTypeTree node, P p) {
return defaultAction(node, p);
}
public R visitArrayType(ArrayTypeTree node, P p) {
return defaultAction(node, p);
}
public R visitParameterizedType(ParameterizedTypeTree node, P p) {
return defaultAction(node, p);
}
public R visitTypeParameter(TypeParameterTree node, P p) {
return defaultAction(node, p);
}
public R visitWildcard(WildcardTree node, P p) {
return defaultAction(node, p);
}
public R visitModifiers(ModifiersTree node, P p) {
return defaultAction(node, p);
}
public R visitAnnotation(AnnotationTree node, P p) {
return defaultAction(node, p);
}
public R visitErroneous(ErroneousTree node, P p) {
return defaultAction(node, p);
}
public R visitOther(Tree node, P p) {
return defaultAction(node, p);
}
}

View file

@ -0,0 +1,86 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
import com.sun.source.tree.*;
/**
* Provides methods to obtain the position of a Tree within a CompilationUnit.
* A position is defined as a simple character offset from the start of a
* CompilationUnit where the first character is at offset 0.
*
* @author Peter von der Ah&eacute;
* @since 1.6
*/
public interface SourcePositions {
/**
* Gets the starting position of tree within file. If tree is not found within
* file, or if the starting position is not available,
* return {@link javax.tools.Diagnostic#NOPOS}.
* The returned position must be at the start of the yield of this tree, that
* is for any sub-tree of this tree, the following must hold:
*
* <p>
* {@code tree.getStartPosition() <= subtree.getStartPosition()} or <br>
* {@code tree.getStartPosition() == NOPOS} or <br>
* {@code subtree.getStartPosition() == NOPOS}
* </p>
*
* @param file CompilationUnit in which to find tree.
* @param tree tree for which a position is sought.
* @return the start position of tree.
*/
long getStartPosition(CompilationUnitTree file, Tree tree);
/**
* Gets the ending position of tree within file. If tree is not found within
* file, or if the starting position is not available,
* return {@link javax.tools.Diagnostic#NOPOS}.
* The returned position must be at the end of the yield of this tree,
* that is for any sub-tree of this tree, the following must hold:
*
* <p>
* {@code tree.getEndPosition() >= subtree.getEndPosition()} or <br>
* {@code tree.getEndPosition() == NOPOS} or <br>
* {@code subtree.getEndPosition() == NOPOS}
* </p>
*
* In addition, the following must hold:
*
* <p>
* {@code tree.getStartPosition() <= tree.getEndPosition()} or <br>
* {@code tree.getStartPosition() == NOPOS} or <br>
* {@code tree.getEndPosition() == NOPOS}
* </p>
*
* @param file CompilationUnit in which to find tree.
* @param tree tree for which a position is sought.
* @return the end position of tree.
*/
long getEndPosition(CompilationUnitTree file, Tree tree);
}

View file

@ -0,0 +1,122 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
import com.sun.source.tree.CompilationUnitTree;
import javax.lang.model.element.TypeElement;
import javax.tools.JavaFileObject;
/**
* Provides details about work that has been done by the Sun Java Compiler, javac.
*
* @author Jonathan Gibbons
* @since 1.6
*/
public final class TaskEvent
{
/**
* Kind of task event.
* @since 1.6
*/
public enum Kind {
/**
* For events related to the parsing of a file.
*/
PARSE,
/**
* For events relating to elements being entered.
**/
ENTER,
/**
* For events relating to elements being analyzed for errors.
**/
ANALYZE,
/**
* For events relating to class files being generated.
**/
GENERATE,
/**
* For events relating to overall annotaion processing.
**/
ANNOTATION_PROCESSING,
/**
* For events relating to an individual annotation processing round.
**/
ANNOTATION_PROCESSING_ROUND
};
public TaskEvent(Kind kind) {
this(kind, null, null, null);
}
public TaskEvent(Kind kind, JavaFileObject sourceFile) {
this(kind, sourceFile, null, null);
}
public TaskEvent(Kind kind, CompilationUnitTree unit) {
this(kind, unit.getSourceFile(), unit, null);
}
public TaskEvent(Kind kind, CompilationUnitTree unit, TypeElement clazz) {
this(kind, unit.getSourceFile(), unit, clazz);
}
private TaskEvent(Kind kind, JavaFileObject file, CompilationUnitTree unit, TypeElement clazz) {
this.kind = kind;
this.file = file;
this.unit = unit;
this.clazz = clazz;
}
public Kind getKind() {
return kind;
}
public JavaFileObject getSourceFile() {
return file;
}
public CompilationUnitTree getCompilationUnit() {
return unit;
}
public TypeElement getTypeElement() {
return clazz;
}
public String toString() {
return "TaskEvent["
+ kind + ","
+ file + ","
// the compilation unit is identified by the file
+ clazz + "]";
}
private Kind kind;
private JavaFileObject file;
private CompilationUnitTree unit;
private TypeElement clazz;
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
/**
* Provides a listener to monitor the activity of the Sun Java Compiler, javac.
*
* @author Jonathan Gibbons
* @since 1.6
*/
public interface TaskListener
{
public void started(TaskEvent e);
public void finished(TaskEvent e);
}

View file

@ -0,0 +1,142 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
import com.sun.source.tree.*;
import java.util.Iterator;
/**
* A path of tree nodes, typically used to represent the sequence of ancestor
* nodes of a tree node up to the top level CompilationUnitTree node.
*
* @author Jonathan Gibbons
* @since 1.6
*/
public class TreePath implements Iterable<Tree> {
/**
* Gets a tree path for a tree node within a compilation unit.
* @return null if the node is not found
*/
public static TreePath getPath(CompilationUnitTree unit, Tree target) {
return getPath(new TreePath(unit), target);
}
/**
* Gets a tree path for a tree node within a subtree identified by a TreePath object.
* @return null if the node is not found
*/
public static TreePath getPath(TreePath path, Tree target) {
path.getClass();
target.getClass();
class Result extends Error {
static final long serialVersionUID = -5942088234594905625L;
TreePath path;
Result(TreePath path) {
this.path = path;
}
}
class PathFinder extends TreePathScanner<TreePath,Tree> {
public TreePath scan(Tree tree, Tree target) {
if (tree == target)
throw new Result(new TreePath(getCurrentPath(), target));
return super.scan(tree, target);
}
}
try {
new PathFinder().scan(path, target);
} catch (Result result) {
return result.path;
}
return null;
}
/**
* Creates a TreePath for a root node.
*/
public TreePath(CompilationUnitTree t) {
this(null, t);
}
/**
* Creates a TreePath for a child node.
*/
public TreePath(TreePath p, Tree t) {
if (t.getKind() == Tree.Kind.COMPILATION_UNIT) {
compilationUnit = (CompilationUnitTree) t;
parent = null;
}
else {
compilationUnit = p.compilationUnit;
parent = p;
}
leaf = t;
}
/**
* Get the compilation unit associated with this path.
*/
public CompilationUnitTree getCompilationUnit() {
return compilationUnit;
}
/**
* Get the leaf node for this path.
*/
public Tree getLeaf() {
return leaf;
}
/**
* Get the path for the enclosing node, or null if there is no enclosing node.
*/
public TreePath getParentPath() {
return parent;
}
public Iterator<Tree> iterator() {
return new Iterator<Tree>() {
public boolean hasNext() {
return curr.parent != null;
}
public Tree next() {
curr = curr.parent;
return curr.leaf;
}
public void remove() {
throw new UnsupportedOperationException();
}
private TreePath curr;
};
}
private CompilationUnitTree compilationUnit;
private Tree leaf;
private TreePath parent;
}

View file

@ -0,0 +1,82 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
import com.sun.source.tree.*;
/**
* A TreeVisitor that visits all the child tree nodes, and provides
* support for maintaining a path for the parent nodes.
* To visit nodes of a particular type, just override the
* corresponding visitorXYZ method.
* Inside your method, call super.visitXYZ to visit descendant
* nodes.
*
* @author Jonathan Gibbons
* @since 1.6
*/
public class TreePathScanner<R, P> extends TreeScanner<R, P> {
/**
* Scan a tree from a position identified by a TreePath.
*/
public R scan(TreePath path, P p) {
this.path = path;
try {
return path.getLeaf().accept(this, p);
} finally {
this.path = null;
}
}
/**
* Scan a single node.
* The current path is updated for the duration of the scan.
*/
@Override
public R scan(Tree tree, P p) {
if (tree == null)
return null;
TreePath prev = path;
path = new TreePath(path, tree);
try {
return tree.accept(this, p);
} finally {
path = prev;
}
}
/**
* Get the current path for the node, as built up by the currently
* active set of scan calls.
*/
public TreePath getCurrentPath() {
return path;
}
private TreePath path;
}

View file

@ -0,0 +1,381 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
import com.sun.source.tree.*;
/**
* A TreeVisitor that visits all the child tree nodes.
* To visit nodes of a particular type, just override the
* corresponding visitXYZ method.
* Inside your method, call super.visitXYZ to visit descendant
* nodes.
*
* <p>The default implementation of the visitXYZ methods will determine
* a result as follows:
* <ul>
* <li>If the node being visited has no children, the result will be null.
* <li>If the node being visited has one child, the result will be the
* result of calling {@code scan} on that child. The child may be a simple node
* or itself a list of nodes.
* <li> If the node being visited has more than one child, the result will
* be determined by calling {@code scan} each child in turn, and then combining the
* result of each scan after the first with the cumulative result
* so far, as determined by the {@link #reduce} method. Each child may be either
* a simple node of a list of nodes. The default behavior of the {@code reduce}
* method is such that the result of the visitXYZ method will be the result of
* the last child scanned.
* </ul>
*
* <p>Here is an example to count the number of identifier nodes in a tree:
* <pre>
* class CountIdentifiers extends TreeScanner<Integer,Void> {
* {@literal @}Override
* public Integer visitIdentifier(IdentifierTree node, Void p) {
* return 1;
* }
* {@literal @}Override
* public Integer reduce(Integer r1, Integer r2) {
* return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
* }
* }
* </pre>
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
public class TreeScanner<R,P> implements TreeVisitor<R,P> {
/** Scan a single node.
*/
public R scan(Tree node, P p) {
return (node == null) ? null : node.accept(this, p);
}
private R scanAndReduce(Tree node, P p, R r) {
return reduce(scan(node, p), r);
}
/** Scan a list of nodes.
*/
public R scan(Iterable<? extends Tree> nodes, P p) {
R r = null;
if (nodes != null) {
boolean first = true;
for (Tree node : nodes) {
r = (first ? scan(node, p) : scanAndReduce(node, p, r));
first = false;
}
}
return r;
}
private R scanAndReduce(Iterable<? extends Tree> nodes, P p, R r) {
return reduce(scan(nodes, p), r);
}
/**
* Reduces two results into a combined result.
* The default implementation is to return the first parameter.
* The general contract of the method is that it may take any action whatsoever.
*/
public R reduce(R r1, R r2) {
return r1;
}
/* ***************************************************************************
* Visitor methods
****************************************************************************/
public R visitCompilationUnit(CompilationUnitTree node, P p) {
R r = scan(node.getPackageAnnotations(), p);
r = scanAndReduce(node.getPackageName(), p, r);
r = scanAndReduce(node.getImports(), p, r);
r = scanAndReduce(node.getTypeDecls(), p, r);
return r;
}
public R visitImport(ImportTree node, P p) {
return scan(node.getQualifiedIdentifier(), p);
}
public R visitClass(ClassTree node, P p) {
R r = scan(node.getModifiers(), p);
r = scanAndReduce(node.getTypeParameters(), p, r);
r = scanAndReduce(node.getExtendsClause(), p, r);
r = scanAndReduce(node.getImplementsClause(), p, r);
r = scanAndReduce(node.getMembers(), p, r);
return r;
}
public R visitMethod(MethodTree node, P p) {
R r = scan(node.getModifiers(), p);
r = scanAndReduce(node.getReturnType(), p, r);
r = scanAndReduce(node.getTypeParameters(), p, r);
r = scanAndReduce(node.getParameters(), p, r);
r = scanAndReduce(node.getThrows(), p, r);
r = scanAndReduce(node.getBody(), p, r);
return r;
}
public R visitVariable(VariableTree node, P p) {
R r = scan(node.getModifiers(), p);
r = scanAndReduce(node.getType(), p, r);
r = scanAndReduce(node.getInitializer(), p, r);
return r;
}
public R visitEmptyStatement(EmptyStatementTree node, P p) {
return null;
}
public R visitBlock(BlockTree node, P p) {
return scan(node.getStatements(), p);
}
public R visitDoWhileLoop(DoWhileLoopTree node, P p) {
R r = scan(node.getStatement(), p);
r = scanAndReduce(node.getCondition(), p, r);
return r;
}
public R visitWhileLoop(WhileLoopTree node, P p) {
R r = scan(node.getCondition(), p);
r = scanAndReduce(node.getStatement(), p, r);
return r;
}
public R visitForLoop(ForLoopTree node, P p) {
R r = scan(node.getInitializer(), p);
r = scanAndReduce(node.getCondition(), p, r);
r = scanAndReduce(node.getUpdate(), p, r);
r = scanAndReduce(node.getStatement(), p, r);
return r;
}
public R visitEnhancedForLoop(EnhancedForLoopTree node, P p) {
R r = scan(node.getVariable(), p);
r = scanAndReduce(node.getExpression(), p, r);
r = scanAndReduce(node.getStatement(), p, r);
return r;
}
public R visitLabeledStatement(LabeledStatementTree node, P p) {
return scan(node.getStatement(), p);
}
public R visitSwitch(SwitchTree node, P p) {
R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getCases(), p, r);
return r;
}
public R visitCase(CaseTree node, P p) {
R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getStatements(), p, r);
return r;
}
public R visitSynchronized(SynchronizedTree node, P p) {
R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getBlock(), p, r);
return r;
}
public R visitTry(TryTree node, P p) {
R r = scan(node.getBlock(), p);
r = scanAndReduce(node.getCatches(), p, r);
r = scanAndReduce(node.getFinallyBlock(), p, r);
return r;
}
public R visitCatch(CatchTree node, P p) {
R r = scan(node.getParameter(), p);
r = scanAndReduce(node.getBlock(), p, r);
return r;
}
public R visitConditionalExpression(ConditionalExpressionTree node, P p) {
R r = scan(node.getCondition(), p);
r = scanAndReduce(node.getTrueExpression(), p, r);
r = scanAndReduce(node.getFalseExpression(), p, r);
return r;
}
public R visitIf(IfTree node, P p) {
R r = scan(node.getCondition(), p);
r = scanAndReduce(node.getThenStatement(), p, r);
r = scanAndReduce(node.getElseStatement(), p, r);
return r;
}
public R visitExpressionStatement(ExpressionStatementTree node, P p) {
return scan(node.getExpression(), p);
}
public R visitBreak(BreakTree node, P p) {
return null;
}
public R visitContinue(ContinueTree node, P p) {
return null;
}
public R visitReturn(ReturnTree node, P p) {
return scan(node.getExpression(), p);
}
public R visitThrow(ThrowTree node, P p) {
return scan(node.getExpression(), p);
}
public R visitAssert(AssertTree node, P p) {
R r = scan(node.getCondition(), p);
r = scanAndReduce(node.getDetail(), p, r);
return r;
}
public R visitMethodInvocation(MethodInvocationTree node, P p) {
R r = scan(node.getTypeArguments(), p);
r = scanAndReduce(node.getMethodSelect(), p, r);
r = scanAndReduce(node.getArguments(), p, r);
return r;
}
public R visitNewClass(NewClassTree node, P p) {
R r = scan(node.getEnclosingExpression(), p);
r = scanAndReduce(node.getIdentifier(), p, r);
r = scanAndReduce(node.getTypeArguments(), p, r);
r = scanAndReduce(node.getArguments(), p, r);
r = scanAndReduce(node.getClassBody(), p, r);
return r;
}
public R visitNewArray(NewArrayTree node, P p) {
R r = scan(node.getType(), p);
r = scanAndReduce(node.getDimensions(), p, r);
r = scanAndReduce(node.getInitializers(), p, r);
return r;
}
public R visitParenthesized(ParenthesizedTree node, P p) {
return scan(node.getExpression(), p);
}
public R visitAssignment(AssignmentTree node, P p) {
R r = scan(node.getVariable(), p);
r = scanAndReduce(node.getExpression(), p, r);
return r;
}
public R visitCompoundAssignment(CompoundAssignmentTree node, P p) {
R r = scan(node.getVariable(), p);
r = scanAndReduce(node.getExpression(), p, r);
return r;
}
public R visitUnary(UnaryTree node, P p) {
return scan(node.getExpression(), p);
}
public R visitBinary(BinaryTree node, P p) {
R r = scan(node.getLeftOperand(), p);
r = scanAndReduce(node.getRightOperand(), p, r);
return r;
}
public R visitTypeCast(TypeCastTree node, P p) {
R r = scan(node.getType(), p);
r = scanAndReduce(node.getExpression(), p, r);
return r;
}
public R visitInstanceOf(InstanceOfTree node, P p) {
R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getType(), p, r);
return r;
}
public R visitArrayAccess(ArrayAccessTree node, P p) {
R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getIndex(), p, r);
return r;
}
public R visitMemberSelect(MemberSelectTree node, P p) {
return scan(node.getExpression(), p);
}
public R visitIdentifier(IdentifierTree node, P p) {
return null;
}
public R visitLiteral(LiteralTree node, P p) {
return null;
}
public R visitPrimitiveType(PrimitiveTypeTree node, P p) {
return null;
}
public R visitArrayType(ArrayTypeTree node, P p) {
return scan(node.getType(), p);
}
public R visitParameterizedType(ParameterizedTypeTree node, P p) {
R r = scan(node.getType(), p);
r = scanAndReduce(node.getTypeArguments(), p, r);
return r;
}
public R visitTypeParameter(TypeParameterTree node, P p) {
return scan(node.getBounds(), p);
}
public R visitWildcard(WildcardTree node, P p) {
return scan(node.getBound(), p);
}
public R visitModifiers(ModifiersTree node, P p) {
return scan(node.getAnnotations(), p);
}
public R visitAnnotation(AnnotationTree node, P p) {
R r = scan(node.getAnnotationType(), p);
r = scanAndReduce(node.getArguments(), p, r);
return r;
}
public R visitOther(Tree node, P p) {
return null;
}
public R visitErroneous(ErroneousTree node, P p) {
return null;
}
}

View file

@ -0,0 +1,180 @@
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.source.util;
import java.lang.reflect.Method;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.tools.JavaCompiler.CompilationTask;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.Scope;
import com.sun.source.tree.Tree;
/**
* Bridges JSR 199, JSR 269, and the Tree API.
*
* @author Peter von der Ah&eacute;
*/
public abstract class Trees {
/**
* Gets a Trees object for a given CompilationTask.
* @throws IllegalArgumentException if the task does not support the Trees API.
*/
public static Trees instance(CompilationTask task) {
if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl"))
throw new IllegalArgumentException();
return getJavacTrees(CompilationTask.class, task);
}
/**
* Gets a Trees object for a given CompilationTask.
* @throws IllegalArgumentException if the env does not support the Trees API.
*/
public static Trees instance(ProcessingEnvironment env) {
if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
throw new IllegalArgumentException();
return getJavacTrees(ProcessingEnvironment.class, env);
}
private static Trees getJavacTrees(Class<?> argType, Object arg) {
try {
ClassLoader cl = arg.getClass().getClassLoader();
Class<?> c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl);
argType = Class.forName(argType.getName(), false, cl);
Method m = c.getMethod("instance", new Class[] { argType });
return (Trees) m.invoke(null, new Object[] { arg });
} catch (Throwable e) {
throw new AssertionError(e);
}
}
/**
* Gets a utility object for obtaining source positions.
*/
public abstract SourcePositions getSourcePositions();
/**
* Gets the Tree node for a given Element.
* Returns null if the node can not be found.
*/
public abstract Tree getTree(Element element);
/**
* Gets the ClassTree node for a given TypeElement.
* Returns null if the node can not be found.
*/
public abstract ClassTree getTree(TypeElement element);
/**
* Gets the MethodTree node for a given ExecutableElement.
* Returns null if the node can not be found.
*/
public abstract MethodTree getTree(ExecutableElement method);
/**
* Gets the Tree node for an AnnotationMirror on a given Element.
* Returns null if the node can not be found.
*/
public abstract Tree getTree(Element e, AnnotationMirror a);
/**
* Gets the Tree node for an AnnotationValue for an AnnotationMirror on a given Element.
* Returns null if the node can not be found.
*/
public abstract Tree getTree(Element e, AnnotationMirror a, AnnotationValue v);
/**
* Gets the path to tree node within the specified compilation unit.
*/
public abstract TreePath getPath(CompilationUnitTree unit, Tree node);
/**
* Gets the TreePath node for a given Element.
* Returns null if the node can not be found.
*/
public abstract TreePath getPath(Element e);
/**
* Gets the TreePath node for an AnnotationMirror on a given Element.
* Returns null if the node can not be found.
*/
public abstract TreePath getPath(Element e, AnnotationMirror a);
/**
* Gets the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element.
* Returns null if the node can not be found.
*/
public abstract TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v);
/**
* Gets the Element for the Tree node identified by a given TreePath.
* Returns null if the element is not available.
* @throws IllegalArgumentException is the TreePath does not identify
* a Tree node that might have an associated Element.
*/
public abstract Element getElement(TreePath path);
/**
* Gets the TypeMirror for the Tree node identified by a given TreePath.
* Returns null if the TypeMirror is not available.
* @throws IllegalArgumentException is the TreePath does not identify
* a Tree node that might have an associated TypeMirror.
*/
public abstract TypeMirror getTypeMirror(TreePath path);
/**
* Gets the Scope for the Tree node identified by a given TreePath.
* Returns null if the Scope is not available.
*/
public abstract Scope getScope(TreePath path);
/**
* Checks whether a given type is accessible in a given scope.
* @param scope the scope to be checked
* @param type the type to be checked
* @return true if {@code type} is accessible
*/
public abstract boolean isAccessible(Scope scope, TypeElement type);
/**
* Checks whether the given element is accessible as a member of the given
* type in a given scope.
* @param scope the scope to be checked
* @param member the member to be checked
* @param type the type for which to check if the member is accessible
* @return true if {@code member} is accessible in {@code type}
*/
public abstract boolean isAccessible(Scope scope, Element member, DeclaredType type);
}

View file

@ -0,0 +1,33 @@
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* Provides utilities for operations on abstract syntax trees (AST).
*
* @author Peter von der Ah&eacute;
* @author Jonathan Gibbons
* @since 1.6
*/
package com.sun.source.util;