@@ -380,14 +380,9 @@ private void addMethod( IModule module, SrcClass srcClass, Symbol.MethodSymbol m
380380 Type throwType = thrownTypes .get ( i );
381381 srcMethod .addThrowType ( makeSrcType ( throwType , method , TargetType .THROWS , i ) );
382382 }
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+
391386 String bodyStmt ;
392387 if ( srcMethod .isConstructor () && !srcClass .isEnum () )
393388 {
@@ -415,6 +410,32 @@ private void addMethod( IModule module, SrcClass srcClass, Symbol.MethodSymbol m
415410 srcClass .addMethod ( srcMethod );
416411 }
417412
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+
418439 private static Set <javax .lang .model .element .Modifier > getModifiers ( Symbol .MethodSymbol method )
419440 {
420441 long flags = method .flags ();
0 commit comments