27 |
27 |
28 import com.sun.javadoc.*; |
28 import com.sun.javadoc.*; |
29 |
29 |
30 import com.sun.tools.javac.code.Attribute; |
30 import com.sun.tools.javac.code.Attribute; |
31 import com.sun.tools.javac.code.Symbol.*; |
31 import com.sun.tools.javac.code.Symbol.*; |
32 import com.sun.tools.javac.code.TypeTags; |
|
33 |
32 |
|
33 import static com.sun.tools.javac.code.TypeTag.BOOLEAN; |
34 |
34 |
35 /** |
35 /** |
36 * Represents a value of an annotation type element. |
36 * Represents a value of an annotation type element. |
37 * |
37 * |
38 * <p><b>This is NOT part of any supported API. |
38 * <p><b>This is NOT part of any supported API. |
74 |
74 |
75 private class ValueVisitor implements Attribute.Visitor { |
75 private class ValueVisitor implements Attribute.Visitor { |
76 public Object value; |
76 public Object value; |
77 |
77 |
78 public void visitConstant(Attribute.Constant c) { |
78 public void visitConstant(Attribute.Constant c) { |
79 if (c.type.tag == TypeTags.BOOLEAN) { |
79 if (c.type.hasTag(BOOLEAN)) { |
80 // javac represents false and true as integers 0 and 1 |
80 // javac represents false and true as integers 0 and 1 |
81 value = Boolean.valueOf( |
81 value = Boolean.valueOf( |
82 ((Integer)c.value).intValue() != 0); |
82 ((Integer)c.value).intValue() != 0); |
83 } else { |
83 } else { |
84 value = c.value; |
84 value = c.value; |
131 public String toString() { |
131 public String toString() { |
132 return sb.toString(); |
132 return sb.toString(); |
133 } |
133 } |
134 |
134 |
135 public void visitConstant(Attribute.Constant c) { |
135 public void visitConstant(Attribute.Constant c) { |
136 if (c.type.tag == TypeTags.BOOLEAN) { |
136 if (c.type.hasTag(BOOLEAN)) { |
137 // javac represents false and true as integers 0 and 1 |
137 // javac represents false and true as integers 0 and 1 |
138 sb.append(((Integer)c.value).intValue() != 0); |
138 sb.append(((Integer)c.value).intValue() != 0); |
139 } else { |
139 } else { |
140 sb.append(FieldDocImpl.constantValueExpression(c.value)); |
140 sb.append(FieldDocImpl.constantValueExpression(c.value)); |
141 } |
141 } |