src/share/classes/com/sun/tools/javac/code/Symbol.java

changeset 1571
af8417e590f4
parent 1565
d04960f05593
child 1607
bd49e0304281
equal deleted inserted replaced
1570:f91144b7da75 1571:af8417e590f4
215 215
216 public boolean isInterface() { 216 public boolean isInterface() {
217 return (flags() & INTERFACE) != 0; 217 return (flags() & INTERFACE) != 0;
218 } 218 }
219 219
220 public boolean isPrivate() {
221 return (flags_field & Flags.AccessFlags) == PRIVATE;
222 }
223
224 public boolean isEnum() {
225 return (flags() & ENUM) != 0;
226 }
227
220 /** Is this symbol declared (directly or indirectly) local 228 /** Is this symbol declared (directly or indirectly) local
221 * to a method or variable initializer? 229 * to a method or variable initializer?
222 * Also includes fields of inner classes which are in 230 * Also includes fields of inner classes which are in
223 * turn local to a method or variable initializer. 231 * turn local to a method or variable initializer.
224 */ 232 */
477 public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) { 485 public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
478 return JavacElements.getAnnotation(this, annoType); 486 return JavacElements.getAnnotation(this, annoType);
479 } 487 }
480 488
481 // This method is part of the javax.lang.model API, do not use this in javac code. 489 // This method is part of the javax.lang.model API, do not use this in javac code.
482 public <A extends java.lang.annotation.Annotation> A[] getAnnotations(Class<A> annoType) { 490 public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(Class<A> annoType) {
483 return JavacElements.getAnnotations(this, annoType); 491 return JavacElements.getAnnotations(this, annoType);
484 } 492 }
485 493
486 // TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList 494 // TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList
487 public java.util.List<Symbol> getEnclosedElements() { 495 public java.util.List<Symbol> getEnclosedElements() {
494 l.append(t.tsym); 502 l.append(t.tsym);
495 } 503 }
496 return l.toList(); 504 return l.toList();
497 } 505 }
498 506
499 public static class DelegatedSymbol extends Symbol { 507 public static class DelegatedSymbol<T extends Symbol> extends Symbol {
500 protected Symbol other; 508 protected T other;
501 public DelegatedSymbol(Symbol other) { 509 public DelegatedSymbol(T other) {
502 super(other.kind, other.flags_field, other.name, other.type, other.owner); 510 super(other.kind, other.flags_field, other.name, other.type, other.owner);
503 this.other = other; 511 this.other = other;
504 } 512 }
505 public String toString() { return other.toString(); } 513 public String toString() { return other.toString(); }
506 public Symbol location() { return other.location(); } 514 public Symbol location() { return other.location(); }
530 } 538 }
531 539
532 public <R, P> R accept(Symbol.Visitor<R, P> v, P p) { 540 public <R, P> R accept(Symbol.Visitor<R, P> v, P p) {
533 return v.visitSymbol(other, p); 541 return v.visitSymbol(other, p);
534 } 542 }
543
544 public T getUnderlyingSymbol() {
545 return other;
546 }
535 } 547 }
536 548
537 /** A class for type symbols. Type variables are represented by instances 549 /** A class for type symbols. Type variables are represented by instances
538 * of this class, classes and packages by instances of subclasses. 550 * of this class, classes and packages by instances of subclasses.
539 */ 551 */
1075 */ 1087 */
1076 public static class MethodSymbol extends Symbol implements ExecutableElement { 1088 public static class MethodSymbol extends Symbol implements ExecutableElement {
1077 1089
1078 /** The code of the method. */ 1090 /** The code of the method. */
1079 public Code code = null; 1091 public Code code = null;
1092
1093 /** The extra (synthetic/mandated) parameters of the method. */
1094 public List<VarSymbol> extraParams = List.nil();
1080 1095
1081 /** The parameters of the method. */ 1096 /** The parameters of the method. */
1082 public List<VarSymbol> params = null; 1097 public List<VarSymbol> params = null;
1083 1098
1084 /** The names of the parameters */ 1099 /** The names of the parameters */

mercurial