< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java

Print this page




 244     }
 245 
 246     /**
 247      * Add the modifier for the member. The modifiers are ordered as specified
 248      * by <em>The Java Language Specification</em>.
 249      *
 250      * @param member the member for which teh modifier will be added.
 251      * @param htmltree the content tree to which the modifier information will be added.
 252      */
 253     protected void addModifiers(Element member, Content htmltree) {
 254         Set<Modifier> set = new TreeSet<>(member.getModifiers());
 255 
 256         // remove the ones we really don't need
 257         set.remove(NATIVE);
 258         set.remove(SYNCHRONIZED);
 259         set.remove(STRICTFP);
 260 
 261         // According to JLS, we should not be showing public modifier for
 262         // interface methods.
 263         if ((utils.isField(member) || utils.isMethod(member))
 264                 && writer instanceof ClassWriterImpl
 265                 && utils.isInterface(((ClassWriterImpl) writer).getTypeElement())) {

 266             // Remove the implicit abstract and public modifiers
 267             if (utils.isMethod(member) && utils.isInterface(member.getEnclosingElement())) {


 268                 set.remove(ABSTRACT);
 269                 set.remove(PUBLIC);
 270             }
 271             if (!utils.isMethod(member)) {
 272                 set.remove(PUBLIC);
 273             }
 274         }
 275         if (!set.isEmpty()) {
 276             String mods = set.stream().map(m -> m.toString()).collect(Collectors.joining(" "));
 277             htmltree.addContent(mods);
 278             htmltree.addContent(writer.getSpace());
 279         }
 280     }
 281 
 282     protected String makeSpace(int len) {
 283         if (len <= 0) {
 284             return "";
 285         }
 286         StringBuilder sb = new StringBuilder(len);
 287         for (int i = 0; i < len; i++) {




 244     }
 245 
 246     /**
 247      * Add the modifier for the member. The modifiers are ordered as specified
 248      * by <em>The Java Language Specification</em>.
 249      *
 250      * @param member the member for which teh modifier will be added.
 251      * @param htmltree the content tree to which the modifier information will be added.
 252      */
 253     protected void addModifiers(Element member, Content htmltree) {
 254         Set<Modifier> set = new TreeSet<>(member.getModifiers());
 255 
 256         // remove the ones we really don't need
 257         set.remove(NATIVE);
 258         set.remove(SYNCHRONIZED);
 259         set.remove(STRICTFP);
 260 
 261         // According to JLS, we should not be showing public modifier for
 262         // interface methods.
 263         if ((utils.isField(member) || utils.isMethod(member))
 264             && ((writer instanceof ClassWriterImpl
 265                  && utils.isInterface(((ClassWriterImpl) writer).getTypeElement())  ||
 266                  writer instanceof AnnotationTypeWriterImpl) )) {
 267             // Remove the implicit abstract and public modifiers
 268             if (utils.isMethod(member) &&
 269                 (utils.isInterface(member.getEnclosingElement()) ||
 270                  utils.isAnnotationType(member.getEnclosingElement()))) {
 271                 set.remove(ABSTRACT);
 272                 set.remove(PUBLIC);
 273             }
 274             if (!utils.isMethod(member)) {
 275                 set.remove(PUBLIC);
 276             }
 277         }
 278         if (!set.isEmpty()) {
 279             String mods = set.stream().map(m -> m.toString()).collect(Collectors.joining(" "));
 280             htmltree.addContent(mods);
 281             htmltree.addContent(writer.getSpace());
 282         }
 283     }
 284 
 285     protected String makeSpace(int len) {
 286         if (len <= 0) {
 287             return "";
 288         }
 289         StringBuilder sb = new StringBuilder(len);
 290         for (int i = 0; i < len; i++) {


< prev index next >