langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
changeset 3149 0cd06d598d6f
parent 2212 1d3dc0e0ba0c
child 5492 515e4b33b335
equal deleted inserted replaced
3148:7506c0293ff1 3149:0cd06d598d6f
   254 
   254 
   255     /** metadata: Modifiers
   255     /** metadata: Modifiers
   256      */
   256      */
   257     public static final int MODIFIERS = ANNOTATION + 1;
   257     public static final int MODIFIERS = ANNOTATION + 1;
   258 
   258 
       
   259     public static final int ANNOTATED_TYPE = MODIFIERS + 1;
       
   260 
   259     /** Error trees, of type Erroneous.
   261     /** Error trees, of type Erroneous.
   260      */
   262      */
   261     public static final int ERRONEOUS = MODIFIERS + 1;
   263     public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
   262 
   264 
   263     /** Unary operators, of type Unary.
   265     /** Unary operators, of type Unary.
   264      */
   266      */
   265     public static final int POS = ERRONEOUS + 1;             // +
   267     public static final int POS = ERRONEOUS + 1;             // +
   266     public static final int NEG = POS + 1;                   // -
   268     public static final int NEG = POS + 1;                   // -
   620         public JCModifiers mods;
   622         public JCModifiers mods;
   621         public Name name;
   623         public Name name;
   622         public JCExpression restype;
   624         public JCExpression restype;
   623         public List<JCTypeParameter> typarams;
   625         public List<JCTypeParameter> typarams;
   624         public List<JCVariableDecl> params;
   626         public List<JCVariableDecl> params;
       
   627         public List<JCTypeAnnotation> receiverAnnotations;
   625         public List<JCExpression> thrown;
   628         public List<JCExpression> thrown;
   626         public JCBlock body;
   629         public JCBlock body;
   627         public JCExpression defaultValue; // for annotation types
   630         public JCExpression defaultValue; // for annotation types
   628         public MethodSymbol sym;
   631         public MethodSymbol sym;
   629         protected JCMethodDecl(JCModifiers mods,
   632         protected JCMethodDecl(JCModifiers mods,
   630                             Name name,
   633                             Name name,
   631                             JCExpression restype,
   634                             JCExpression restype,
   632                             List<JCTypeParameter> typarams,
   635                             List<JCTypeParameter> typarams,
   633                             List<JCVariableDecl> params,
   636                             List<JCVariableDecl> params,
       
   637                             List<JCTypeAnnotation> receiver,
   634                             List<JCExpression> thrown,
   638                             List<JCExpression> thrown,
   635                             JCBlock body,
   639                             JCBlock body,
   636                             JCExpression defaultValue,
   640                             JCExpression defaultValue,
   637                             MethodSymbol sym)
   641                             MethodSymbol sym)
   638         {
   642         {
   639             this.mods = mods;
   643             this.mods = mods;
   640             this.name = name;
   644             this.name = name;
   641             this.restype = restype;
   645             this.restype = restype;
   642             this.typarams = typarams;
   646             this.typarams = typarams;
   643             this.params = params;
   647             this.params = params;
       
   648             this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
   644             this.thrown = thrown;
   649             this.thrown = thrown;
   645             this.body = body;
   650             this.body = body;
   646             this.defaultValue = defaultValue;
   651             this.defaultValue = defaultValue;
   647             this.sym = sym;
   652             this.sym = sym;
   648         }
   653         }
   657             return typarams;
   662             return typarams;
   658         }
   663         }
   659         public List<JCVariableDecl> getParameters() {
   664         public List<JCVariableDecl> getParameters() {
   660             return params;
   665             return params;
   661         }
   666         }
       
   667         public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
   662         public List<JCExpression> getThrows() {
   668         public List<JCExpression> getThrows() {
   663             return thrown;
   669             return thrown;
   664         }
   670         }
   665         public JCBlock getBody() { return body; }
   671         public JCBlock getBody() { return body; }
   666         public JCTree getDefaultValue() { // for annotation types
   672         public JCTree getDefaultValue() { // for annotation types
  1369      * A new[...] operation.
  1375      * A new[...] operation.
  1370      */
  1376      */
  1371     public static class JCNewArray extends JCExpression implements NewArrayTree {
  1377     public static class JCNewArray extends JCExpression implements NewArrayTree {
  1372         public JCExpression elemtype;
  1378         public JCExpression elemtype;
  1373         public List<JCExpression> dims;
  1379         public List<JCExpression> dims;
       
  1380         public List<JCTypeAnnotation> annotations;
       
  1381         public List<List<JCTypeAnnotation>> dimAnnotations;
  1374         public List<JCExpression> elems;
  1382         public List<JCExpression> elems;
  1375         protected JCNewArray(JCExpression elemtype,
  1383         protected JCNewArray(JCExpression elemtype,
  1376                            List<JCExpression> dims,
  1384                            List<JCExpression> dims,
  1377                            List<JCExpression> elems)
  1385                            List<JCExpression> elems)
  1378         {
  1386         {
  1379             this.elemtype = elemtype;
  1387             this.elemtype = elemtype;
  1380             this.dims = dims;
  1388             this.dims = dims;
       
  1389             this.annotations = List.nil();
       
  1390             this.dimAnnotations = List.nil();
  1381             this.elems = elems;
  1391             this.elems = elems;
  1382         }
  1392         }
  1383         @Override
  1393         @Override
  1384         public void accept(Visitor v) { v.visitNewArray(this); }
  1394         public void accept(Visitor v) { v.visitNewArray(this); }
  1385 
  1395 
  1858      * @param bounds bounds
  1868      * @param bounds bounds
  1859      */
  1869      */
  1860     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
  1870     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
  1861         public Name name;
  1871         public Name name;
  1862         public List<JCExpression> bounds;
  1872         public List<JCExpression> bounds;
  1863         protected JCTypeParameter(Name name, List<JCExpression> bounds) {
  1873         public List<JCTypeAnnotation> annotations;
       
  1874         protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
  1864             this.name = name;
  1875             this.name = name;
  1865             this.bounds = bounds;
  1876             this.bounds = bounds;
       
  1877             this.annotations = annotations;
  1866         }
  1878         }
  1867         @Override
  1879         @Override
  1868         public void accept(Visitor v) { v.visitTypeParameter(this); }
  1880         public void accept(Visitor v) { v.visitTypeParameter(this); }
  1869 
  1881 
  1870         public Kind getKind() { return Kind.TYPE_PARAMETER; }
  1882         public Kind getKind() { return Kind.TYPE_PARAMETER; }
  1871         public Name getName() { return name; }
  1883         public Name getName() { return name; }
  1872         public List<JCExpression> getBounds() {
  1884         public List<JCExpression> getBounds() {
  1873             return bounds;
  1885             return bounds;
       
  1886         }
       
  1887         public List<JCTypeAnnotation> getAnnotations() {
       
  1888             return annotations;
  1874         }
  1889         }
  1875         @Override
  1890         @Override
  1876         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1891         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1877             return v.visitTypeParameter(this, d);
  1892             return v.visitTypeParameter(this, d);
  1878         }
  1893         }
  1960         public int getTag() {
  1975         public int getTag() {
  1961             return ANNOTATION;
  1976             return ANNOTATION;
  1962         }
  1977         }
  1963     }
  1978     }
  1964 
  1979 
       
  1980     public static class JCTypeAnnotation extends JCAnnotation {
       
  1981         public TypeAnnotationPosition annotation_position;
       
  1982         public Attribute.TypeCompound attribute_field;
       
  1983 
       
  1984         protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
       
  1985             super(annotationType, args);
       
  1986             this.annotation_position = new TypeAnnotationPosition();
       
  1987         }
       
  1988     }
       
  1989 
  1965     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
  1990     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
  1966         public long flags;
  1991         public long flags;
  1967         public List<JCAnnotation> annotations;
  1992         public List<JCAnnotation> annotations;
  1968         protected JCModifiers(long flags, List<JCAnnotation> annotations) {
  1993         protected JCModifiers(long flags, List<JCAnnotation> annotations) {
  1969             this.flags = flags;
  1994             this.flags = flags;
  1984             return v.visitModifiers(this, d);
  2009             return v.visitModifiers(this, d);
  1985         }
  2010         }
  1986         @Override
  2011         @Override
  1987         public int getTag() {
  2012         public int getTag() {
  1988             return MODIFIERS;
  2013             return MODIFIERS;
       
  2014         }
       
  2015     }
       
  2016 
       
  2017     public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree {
       
  2018         public List<JCTypeAnnotation> annotations;
       
  2019         public JCExpression underlyingType;
       
  2020         protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
       
  2021             this.annotations = annotations;
       
  2022             this.underlyingType = underlyingType;
       
  2023         }
       
  2024         @Override
       
  2025         public void accept(Visitor v) { v.visitAnnotatedType(this); }
       
  2026 
       
  2027         public Kind getKind() { return Kind.ANNOTATED_TYPE; }
       
  2028         public List<JCTypeAnnotation> getAnnotations() {
       
  2029             return annotations;
       
  2030         }
       
  2031         public JCExpression getUnderlyingType() {
       
  2032             return underlyingType;
       
  2033         }
       
  2034         @Override
       
  2035         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
       
  2036             return v.visitAnnotatedType(this, d);
       
  2037         }
       
  2038         @Override
       
  2039         public int getTag() {
       
  2040             return ANNOTATED_TYPE;
  1989         }
  2041         }
  1990     }
  2042     }
  1991 
  2043 
  1992     public static class JCErroneous extends JCExpression
  2044     public static class JCErroneous extends JCExpression
  1993             implements com.sun.source.tree.ErroneousTree {
  2045             implements com.sun.source.tree.ErroneousTree {
  2054         JCMethodDecl MethodDef(JCModifiers mods,
  2106         JCMethodDecl MethodDef(JCModifiers mods,
  2055                             Name name,
  2107                             Name name,
  2056                             JCExpression restype,
  2108                             JCExpression restype,
  2057                             List<JCTypeParameter> typarams,
  2109                             List<JCTypeParameter> typarams,
  2058                             List<JCVariableDecl> params,
  2110                             List<JCVariableDecl> params,
       
  2111                             List<JCTypeAnnotation> receiver,
  2059                             List<JCExpression> thrown,
  2112                             List<JCExpression> thrown,
  2060                             JCBlock body,
  2113                             JCBlock body,
  2061                             JCExpression defaultValue);
  2114                             JCExpression defaultValue);
  2062         JCVariableDecl VarDef(JCModifiers mods,
  2115         JCVariableDecl VarDef(JCModifiers mods,
  2063                       Name name,
  2116                       Name name,
  2170         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
  2223         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
  2171         public void visitWildcard(JCWildcard that)           { visitTree(that); }
  2224         public void visitWildcard(JCWildcard that)           { visitTree(that); }
  2172         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
  2225         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
  2173         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
  2226         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
  2174         public void visitModifiers(JCModifiers that)         { visitTree(that); }
  2227         public void visitModifiers(JCModifiers that)         { visitTree(that); }
       
  2228         public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
  2175         public void visitErroneous(JCErroneous that)         { visitTree(that); }
  2229         public void visitErroneous(JCErroneous that)         { visitTree(that); }
  2176         public void visitLetExpr(LetExpr that)               { visitTree(that); }
  2230         public void visitLetExpr(LetExpr that)               { visitTree(that); }
  2177 
  2231 
  2178         public void visitTree(JCTree that)                   { assert false; }
  2232         public void visitTree(JCTree that)                   { assert false; }
  2179     }
  2233     }