1.1 --- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java Fri Jun 26 12:22:40 2009 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java Fri Jun 26 18:51:39 2009 -0700 1.3 @@ -256,9 +256,11 @@ 1.4 */ 1.5 public static final int MODIFIERS = ANNOTATION + 1; 1.6 1.7 + public static final int ANNOTATED_TYPE = MODIFIERS + 1; 1.8 + 1.9 /** Error trees, of type Erroneous. 1.10 */ 1.11 - public static final int ERRONEOUS = MODIFIERS + 1; 1.12 + public static final int ERRONEOUS = ANNOTATED_TYPE + 1; 1.13 1.14 /** Unary operators, of type Unary. 1.15 */ 1.16 @@ -622,6 +624,7 @@ 1.17 public JCExpression restype; 1.18 public List<JCTypeParameter> typarams; 1.19 public List<JCVariableDecl> params; 1.20 + public List<JCTypeAnnotation> receiverAnnotations; 1.21 public List<JCExpression> thrown; 1.22 public JCBlock body; 1.23 public JCExpression defaultValue; // for annotation types 1.24 @@ -631,6 +634,7 @@ 1.25 JCExpression restype, 1.26 List<JCTypeParameter> typarams, 1.27 List<JCVariableDecl> params, 1.28 + List<JCTypeAnnotation> receiver, 1.29 List<JCExpression> thrown, 1.30 JCBlock body, 1.31 JCExpression defaultValue, 1.32 @@ -641,6 +645,7 @@ 1.33 this.restype = restype; 1.34 this.typarams = typarams; 1.35 this.params = params; 1.36 + this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil()); 1.37 this.thrown = thrown; 1.38 this.body = body; 1.39 this.defaultValue = defaultValue; 1.40 @@ -659,6 +664,7 @@ 1.41 public List<JCVariableDecl> getParameters() { 1.42 return params; 1.43 } 1.44 + public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; } 1.45 public List<JCExpression> getThrows() { 1.46 return thrown; 1.47 } 1.48 @@ -1371,6 +1377,8 @@ 1.49 public static class JCNewArray extends JCExpression implements NewArrayTree { 1.50 public JCExpression elemtype; 1.51 public List<JCExpression> dims; 1.52 + public List<JCTypeAnnotation> annotations; 1.53 + public List<List<JCTypeAnnotation>> dimAnnotations; 1.54 public List<JCExpression> elems; 1.55 protected JCNewArray(JCExpression elemtype, 1.56 List<JCExpression> dims, 1.57 @@ -1378,6 +1386,8 @@ 1.58 { 1.59 this.elemtype = elemtype; 1.60 this.dims = dims; 1.61 + this.annotations = List.nil(); 1.62 + this.dimAnnotations = List.nil(); 1.63 this.elems = elems; 1.64 } 1.65 @Override 1.66 @@ -1860,9 +1870,11 @@ 1.67 public static class JCTypeParameter extends JCTree implements TypeParameterTree { 1.68 public Name name; 1.69 public List<JCExpression> bounds; 1.70 - protected JCTypeParameter(Name name, List<JCExpression> bounds) { 1.71 + public List<JCTypeAnnotation> annotations; 1.72 + protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) { 1.73 this.name = name; 1.74 this.bounds = bounds; 1.75 + this.annotations = annotations; 1.76 } 1.77 @Override 1.78 public void accept(Visitor v) { v.visitTypeParameter(this); } 1.79 @@ -1872,6 +1884,9 @@ 1.80 public List<JCExpression> getBounds() { 1.81 return bounds; 1.82 } 1.83 + public List<JCTypeAnnotation> getAnnotations() { 1.84 + return annotations; 1.85 + } 1.86 @Override 1.87 public <R,D> R accept(TreeVisitor<R,D> v, D d) { 1.88 return v.visitTypeParameter(this, d); 1.89 @@ -1962,6 +1977,16 @@ 1.90 } 1.91 } 1.92 1.93 + public static class JCTypeAnnotation extends JCAnnotation { 1.94 + public TypeAnnotationPosition annotation_position; 1.95 + public Attribute.TypeCompound attribute_field; 1.96 + 1.97 + protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) { 1.98 + super(annotationType, args); 1.99 + this.annotation_position = new TypeAnnotationPosition(); 1.100 + } 1.101 + } 1.102 + 1.103 public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree { 1.104 public long flags; 1.105 public List<JCAnnotation> annotations; 1.106 @@ -1989,6 +2014,33 @@ 1.107 } 1.108 } 1.109 1.110 + public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree { 1.111 + public List<JCTypeAnnotation> annotations; 1.112 + public JCExpression underlyingType; 1.113 + protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) { 1.114 + this.annotations = annotations; 1.115 + this.underlyingType = underlyingType; 1.116 + } 1.117 + @Override 1.118 + public void accept(Visitor v) { v.visitAnnotatedType(this); } 1.119 + 1.120 + public Kind getKind() { return Kind.ANNOTATED_TYPE; } 1.121 + public List<JCTypeAnnotation> getAnnotations() { 1.122 + return annotations; 1.123 + } 1.124 + public JCExpression getUnderlyingType() { 1.125 + return underlyingType; 1.126 + } 1.127 + @Override 1.128 + public <R,D> R accept(TreeVisitor<R,D> v, D d) { 1.129 + return v.visitAnnotatedType(this, d); 1.130 + } 1.131 + @Override 1.132 + public int getTag() { 1.133 + return ANNOTATED_TYPE; 1.134 + } 1.135 + } 1.136 + 1.137 public static class JCErroneous extends JCExpression 1.138 implements com.sun.source.tree.ErroneousTree { 1.139 public List<? extends JCTree> errs; 1.140 @@ -2056,6 +2108,7 @@ 1.141 JCExpression restype, 1.142 List<JCTypeParameter> typarams, 1.143 List<JCVariableDecl> params, 1.144 + List<JCTypeAnnotation> receiver, 1.145 List<JCExpression> thrown, 1.146 JCBlock body, 1.147 JCExpression defaultValue); 1.148 @@ -2172,6 +2225,7 @@ 1.149 public void visitTypeBoundKind(TypeBoundKind that) { visitTree(that); } 1.150 public void visitAnnotation(JCAnnotation that) { visitTree(that); } 1.151 public void visitModifiers(JCModifiers that) { visitTree(that); } 1.152 + public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); } 1.153 public void visitErroneous(JCErroneous that) { visitTree(that); } 1.154 public void visitLetExpr(LetExpr that) { visitTree(that); } 1.155