JDK-6469561 : javadoc for annotation types should not display "public abstract" modifiers on methods
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-09-12
  • Updated: 2016-08-12
  • Resolved: 2016-02-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b107Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8164413 :  
Description
Currently the generated detail javadoc for the members of annotation type are displayed like 
"    public abstract ElementType[] value"

from java.lang.annotation.Target.  However, these members are methods on an interface (an annotation type is a kind of interface); therefore, just as the methods of an interface shouldn't have the "public abstract" modifiers printed, neither should the members of an annotation type.

Comments
Draft release note text: Behavioral compatibility change. Previously javadoc would emit "public" and "abstract" modifiers for methods and fields in annotation types. These flags are not needed in source code and are elided for non-annotation type interface type. With this change, those modifiers are also omitted for methods and fields defined in annotation types.
16-02-2016

Review thread: http://mail.openjdk.java.net/pipermail/compiler-dev/2016-February/009994.html
14-02-2016

The printing processor in the javac sources src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java contains logic that prints out the recommended set of modifiers as of Java SE 7: private void printModifiers(Element e) { ElementKind kind = e.getKind(); if (kind == PARAMETER) { printAnnotationsInline(e); } else { printAnnotations(e); indent(); } if (kind == ENUM_CONSTANT) return; Set<Modifier> modifiers = new LinkedHashSet<Modifier>(); modifiers.addAll(e.getModifiers()); switch (kind) { case ANNOTATION_TYPE: case INTERFACE: modifiers.remove(Modifier.ABSTRACT); break; case ENUM: modifiers.remove(Modifier.FINAL); modifiers.remove(Modifier.ABSTRACT); break; case METHOD: case FIELD: Element enclosingElement = e.getEnclosingElement(); if (enclosingElement != null && enclosingElement.getKind().isInterface()) { modifiers.remove(Modifier.PUBLIC); modifiers.remove(Modifier.ABSTRACT); // only for methods modifiers.remove(Modifier.STATIC); // only for fields modifiers.remove(Modifier.FINAL); // only for fields } break; } for(Modifier m: modifiers) { writer.print(m.toString() + " "); } }
12-12-2012