src/share/classes/com/sun/tools/javac/tree/JCTree.java

changeset 815
d17f37522154
parent 798
4868a36f6fd8
child 816
7c537f4298fb
equal deleted inserted replaced
810:15484cb7e5ae 815:d17f37522154
1 /* 1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
638 public JCModifiers mods; 638 public JCModifiers mods;
639 public Name name; 639 public Name name;
640 public JCExpression restype; 640 public JCExpression restype;
641 public List<JCTypeParameter> typarams; 641 public List<JCTypeParameter> typarams;
642 public List<JCVariableDecl> params; 642 public List<JCVariableDecl> params;
643 public List<JCTypeAnnotation> receiverAnnotations;
644 public List<JCExpression> thrown; 643 public List<JCExpression> thrown;
645 public JCBlock body; 644 public JCBlock body;
646 public JCExpression defaultValue; // for annotation types 645 public JCExpression defaultValue; // for annotation types
647 public MethodSymbol sym; 646 public MethodSymbol sym;
648 protected JCMethodDecl(JCModifiers mods, 647 protected JCMethodDecl(JCModifiers mods,
649 Name name, 648 Name name,
650 JCExpression restype, 649 JCExpression restype,
651 List<JCTypeParameter> typarams, 650 List<JCTypeParameter> typarams,
652 List<JCVariableDecl> params, 651 List<JCVariableDecl> params,
653 List<JCTypeAnnotation> receiver,
654 List<JCExpression> thrown, 652 List<JCExpression> thrown,
655 JCBlock body, 653 JCBlock body,
656 JCExpression defaultValue, 654 JCExpression defaultValue,
657 MethodSymbol sym) 655 MethodSymbol sym)
658 { 656 {
659 this.mods = mods; 657 this.mods = mods;
660 this.name = name; 658 this.name = name;
661 this.restype = restype; 659 this.restype = restype;
662 this.typarams = typarams; 660 this.typarams = typarams;
663 this.params = params; 661 this.params = params;
664 this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
665 this.thrown = thrown; 662 this.thrown = thrown;
666 this.body = body; 663 this.body = body;
667 this.defaultValue = defaultValue; 664 this.defaultValue = defaultValue;
668 this.sym = sym; 665 this.sym = sym;
669 } 666 }
678 return typarams; 675 return typarams;
679 } 676 }
680 public List<JCVariableDecl> getParameters() { 677 public List<JCVariableDecl> getParameters() {
681 return params; 678 return params;
682 } 679 }
683 public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
684 public List<JCExpression> getThrows() { 680 public List<JCExpression> getThrows() {
685 return thrown; 681 return thrown;
686 } 682 }
687 public JCBlock getBody() { return body; } 683 public JCBlock getBody() { return body; }
688 public JCTree getDefaultValue() { // for annotation types 684 public JCTree getDefaultValue() { // for annotation types
1400 * A new[...] operation. 1396 * A new[...] operation.
1401 */ 1397 */
1402 public static class JCNewArray extends JCExpression implements NewArrayTree { 1398 public static class JCNewArray extends JCExpression implements NewArrayTree {
1403 public JCExpression elemtype; 1399 public JCExpression elemtype;
1404 public List<JCExpression> dims; 1400 public List<JCExpression> dims;
1405 public List<JCTypeAnnotation> annotations;
1406 public List<List<JCTypeAnnotation>> dimAnnotations;
1407 public List<JCExpression> elems; 1401 public List<JCExpression> elems;
1408 protected JCNewArray(JCExpression elemtype, 1402 protected JCNewArray(JCExpression elemtype,
1409 List<JCExpression> dims, 1403 List<JCExpression> dims,
1410 List<JCExpression> elems) 1404 List<JCExpression> elems)
1411 { 1405 {
1412 this.elemtype = elemtype; 1406 this.elemtype = elemtype;
1413 this.dims = dims; 1407 this.dims = dims;
1414 this.annotations = List.nil();
1415 this.dimAnnotations = List.nil();
1416 this.elems = elems; 1408 this.elems = elems;
1417 } 1409 }
1418 @Override 1410 @Override
1419 public void accept(Visitor v) { v.visitNewArray(this); } 1411 public void accept(Visitor v) { v.visitNewArray(this); }
1420 1412
1921 * @param bounds bounds 1913 * @param bounds bounds
1922 */ 1914 */
1923 public static class JCTypeParameter extends JCTree implements TypeParameterTree { 1915 public static class JCTypeParameter extends JCTree implements TypeParameterTree {
1924 public Name name; 1916 public Name name;
1925 public List<JCExpression> bounds; 1917 public List<JCExpression> bounds;
1926 public List<JCTypeAnnotation> annotations; 1918 protected JCTypeParameter(Name name, List<JCExpression> bounds) {
1927 protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
1928 this.name = name; 1919 this.name = name;
1929 this.bounds = bounds; 1920 this.bounds = bounds;
1930 this.annotations = annotations;
1931 } 1921 }
1932 @Override 1922 @Override
1933 public void accept(Visitor v) { v.visitTypeParameter(this); } 1923 public void accept(Visitor v) { v.visitTypeParameter(this); }
1934 1924
1935 public Kind getKind() { return Kind.TYPE_PARAMETER; } 1925 public Kind getKind() { return Kind.TYPE_PARAMETER; }
1936 public Name getName() { return name; } 1926 public Name getName() { return name; }
1937 public List<JCExpression> getBounds() { 1927 public List<JCExpression> getBounds() {
1938 return bounds; 1928 return bounds;
1939 }
1940 public List<JCTypeAnnotation> getAnnotations() {
1941 return annotations;
1942 } 1929 }
1943 @Override 1930 @Override
1944 public <R,D> R accept(TreeVisitor<R,D> v, D d) { 1931 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1945 return v.visitTypeParameter(this, d); 1932 return v.visitTypeParameter(this, d);
1946 } 1933 }
2028 public int getTag() { 2015 public int getTag() {
2029 return ANNOTATION; 2016 return ANNOTATION;
2030 } 2017 }
2031 } 2018 }
2032 2019
2033 public static class JCTypeAnnotation extends JCAnnotation {
2034 public TypeAnnotationPosition annotation_position;
2035 public Attribute.TypeCompound attribute_field;
2036
2037 protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
2038 super(annotationType, args);
2039 this.annotation_position = new TypeAnnotationPosition();
2040 }
2041 }
2042
2043 public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree { 2020 public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
2044 public long flags; 2021 public long flags;
2045 public List<JCAnnotation> annotations; 2022 public List<JCAnnotation> annotations;
2046 protected JCModifiers(long flags, List<JCAnnotation> annotations) { 2023 protected JCModifiers(long flags, List<JCAnnotation> annotations) {
2047 this.flags = flags; 2024 this.flags = flags;
2062 return v.visitModifiers(this, d); 2039 return v.visitModifiers(this, d);
2063 } 2040 }
2064 @Override 2041 @Override
2065 public int getTag() { 2042 public int getTag() {
2066 return MODIFIERS; 2043 return MODIFIERS;
2067 }
2068 }
2069
2070 public static class JCAnnotatedType extends JCExpression
2071 //308 implements com.sun.source.tree.AnnotatedTypeTree
2072 {
2073 public List<JCTypeAnnotation> annotations;
2074 public JCExpression underlyingType;
2075 protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
2076 throw new UnsupportedOperationException();
2077 //308 this.annotations = annotations;
2078 //308 this.underlyingType = underlyingType;
2079 }
2080 @Override
2081 public void accept(Visitor v) { v.visitAnnotatedType(this); }
2082
2083 public Kind getKind() {
2084 throw new UnsupportedOperationException();
2085 //308 return Kind.ANNOTATED_TYPE;
2086 }
2087 public List<JCTypeAnnotation> getAnnotations() {
2088 return annotations;
2089 }
2090 public JCExpression getUnderlyingType() {
2091 return underlyingType;
2092 }
2093 @Override
2094 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2095 throw new UnsupportedOperationException();
2096 //308 return v.visitAnnotatedType(this, d);
2097 }
2098 @Override
2099 public int getTag() {
2100 return ANNOTATED_TYPE;
2101 } 2044 }
2102 } 2045 }
2103 2046
2104 public static class JCErroneous extends JCExpression 2047 public static class JCErroneous extends JCExpression
2105 implements com.sun.source.tree.ErroneousTree { 2048 implements com.sun.source.tree.ErroneousTree {
2166 JCMethodDecl MethodDef(JCModifiers mods, 2109 JCMethodDecl MethodDef(JCModifiers mods,
2167 Name name, 2110 Name name,
2168 JCExpression restype, 2111 JCExpression restype,
2169 List<JCTypeParameter> typarams, 2112 List<JCTypeParameter> typarams,
2170 List<JCVariableDecl> params, 2113 List<JCVariableDecl> params,
2171 List<JCTypeAnnotation> receiver,
2172 List<JCExpression> thrown, 2114 List<JCExpression> thrown,
2173 JCBlock body, 2115 JCBlock body,
2174 JCExpression defaultValue); 2116 JCExpression defaultValue);
2175 JCVariableDecl VarDef(JCModifiers mods, 2117 JCVariableDecl VarDef(JCModifiers mods,
2176 Name name, 2118 Name name,
2288 public void visitTypeParameter(JCTypeParameter that) { visitTree(that); } 2230 public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
2289 public void visitWildcard(JCWildcard that) { visitTree(that); } 2231 public void visitWildcard(JCWildcard that) { visitTree(that); }
2290 public void visitTypeBoundKind(TypeBoundKind that) { visitTree(that); } 2232 public void visitTypeBoundKind(TypeBoundKind that) { visitTree(that); }
2291 public void visitAnnotation(JCAnnotation that) { visitTree(that); } 2233 public void visitAnnotation(JCAnnotation that) { visitTree(that); }
2292 public void visitModifiers(JCModifiers that) { visitTree(that); } 2234 public void visitModifiers(JCModifiers that) { visitTree(that); }
2293 public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
2294 public void visitErroneous(JCErroneous that) { visitTree(that); } 2235 public void visitErroneous(JCErroneous that) { visitTree(that); }
2295 public void visitLetExpr(LetExpr that) { visitTree(that); } 2236 public void visitLetExpr(LetExpr that) { visitTree(that); }
2296 2237
2297 public void visitTree(JCTree that) { assert false; } 2238 public void visitTree(JCTree that) { assert false; }
2298 } 2239 }

mercurial