File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
src/main/java/com/github/markusbernhardt/xmldoclet Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -221,19 +221,24 @@ protected AnnotationInstance parseAnnotationDesc(final AnnotationMirror annotati
221
221
222
222
final Object objValue = elementValuesPair .getValue ();
223
223
switch (objValue ) {
224
- case AnnotationValue [] annotationValues -> {
225
- for (final AnnotationValue annotationValue : annotationValues ) {
226
- if (annotationValue .getValue () instanceof AnnotationMirror annoDesc ) {
227
- annotationArgumentNode .getAnnotation ().add (parseAnnotationDesc (annoDesc , programElement ));
228
- } else {
229
- annotationArgumentNode .getValue ().add (annotationValue .getValue ().toString ());
224
+ case AnnotationValue annotationValue -> {
225
+ if (annotationValue .getValue () instanceof List <?> valueList ) {
226
+ for (final Object value : valueList ) {
227
+ if (annotationValue .getValue () instanceof AnnotationMirror annoDesc ) {
228
+ annotationArgumentNode .getAnnotation ().add (parseAnnotationDesc (annoDesc , programElement ));
229
+ } else {
230
+ /*
231
+ Consider the annotation @Annotation1("A") or @Annotation1({"A", "B"}}).
232
+ The annotation value is an AnnototionValue object with value attribute.
233
+ This attribute is a List (even if there is a single value).
234
+ But each value is not the actual value, but another AnnotationValue object with a value attribute.
235
+ */
236
+ annotationArgumentNode .getValue ().add (((AnnotationValue )value ).getValue ().toString ());
237
+ }
230
238
}
231
239
}
232
240
}
233
- case VariableElement fieldDoc -> annotationArgumentNode .getValue ().add (getSimpleName (fieldDoc ));
234
- case TypeElement classDoc -> annotationArgumentNode .getValue ().add (getQualifiedName (classDoc ));
235
- case null -> {
236
- }
241
+ case null -> {}
237
242
default -> annotationArgumentNode .getValue ().add (objValue .toString ());
238
243
}
239
244
You can’t perform that action at this time.
0 commit comments