@@ -380,14 +380,9 @@ private void addMethod( IModule module, SrcClass srcClass, Symbol.MethodSymbol m
380
380
Type throwType = thrownTypes .get ( i );
381
381
srcMethod .addThrowType ( makeSrcType ( throwType , method , TargetType .THROWS , i ) );
382
382
}
383
- if ( (method .owner .flags_field & Flags .ANNOTATION ) != 0 )
384
- {
385
- Attribute defaultValue = method .getDefaultValue ();
386
- if ( defaultValue != null )
387
- {
388
- srcMethod .setDefaultValue ( defaultValue .toString () );
389
- }
390
- }
383
+
384
+ setAnnotationDefaultValue ( method , srcMethod );
385
+
391
386
String bodyStmt ;
392
387
if ( srcMethod .isConstructor () && !srcClass .isEnum () )
393
388
{
@@ -415,6 +410,32 @@ private void addMethod( IModule module, SrcClass srcClass, Symbol.MethodSymbol m
415
410
srcClass .addMethod ( srcMethod );
416
411
}
417
412
413
+ private void setAnnotationDefaultValue ( Symbol .MethodSymbol method , SrcMethod srcMethod )
414
+ {
415
+ if ( (method .owner .flags_field & Flags .ANNOTATION ) == 0 )
416
+ {
417
+ // declaring class is not an annotation
418
+ return ;
419
+ }
420
+
421
+ Attribute defaultValue = method .getDefaultValue ();
422
+ if ( defaultValue == null )
423
+ {
424
+ // annotation method does not have a default value
425
+ return ;
426
+ }
427
+
428
+ String qualifiedValue = defaultValue .toString ();
429
+ if ( defaultValue instanceof Attribute .Enum )
430
+ {
431
+ // enum constants must be qualified
432
+
433
+ Symbol .VarSymbol value = ((Attribute .Enum )defaultValue ).getValue ();
434
+ qualifiedValue = value .enclClass () + "." + value ;
435
+ }
436
+ srcMethod .setDefaultValue ( qualifiedValue );
437
+ }
438
+
418
439
private static Set <javax .lang .model .element .Modifier > getModifiers ( Symbol .MethodSymbol method )
419
440
{
420
441
long flags = method .flags ();
0 commit comments