--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Fri Jun 26 12:22:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Fri Jun 26 18:51:39 2009 -0700
@@ -256,9 +256,11 @@
*/
public static final int MODIFIERS = ANNOTATION + 1;
+ public static final int ANNOTATED_TYPE = MODIFIERS + 1;
+
/** Error trees, of type Erroneous.
*/
- public static final int ERRONEOUS = MODIFIERS + 1;
+ public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
/** Unary operators, of type Unary.
*/
@@ -622,6 +624,7 @@
public JCExpression restype;
public List<JCTypeParameter> typarams;
public List<JCVariableDecl> params;
+ public List<JCTypeAnnotation> receiverAnnotations;
public List<JCExpression> thrown;
public JCBlock body;
public JCExpression defaultValue; // for annotation types
@@ -631,6 +634,7 @@
JCExpression restype,
List<JCTypeParameter> typarams,
List<JCVariableDecl> params,
+ List<JCTypeAnnotation> receiver,
List<JCExpression> thrown,
JCBlock body,
JCExpression defaultValue,
@@ -641,6 +645,7 @@
this.restype = restype;
this.typarams = typarams;
this.params = params;
+ this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
this.thrown = thrown;
this.body = body;
this.defaultValue = defaultValue;
@@ -659,6 +664,7 @@
public List<JCVariableDecl> getParameters() {
return params;
}
+ public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
public List<JCExpression> getThrows() {
return thrown;
}
@@ -1371,6 +1377,8 @@
public static class JCNewArray extends JCExpression implements NewArrayTree {
public JCExpression elemtype;
public List<JCExpression> dims;
+ public List<JCTypeAnnotation> annotations;
+ public List<List<JCTypeAnnotation>> dimAnnotations;
public List<JCExpression> elems;
protected JCNewArray(JCExpression elemtype,
List<JCExpression> dims,
@@ -1378,6 +1386,8 @@
{
this.elemtype = elemtype;
this.dims = dims;
+ this.annotations = List.nil();
+ this.dimAnnotations = List.nil();
this.elems = elems;
}
@Override
@@ -1860,9 +1870,11 @@
public static class JCTypeParameter extends JCTree implements TypeParameterTree {
public Name name;
public List<JCExpression> bounds;
- protected JCTypeParameter(Name name, List<JCExpression> bounds) {
+ public List<JCTypeAnnotation> annotations;
+ protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
this.name = name;
this.bounds = bounds;
+ this.annotations = annotations;
}
@Override
public void accept(Visitor v) { v.visitTypeParameter(this); }
@@ -1872,6 +1884,9 @@
public List<JCExpression> getBounds() {
return bounds;
}
+ public List<JCTypeAnnotation> getAnnotations() {
+ return annotations;
+ }
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitTypeParameter(this, d);
@@ -1962,6 +1977,16 @@
}
}
+ public static class JCTypeAnnotation extends JCAnnotation {
+ public TypeAnnotationPosition annotation_position;
+ public Attribute.TypeCompound attribute_field;
+
+ protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
+ super(annotationType, args);
+ this.annotation_position = new TypeAnnotationPosition();
+ }
+ }
+
public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
public long flags;
public List<JCAnnotation> annotations;
@@ -1989,6 +2014,33 @@
}
}
+ public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree {
+ public List<JCTypeAnnotation> annotations;
+ public JCExpression underlyingType;
+ protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
+ this.annotations = annotations;
+ this.underlyingType = underlyingType;
+ }
+ @Override
+ public void accept(Visitor v) { v.visitAnnotatedType(this); }
+
+ public Kind getKind() { return Kind.ANNOTATED_TYPE; }
+ public List<JCTypeAnnotation> getAnnotations() {
+ return annotations;
+ }
+ public JCExpression getUnderlyingType() {
+ return underlyingType;
+ }
+ @Override
+ public <R,D> R accept(TreeVisitor<R,D> v, D d) {
+ return v.visitAnnotatedType(this, d);
+ }
+ @Override
+ public int getTag() {
+ return ANNOTATED_TYPE;
+ }
+ }
+
public static class JCErroneous extends JCExpression
implements com.sun.source.tree.ErroneousTree {
public List<? extends JCTree> errs;
@@ -2056,6 +2108,7 @@
JCExpression restype,
List<JCTypeParameter> typarams,
List<JCVariableDecl> params,
+ List<JCTypeAnnotation> receiver,
List<JCExpression> thrown,
JCBlock body,
JCExpression defaultValue);
@@ -2172,6 +2225,7 @@
public void visitTypeBoundKind(TypeBoundKind that) { visitTree(that); }
public void visitAnnotation(JCAnnotation that) { visitTree(that); }
public void visitModifiers(JCModifiers that) { visitTree(that); }
+ public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
public void visitErroneous(JCErroneous that) { visitTree(that); }
public void visitLetExpr(LetExpr that) { visitTree(that); }