17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.tools.javac.tree; 27 28 import java.io.IOException; 29 import java.io.StringWriter; 30 import java.util.*; 31 32 import javax.lang.model.element.Modifier; 33 import javax.lang.model.type.TypeKind; 34 import javax.tools.JavaFileObject; 35 36 import com.sun.source.tree.*; 37 import com.sun.source.tree.LambdaExpressionTree.BodyKind; 38 import com.sun.source.tree.MemberReferenceTree.ReferenceMode; 39 import com.sun.tools.javac.code.*; 40 import com.sun.tools.javac.code.Scope.*; 41 import com.sun.tools.javac.code.Symbol.*; 42 import com.sun.tools.javac.util.*; 43 import com.sun.tools.javac.util.DefinedBy.Api; 44 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; 45 import com.sun.tools.javac.util.List; 46 import static com.sun.tools.javac.tree.JCTree.Tag.*; 47 48 /** 49 * Root class for abstract syntax tree nodes. It provides definitions 50 * for specific tree nodes as subclasses nested inside. 51 * 52 * <p>Each subclass is highly standardized. It generally contains 53 * only tree fields for the syntactic subcomponents of the node. Some 54 * classes that represent identifier uses or definitions also define a 55 * Symbol field that denotes the represented identifier. Classes for 56 * non-local jumps also carry the jump target as a field. The root 57 * class Tree itself defines fields for the tree's type and position. 58 * No other fields are kept in a tree node; instead parameters are 2486 @DefinedBy(Api.COMPILER_TREE) 2487 public Kind getKind() { 2488 throw new AssertionError("TypeBoundKind is not part of a public API"); 2489 } 2490 @Override @DefinedBy(Api.COMPILER_TREE) 2491 public <R,D> R accept(TreeVisitor<R,D> v, D d) { 2492 throw new AssertionError("TypeBoundKind is not part of a public API"); 2493 } 2494 @Override 2495 public Tag getTag() { 2496 return TYPEBOUNDKIND; 2497 } 2498 } 2499 2500 public static class JCAnnotation extends JCExpression implements AnnotationTree { 2501 // Either Tag.ANNOTATION or Tag.TYPE_ANNOTATION 2502 private Tag tag; 2503 2504 public JCTree annotationType; 2505 public List<JCExpression> args; 2506 2507 // Attribute.Compound if tag is ANNOTATION 2508 // Attribute.TypeCompound if tag is TYPE_ANNOTATION 2509 // 2510 // NOTE: This field is slated for removal in the future. Do 2511 // not use it for anything new. 2512 public Attribute.Compound attribute; 2513 2514 protected JCAnnotation(Tag tag, JCTree annotationType, List<JCExpression> args) { 2515 this.tag = tag; 2516 this.annotationType = annotationType; 2517 this.args = args; 2518 } 2519 2520 @Override 2521 public void accept(Visitor v) { v.visitAnnotation(this); } 2522 2523 @DefinedBy(Api.COMPILER_TREE) 2524 public Kind getKind() { return TreeInfo.tagToKind(getTag()); } 2525 2526 @DefinedBy(Api.COMPILER_TREE) 2527 public JCTree getAnnotationType() { return annotationType; } 2528 @DefinedBy(Api.COMPILER_TREE) 2529 public List<JCExpression> getArguments() { 2530 return args; 2531 } | 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.tools.javac.tree; 27 28 import java.io.IOException; 29 import java.io.StringWriter; 30 import java.util.*; 31 32 import javax.lang.model.element.Modifier; 33 import javax.lang.model.type.TypeKind; 34 import javax.tools.JavaFileObject; 35 36 import com.sun.source.tree.*; 37 import com.sun.tools.javac.code.*; 38 import com.sun.tools.javac.code.Scope.*; 39 import com.sun.tools.javac.code.Symbol.*; 40 import com.sun.tools.javac.util.*; 41 import com.sun.tools.javac.util.DefinedBy.Api; 42 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; 43 import com.sun.tools.javac.util.List; 44 import static com.sun.tools.javac.tree.JCTree.Tag.*; 45 46 /** 47 * Root class for abstract syntax tree nodes. It provides definitions 48 * for specific tree nodes as subclasses nested inside. 49 * 50 * <p>Each subclass is highly standardized. It generally contains 51 * only tree fields for the syntactic subcomponents of the node. Some 52 * classes that represent identifier uses or definitions also define a 53 * Symbol field that denotes the represented identifier. Classes for 54 * non-local jumps also carry the jump target as a field. The root 55 * class Tree itself defines fields for the tree's type and position. 56 * No other fields are kept in a tree node; instead parameters are 2484 @DefinedBy(Api.COMPILER_TREE) 2485 public Kind getKind() { 2486 throw new AssertionError("TypeBoundKind is not part of a public API"); 2487 } 2488 @Override @DefinedBy(Api.COMPILER_TREE) 2489 public <R,D> R accept(TreeVisitor<R,D> v, D d) { 2490 throw new AssertionError("TypeBoundKind is not part of a public API"); 2491 } 2492 @Override 2493 public Tag getTag() { 2494 return TYPEBOUNDKIND; 2495 } 2496 } 2497 2498 public static class JCAnnotation extends JCExpression implements AnnotationTree { 2499 // Either Tag.ANNOTATION or Tag.TYPE_ANNOTATION 2500 private Tag tag; 2501 2502 public JCTree annotationType; 2503 public List<JCExpression> args; 2504 public Attribute.Compound attribute; 2505 2506 protected JCAnnotation(Tag tag, JCTree annotationType, List<JCExpression> args) { 2507 this.tag = tag; 2508 this.annotationType = annotationType; 2509 this.args = args; 2510 } 2511 2512 @Override 2513 public void accept(Visitor v) { v.visitAnnotation(this); } 2514 2515 @DefinedBy(Api.COMPILER_TREE) 2516 public Kind getKind() { return TreeInfo.tagToKind(getTag()); } 2517 2518 @DefinedBy(Api.COMPILER_TREE) 2519 public JCTree getAnnotationType() { return annotationType; } 2520 @DefinedBy(Api.COMPILER_TREE) 2521 public List<JCExpression> getArguments() { 2522 return args; 2523 } |