test/langtools/jdk/javadoc/doclet/testVisibleMembers/TestVisibleMembers.java
changeset 49879 601277b1d582
child 53097 2e82ca64b25d
equal deleted inserted replaced
49878:2422d4e027b0 49879:601277b1d582
       
     1 /*
       
     2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /*
       
    25  * @test
       
    26  * @bug 8025091 8198890
       
    27  * @summary Verify the presence visible members in the case of
       
    28  *          member hiding and overridding.
       
    29  * @library /tools/lib ../lib
       
    30  * @modules jdk.javadoc/jdk.javadoc.internal.tool
       
    31  * @build JavadocTester toolbox.ToolBox builder.ClassBuilder
       
    32  * @run main TestVisibleMembers
       
    33  */
       
    34 
       
    35 import java.nio.file.Path;
       
    36 import java.nio.file.Paths;
       
    37 
       
    38 import builder.AbstractBuilder;
       
    39 import builder.AbstractBuilder.Comment.Kind;
       
    40 import builder.ClassBuilder;
       
    41 import builder.ClassBuilder.*;
       
    42 
       
    43 import toolbox.ToolBox;
       
    44 import builder.ClassBuilder;
       
    45 
       
    46 public class TestVisibleMembers extends JavadocTester {
       
    47 
       
    48     final ToolBox tb;
       
    49     public static void main(String... args) throws Exception {
       
    50         TestVisibleMembers tester = new TestVisibleMembers();
       
    51         tester.runTests(m -> new Object[] { Paths.get(m.getName()) });
       
    52     }
       
    53 
       
    54     TestVisibleMembers() {
       
    55         tb = new ToolBox();
       
    56     }
       
    57 
       
    58     @Test
       
    59     void testChronoDiamondLeafDetail(Path base) throws Exception {
       
    60         Path srcDir = base.resolve("src");
       
    61         emitChronoDiamondLeaf(srcDir);
       
    62 
       
    63         Path outDir = base.resolve("out");
       
    64         javadoc("-d", outDir.toString(),
       
    65                 "-html5",
       
    66                 "--override-methods=detail",
       
    67                 "-sourcepath", srcDir.toString(),
       
    68                 "p");
       
    69         checkExit(Exit.OK);
       
    70 
       
    71         checkOrder("p/C.html", "METHOD SUMMARY",
       
    72                 "boolean", "equals", "java.lang.Object", "Method equals in p.C",
       
    73                 "C", "with", "java.lang.Object", "obj",  "Method with in p.C",
       
    74                 "C", "with", "java.lang.Object", "obj", "long", "lvalue", "Method with in p.C",
       
    75                 "METHOD DETAIL");
       
    76         checkOutput("p/C.html", false, "BImpl");
       
    77 
       
    78         checkOrder("p/E.html", "METHOD SUMMARY",
       
    79                 "boolean", "equals", "java.lang.Object", "Method equals in p.E",
       
    80                 "C", "with", "java.lang.Object", "Method with in p.E",
       
    81                 "C", "with", "java.lang.Object", "obj", "long", "lvalue", "Method with in p.E",
       
    82                 "METHOD DETAIL");
       
    83         checkOutput("p/E.html", false, "EImpl");
       
    84     }
       
    85 
       
    86     @Test
       
    87     void testChronoDiamondLeafSummary(Path base) throws Exception {
       
    88         Path srcDir = base.resolve("src");
       
    89         emitChronoDiamondLeaf(srcDir);
       
    90 
       
    91         Path outDir = base.resolve("out-member");
       
    92         javadoc("-d", outDir.toString(),
       
    93                 "-html5",
       
    94                 "--override-methods=summary",
       
    95                 "-sourcepath", srcDir.toString(),
       
    96                 "p");
       
    97         checkExit(Exit.OK);
       
    98 
       
    99         checkOrder("p/C.html", "METHOD SUMMARY",
       
   100                 "boolean", "equals", "java.lang.Object", "Method equals in p.C",
       
   101                 "C", "with", "java.lang.Object", "obj", "Method with in p.C",
       
   102                 "C", "with", "java.lang.Object", "obj", "long", "lvalue", "Method with in p.C",
       
   103                 "METHOD DETAIL");
       
   104         checkOutput("p/C.html", false, "BImpl");
       
   105 
       
   106         checkOrder("p/E.html", "METHOD SUMMARY",
       
   107                 "boolean", "equals", "java.lang.Object", "Method equals in p.E",
       
   108                 "C", "with", "java.lang.Object", "Method with in p.E",
       
   109                 "C", "with", "java.lang.Object", "long", "lvalue", "Method with in p.E",
       
   110                 "METHOD DETAIL");
       
   111         checkOutput("p/E.html", false, "EImpl");
       
   112     }
       
   113 
       
   114     // see j.t.TemporalAdjuster
       
   115     void emitChronoDiamondLeaf(Path srcDir) throws Exception {
       
   116 
       
   117         // Interface A
       
   118         MethodBuilder mbWith1 = MethodBuilder
       
   119                 .parse("default Object with(Object obj) {return null;}");
       
   120         MethodBuilder mbWith2 = MethodBuilder
       
   121                 .parse("default Object with(Object obj, long lvalue) {return null;}");
       
   122 
       
   123         new ClassBuilder(tb, "p.A")
       
   124                 .setModifiers("public", "interface")
       
   125                 .addMembers(mbWith1, mbWith2)
       
   126                 .write(srcDir);
       
   127 
       
   128         // Interface B
       
   129         mbWith1.setComments("{@inheritDoc}", "@param obj an object",
       
   130                 "@return something");
       
   131 
       
   132         mbWith2.setComments("{@inheritDoc}", "@param obj an object",
       
   133                 "@param lvalue an lvalue", "@return something");
       
   134 
       
   135         new ClassBuilder(tb, "p.B")
       
   136                 .setModifiers( "public", "interface")
       
   137                 .setExtends("A")
       
   138                 .addMembers(mbWith1, mbWith2)
       
   139                 .write(srcDir);
       
   140 
       
   141         // Class BImpl
       
   142         MethodBuilder mb31 = MethodBuilder.parse("C with(Object obj) {return null;}");
       
   143         MethodBuilder mb32 = MethodBuilder.parse("C with(Object obj, Long lobj) {return null;}");
       
   144         new ClassBuilder(tb, "p.BImpl<C extends B>")
       
   145                 .setModifiers( "abstract", "class")
       
   146                 .addImplements("B")
       
   147                 .addMembers(mb31, mb32)
       
   148                 .write(srcDir);
       
   149 
       
   150         // Class C
       
   151         new ClassBuilder(tb, "p.C")
       
   152                 .setModifiers("public", "class")
       
   153                 .setExtends("BImpl")
       
   154                 .addMembers(mbWith1.setReturn("C")
       
   155                         .setModifiers("public")
       
   156                         .setComments(AbstractBuilder.Comment.Kind.AUTO))
       
   157                 .addMembers(mbWith2.setReturn("C")
       
   158                         .setModifiers("public")
       
   159                         .setComments(AbstractBuilder.Comment.Kind.AUTO))
       
   160                 .addMembers(MethodBuilder.parse("public boolean equals(Object obj) { return false;}"))
       
   161                 .write(srcDir);
       
   162 
       
   163         // Class EImpl
       
   164         MethodBuilder mb41 = MethodBuilder.parse("C with(Object obj) {return null;}")
       
   165                 .setComments(Kind.NO_API_COMMENT);
       
   166         MethodBuilder mb42 = MethodBuilder.parse("C with(Object obj, Long lobj) {return null;}");
       
   167         new ClassBuilder(tb, "p.EImpl<C extends B>")
       
   168                 .setModifiers( "abstract", "class")
       
   169                 .addImplements("B")
       
   170                 .addMembers(mb41, mb42)
       
   171                 .write(srcDir);
       
   172 
       
   173         // Class E
       
   174         MethodBuilder mb51 = MethodBuilder.parse("public C with(Object obj) {return null;}");
       
   175         MethodBuilder mb52 = MethodBuilder.parse("public C with(Object obj, long lvalue) {return null;}");
       
   176         MethodBuilder mb53 = MethodBuilder.parse("public boolean equals(Object obj) { return false;}");
       
   177         new ClassBuilder(tb, "p.E")
       
   178                 .setModifiers("public", "class")
       
   179                 .setExtends("EImpl")
       
   180                 .addMembers(mb51, mb52, mb53)
       
   181                 .write(srcDir);
       
   182     }
       
   183 
       
   184     @Test
       
   185     void testNestedInterfaceDetail(Path base) throws Exception {
       
   186         Path srcDir = base.resolve("src");
       
   187         emitNestedInterface(srcDir);
       
   188 
       
   189         Path outDir = base.resolve("out");
       
   190         javadoc("-d", outDir.toString(),
       
   191                 "-html5",
       
   192                 "--override-methods=detail",
       
   193                 "-sourcepath", srcDir.toString(),
       
   194                 "p");
       
   195         checkExit(Exit.OK);
       
   196 
       
   197         checkOutput("p/TA.html", false, "getTA");
       
   198 
       
   199         checkOrder("p/Bar.html",
       
   200                 "doSomething()",
       
   201                 "getTA()");
       
   202     }
       
   203 
       
   204     @Test
       
   205     void testNestedInterfaceSummary(Path base) throws Exception {
       
   206         Path srcDir = base.resolve("src");
       
   207         emitNestedInterface(srcDir);
       
   208 
       
   209         Path outDir = base.resolve("out");
       
   210         javadoc("-d", outDir.toString(),
       
   211                 "-html5",
       
   212                 "--override-methods=summary",
       
   213                 "-sourcepath", srcDir.toString(),
       
   214                 "p");
       
   215         checkExit(Exit.OK);
       
   216 
       
   217         checkOutput("p/TA.html", false, "getTA");
       
   218 
       
   219         checkOrder("p/Bar.html",
       
   220                 "doSomething()",
       
   221                 "getTA()");
       
   222 
       
   223         checkOrder("p/Foo.html",
       
   224                 "Methods declared in",
       
   225                 "Bar.html",
       
   226                 "getTA");
       
   227     }
       
   228 
       
   229     // See jx.s.TransferHandler
       
   230     void emitNestedInterface(Path srcDir) throws Exception {
       
   231 
       
   232         ClassBuilder innerI = new ClassBuilder(tb, "HasTA")
       
   233                 .setModifiers("interface");
       
   234         MethodBuilder interfaceMethod = MethodBuilder.parse("public TA getTa();")
       
   235                 .setComments(Kind.NO_API_COMMENT);
       
   236         innerI.addMembers(interfaceMethod);
       
   237 
       
   238         new ClassBuilder(tb, "p.TA")
       
   239                 .setModifiers("public", "class")
       
   240                 .addImplements("java.io.Serializable")
       
   241                 .addNestedClasses(innerI)
       
   242                 .write(srcDir);
       
   243 
       
   244         new ClassBuilder(tb, "p.Foo")
       
   245                 .setModifiers("public", "class")
       
   246                 .setExtends("Bar")
       
   247                 .write(srcDir);
       
   248 
       
   249         new ClassBuilder(tb, "p.Bar")
       
   250                 .setModifiers("public", "abstract", "class")
       
   251                 .addImplements("TA.HasTA")
       
   252                 .addMembers(
       
   253                     MethodBuilder.parse("public void doSomething(){}"),
       
   254                     MethodBuilder.parse("public TA getTA(){return null;}")
       
   255                 ).write(srcDir);
       
   256     }
       
   257 
       
   258     @Test
       
   259     void testStreamsMissingLinksDetail(Path base) throws Exception {
       
   260         Path srcDir = base.resolve("src");
       
   261         emitStreamsMissingLinks(srcDir);
       
   262 
       
   263         Path outDir = base.resolve("out");
       
   264         javadoc("-d", outDir.toString(),
       
   265                 "-html5",
       
   266                 "--override-methods=detail",
       
   267                 "-sourcepath", srcDir.toString(),
       
   268                 "p");
       
   269         checkExit(Exit.OK);
       
   270 
       
   271         checkOrder("p/C.html",
       
   272                 "METHOD DETAIL",
       
   273                 "public", "void", "method()",
       
   274                 "See Also:",
       
   275                 "sub()",
       
   276                 "sub1()");
       
   277 
       
   278         checkOrder("p/ILong.html",
       
   279                 "METHOD DETAIL",
       
   280                 "default", "void", "forEach", "java.util.function.Consumer",
       
   281                 "java.lang.Long", "action",
       
   282                 "Do you see me", "#forEach(java.util.function.LongConsumer)",
       
   283                 "forEach(LongConsumer)",
       
   284                 "END OF CLASS DATA");
       
   285 
       
   286         checkOrder("p/IImpl.html",
       
   287                 "METHOD DETAIL",
       
   288                 "Method sub in p.IImpl",
       
   289                 "Specified by:", "I.html", "II.html",
       
   290                 "END OF CLASS DATA");
       
   291     }
       
   292 
       
   293     @Test
       
   294     void testStreamsMissingLinksSummary(Path base) throws Exception {
       
   295         Path srcDir = base.resolve("src");
       
   296         emitStreamsMissingLinks(srcDir);
       
   297 
       
   298         Path outDir = base.resolve("out");
       
   299         javadoc("-d", outDir.toString(),
       
   300                 "-html5",
       
   301                 "--override-methods=summary",
       
   302                 "-sourcepath", srcDir.toString(),
       
   303                 "p");
       
   304         checkExit(Exit.OK);
       
   305 
       
   306         checkOrder("p/C.html",
       
   307                 "METHOD DETAIL",
       
   308                 "public", "void", "method()", "See Also:", "sub()", "I.sub1()",
       
   309                 "public", "void", "m", "Method in C. See", "I.length()"
       
   310                 );
       
   311 
       
   312         checkOrder("p/ILong.html",
       
   313                 "METHOD DETAIL",
       
   314                 "default", "void", "forEach", "java.util.function.Consumer",
       
   315                 "java.lang.Long", "action",
       
   316                 "Do you see me", "QLong.html#forEach(Q)",
       
   317                 "QLong.forEach(LongConsumer)",
       
   318                 "END OF CLASS DATA");
       
   319 
       
   320         checkOrder("p/IImpl.html",
       
   321                 "METHOD DETAIL",
       
   322                 "Method sub in p.IImpl",
       
   323                 "Specified by:", "I.html",
       
   324                 "END OF CLASS DATA");
       
   325 
       
   326         checkUnique("p/IImpl.html", "Specified by:");
       
   327     }
       
   328 
       
   329     // see j.u.Spliterator
       
   330     void emitStreamsMissingLinks(Path srcDir) throws Exception {
       
   331         new ClassBuilder(tb, "p.I")
       
   332                 .setModifiers("public", "interface")
       
   333                 .addMembers(
       
   334                         MethodBuilder.parse("public I sub();"),
       
   335                         MethodBuilder.parse("public I sub1();"),
       
   336                         MethodBuilder.parse("public int length();")
       
   337                 ).write(srcDir);
       
   338 
       
   339         new ClassBuilder(tb, "p.A")
       
   340                 .setModifiers("abstract", "class")
       
   341                 .addImplements("I")
       
   342                 .addMembers(
       
   343                         MethodBuilder.parse("public I sub() {}"),
       
   344                         MethodBuilder.parse("public I sub1() {}"),
       
   345                         MethodBuilder.parse("public int length(){return 0;}")
       
   346                                 .setComments(Kind.NO_API_COMMENT),
       
   347                         MethodBuilder.parse("public void m(){}")
       
   348                         .setComments("Method in C. See {@link #length()}.")
       
   349                 ).write(srcDir);
       
   350 
       
   351         new ClassBuilder(tb, "p.C")
       
   352                 .setModifiers("public", "class")
       
   353                 .setExtends("A").addImplements("I")
       
   354                 .addMembers(
       
   355                         MethodBuilder.parse("public I sub() {return null;}"),
       
   356                         MethodBuilder.parse("public I sub1() {return null;}")
       
   357                                 .setComments(Kind.INHERIT_DOC),
       
   358                         MethodBuilder.parse(" public void method() {}")
       
   359                                 .setComments("A method ", "@see #sub", "@see #sub1"),
       
   360                         MethodBuilder.parse("public int length(){return 1;}")
       
   361                                 .setComments(Kind.NO_API_COMMENT)
       
   362                 ).write(srcDir);
       
   363 
       
   364         new ClassBuilder(tb, "p.II")
       
   365                 .setModifiers("public", "interface")
       
   366                 .setExtends("I")
       
   367                 .addMembers(
       
   368                         MethodBuilder.parse("default public I sub() {return null;}")
       
   369                             .setComments(Kind.NO_API_COMMENT)
       
   370                 ).write(srcDir);
       
   371 
       
   372         new ClassBuilder(tb, "p.IImpl")
       
   373                 .setModifiers("public", "class")
       
   374                 .addImplements("II")
       
   375                 .addMembers(
       
   376                     MethodBuilder.parse("public I sub() {return null;}")
       
   377                 ).write(srcDir);
       
   378 
       
   379         new ClassBuilder(tb, "p.QLong<P, Q, R>")
       
   380                 .setModifiers("public interface")
       
   381                 .addMembers(
       
   382                         MethodBuilder.parse("default void forEach(Q action) {}")
       
   383                 ).write(srcDir);
       
   384 
       
   385         new ClassBuilder(tb, "p.ILong")
       
   386                 .addImports("java.util.function.*")
       
   387                 .setModifiers("public", "interface")
       
   388                 .setExtends("QLong<Long, LongConsumer, Object>")
       
   389                 .addMembers(
       
   390                         MethodBuilder.parse("default void forEach(LongConsumer action) {}")
       
   391                             .setComments(Kind.NO_API_COMMENT),
       
   392                         MethodBuilder.parse("default void forEach(Consumer<Long> action) {}")
       
   393                             .setComments("Do you see me {@link #forEach(LongConsumer)} ?")
       
   394                 ).write(srcDir);
       
   395     }
       
   396 
       
   397     @Test
       
   398     void testVisibleMemberTableDetail(Path base) throws Exception {
       
   399         Path srcDir = base.resolve("src");
       
   400         emitVisibleMemberTable(srcDir);
       
   401 
       
   402         Path outDir = base.resolve("out");
       
   403         javadoc("-d", outDir.toString(),
       
   404                 "-html5",
       
   405                 "--override-methods=detail",
       
   406                 "-sourcepath", srcDir.toString(),
       
   407                 "p");
       
   408         checkExit(Exit.OK);
       
   409 
       
   410         checkOrder("p/C.html",
       
   411                 "METHOD DETAIL",
       
   412                 "public", "void", "m()", "Method m in p.B",
       
   413                 "public", "void", "n()", "Method n in p.A",
       
   414                 "public", "void", "o()", "Description copied from class:", ">A<", "Method o in p.A",
       
   415                 "public", "void", "p()", "Method p in p.B",
       
   416                 "END OF CLASS DATA");
       
   417 
       
   418         checkOutput("p/C.html", false,
       
   419                 "Overrides",
       
   420                 "Methods declared in class p");
       
   421 
       
   422         checkOrder("p/D.html",
       
   423                 "METHOD SUMMARY",
       
   424                 "void", "m", "Method m in p.D",
       
   425                 "void", "n", "Method n in p.D",
       
   426                 "void", "o", "Method o in p.D",
       
   427                 "void", "p", "Method p in p.D",
       
   428                 "CONSTRUCTOR DETAIL");
       
   429 
       
   430         checkOutput("p/D.html", false,
       
   431                 "Description copied from class:",
       
   432                 "Overrides",
       
   433                 "Methods declared in class p");
       
   434 
       
   435         checkOrder("p/E.html",
       
   436                 "METHOD SUMMARY",
       
   437                 "void", "m", "Method m in p.B",
       
   438                 "void", "n", "Method n in p.A",
       
   439                 "void", "o", "Method o in p.A",
       
   440                 "void", "p", "Method p in p.B",
       
   441                 "CONSTRUCTOR DETAIL");
       
   442 
       
   443         checkOutput("p/E.html", false,
       
   444                 "Description copied from class:",
       
   445                 "Overrides",
       
   446                 "Methods declared in class p");
       
   447     }
       
   448 
       
   449     @Test
       
   450     void testVisibleMemberTableSummary(Path base) throws Exception {
       
   451         Path srcDir = base.resolve("src");
       
   452         emitVisibleMemberTable(srcDir);
       
   453 
       
   454         Path outDir = base.resolve("out");
       
   455         javadoc("-d", outDir.toString(),
       
   456                 "-html5",
       
   457                 "--override-methods=summary",
       
   458                 "-sourcepath", srcDir.toString(),
       
   459                 "p");
       
   460         checkExit(Exit.OK);
       
   461 
       
   462         checkOrder("p/C.html",
       
   463                 "METHOD SUMMARY",
       
   464                 "void", "m", "Method m in p.B",
       
   465                 "void", "n", "Method n in p.A",
       
   466                 "void", "o", "Method o in p.A",
       
   467                 "void", "p", "Method p in p.B",
       
   468                 "CONSTRUCTOR DETAIL");
       
   469 
       
   470         checkOrder("p/C.html",
       
   471                 "METHOD DETAIL",
       
   472                 "public", "void", "m()", "Method m in p.B",
       
   473                 "public", "void", "n()", "Method n in p.A",
       
   474                 "public", "void", "o()", "Description copied from class:", ">A<", "Method o in p.A",
       
   475                 "public", "void", "p()", "Method p in p.B",
       
   476                 "END OF CLASS DATA");
       
   477 
       
   478         checkOutput("p/C.html", false,
       
   479                 "Overrides",
       
   480                 "Methods declared in class p");
       
   481 
       
   482         checkOrder("p/D.html",
       
   483                 "METHOD SUMMARY",
       
   484                 "void", "m", "Method m in p.D",
       
   485                 "void", "n", "Method n in p.D",
       
   486                 "void", "o", "Method o in p.D",
       
   487                 "void", "p", "Method p in p.D",
       
   488                 "CONSTRUCTOR DETAIL");
       
   489 
       
   490         checkOutput("p/D.html", false,
       
   491                 "Description copied from class:",
       
   492                 "Overrides",
       
   493                 "Methods declared in class p");
       
   494 
       
   495         checkOrder("p/E.html",
       
   496                 "METHOD SUMMARY",
       
   497                 "void", "m", "Method m in p.B",
       
   498                 "void", "n", "Method n in p.A",
       
   499                 "void", "o", "Method o in p.A",
       
   500                 "void", "p", "Method p in p.B",
       
   501                 "CONSTRUCTOR DETAIL");
       
   502 
       
   503         checkOutput("p/E.html", false,
       
   504                 "Description copied from class:",
       
   505                 "Overrides",
       
   506                 "Methods declared in class p");
       
   507 
       
   508     }
       
   509 
       
   510     // emit a matrix of method variants
       
   511     void emitVisibleMemberTable(Path srcDir) throws Exception {
       
   512         new ClassBuilder(tb, "p.A")
       
   513                 .setModifiers("public", "class")
       
   514                 .addMembers(
       
   515                         MethodBuilder.parse("public void m() {}"),
       
   516                         MethodBuilder.parse("public void n() {}"),
       
   517                         MethodBuilder.parse("public void o() {}")
       
   518                 ).write(srcDir);
       
   519 
       
   520         new ClassBuilder(tb, "p.B")
       
   521                 .setModifiers("class")
       
   522                 .setExtends("A")
       
   523                 .addMembers(
       
   524                         MethodBuilder.parse("public void m() {}"),
       
   525                         MethodBuilder.parse("public void n() {}")
       
   526                                 .setComments(Kind.INHERIT_DOC),
       
   527                         MethodBuilder.parse("public void o() {}")
       
   528                         .setComments(Kind.NO_API_COMMENT),
       
   529                         MethodBuilder.parse("public void p() {}")
       
   530                 ).write(srcDir);
       
   531 
       
   532         new ClassBuilder(tb, "p.C")
       
   533                 .setModifiers("public", "class")
       
   534                 .setExtends("B")
       
   535                 .addMembers(
       
   536                         MethodBuilder.parse("public void m() {}")
       
   537                                 .setComments(Kind.NO_API_COMMENT),
       
   538                         MethodBuilder.parse("public void n() {}")
       
   539                                 .setComments(Kind.NO_API_COMMENT),
       
   540                         MethodBuilder.parse("public void o() {}")
       
   541                                 .setComments(Kind.NO_API_COMMENT),
       
   542                         MethodBuilder.parse("public void p() {}")
       
   543                                 .setComments(Kind.NO_API_COMMENT)
       
   544                 ).write(srcDir);
       
   545 
       
   546         new ClassBuilder(tb, "p.D")
       
   547                 .setModifiers("public", "class")
       
   548                 .setExtends("B")
       
   549                 .addMembers(
       
   550                         MethodBuilder.parse("public void m() {}"),
       
   551                         MethodBuilder.parse("public void n() {}"),
       
   552                         MethodBuilder.parse("public void o() {}"),
       
   553                         MethodBuilder.parse("public void p() {}")
       
   554                 ).write(srcDir);
       
   555 
       
   556         new ClassBuilder(tb, "p.E")
       
   557                 .setModifiers("public", "class")
       
   558                 .setExtends("B")
       
   559                 .addMembers(
       
   560                         MethodBuilder.parse("public void m() {}")
       
   561                                 .setComments(Kind.INHERIT_DOC),
       
   562                         MethodBuilder.parse("public void n() {}")
       
   563                                 .setComments(Kind.INHERIT_DOC),
       
   564                         MethodBuilder.parse("public void o() {}")
       
   565                                 .setComments(Kind.INHERIT_DOC),
       
   566                         MethodBuilder.parse("public void p() {}")
       
   567                                 .setComments(Kind.INHERIT_DOC)
       
   568                 ).write(srcDir);
       
   569     }
       
   570 
       
   571     @Test
       
   572     void testHiddenMembersDetail(Path base) throws Exception {
       
   573         Path srcDir = base.resolve("src");
       
   574         emitHiddenMembers(srcDir);
       
   575 
       
   576         Path outDir = base.resolve("out");
       
   577         javadoc("-d", outDir.toString(),
       
   578                 "-html5",
       
   579                 "--override-methods=detail",
       
   580                 "-sourcepath", srcDir.toString(),
       
   581                 "p");
       
   582         checkExit(Exit.OK);
       
   583 
       
   584         checkOrder("p/C1.html",
       
   585                 "FIELD SUMMARY",
       
   586                 "Fields inherited from interface", "I1", "field2",
       
   587                 "Fields inherited from interface", "I2", "field2",
       
   588                 "Fields inherited from interface", "I3", "field",
       
   589                 "METHOD SUMMARY",
       
   590                 "Methods inherited from interface", "I1", "method2",
       
   591                 "Methods inherited from interface", "I2", "method2",
       
   592                 "Methods inherited from interface", "I3", "method",
       
   593                 "CONSTRUCTOR DETAIL");
       
   594 
       
   595         checkOrder("p/C2.html",
       
   596                 "FIELD SUMMARY",
       
   597                 "int", "field", "Field field in p.C2",
       
   598                 "Fields inherited from interface", "I1", "field2",
       
   599                 "Fields inherited from interface", "I2", "field2",
       
   600                 "METHOD SUMMARY",
       
   601                 "void", "method", "Method method in p.C2",
       
   602                 "void", "method2", "Method method2 in p.C2");
       
   603 
       
   604     }
       
   605 
       
   606     @Test
       
   607     void testHiddenMembersSummary(Path base) throws Exception {
       
   608         Path srcDir = base.resolve("src");
       
   609         emitHiddenMembers(srcDir);
       
   610 
       
   611         Path outDir = base.resolve("out");
       
   612         javadoc("-d", outDir.toString(),
       
   613                 "-html5",
       
   614                 "--override-methods=summary",
       
   615                 "-sourcepath", srcDir.toString(),
       
   616                 "p");
       
   617         checkExit(Exit.OK);
       
   618 
       
   619         checkOrder("p/C1.html",
       
   620                 "Field Summary",
       
   621                 "Fields declared in interface", "I1", "field2",
       
   622                 "Fields declared in interface", "I2", "field2",
       
   623                 "Fields declared in interface", "I3", "field",
       
   624                 "Method Summary",
       
   625                 "Methods declared in interface", "I1", "method2",
       
   626                 "Methods declared in interface", "I2", "method2",
       
   627                 "Methods declared in interface", "I3", "method",
       
   628                 "Constructor Detail");
       
   629 
       
   630         checkOrder("p/C2.html",
       
   631                 "Field Summary",
       
   632                 "int", "field", "Field field in p.C2",
       
   633                 "Fields declared in interface", "I1", "field2",
       
   634                 "Fields declared in interface", "I2", "field2",
       
   635                 "Method Summary",
       
   636                 "void", "method", "Method method in p.C2",
       
   637                 "void", "method2", "Method method2 in p.C2");
       
   638 
       
   639     }
       
   640 
       
   641     void emitHiddenMembers(Path srcDir) throws Exception {
       
   642         new ClassBuilder(tb, "p.I1")
       
   643                 .setModifiers("public", "interface")
       
   644                 .addMembers(
       
   645                         FieldBuilder.parse("public static int field = 3;"),
       
   646                         FieldBuilder.parse("public static int field2 = 3;"),
       
   647                         MethodBuilder.parse("public void method();"),
       
   648                         MethodBuilder.parse("public void method2();"),
       
   649                         MethodBuilder.parse("public static void staticMethod() {}")
       
   650                 ).write(srcDir);
       
   651 
       
   652         new ClassBuilder(tb, "p.I2")
       
   653                 .setModifiers("public", "interface")
       
   654                 .addMembers(
       
   655                         FieldBuilder.parse("public static int field = 3;"),
       
   656                         FieldBuilder.parse("public static int field2 = 3;"),
       
   657                         MethodBuilder.parse("public void method();"),
       
   658                         MethodBuilder.parse("public void method2();"),
       
   659                         MethodBuilder.parse("public static void staticMethod() {}")
       
   660                 ).write(srcDir);
       
   661 
       
   662         new ClassBuilder(tb, "p.I3")
       
   663                 .setExtends("I1, I2")
       
   664                 .setModifiers("public", "interface")
       
   665                 .addMembers(
       
   666                         FieldBuilder.parse("public static int field = 3;"),
       
   667                         MethodBuilder.parse("public void method();"),
       
   668                         MethodBuilder.parse("public static void staticMethod() {}")
       
   669                 ).write(srcDir);
       
   670 
       
   671         new ClassBuilder(tb, "p.C1")
       
   672                 .setModifiers("public", "abstract", "class")
       
   673                 .addImplements("I3")
       
   674                 .write(srcDir);
       
   675 
       
   676         new ClassBuilder(tb, "p.C2")
       
   677                 .setExtends("C1")
       
   678                 .setModifiers("public", "abstract", "class")
       
   679                 .addMembers(
       
   680                         FieldBuilder.parse("public int field;"),
       
   681                         MethodBuilder.parse("public void method(){}"),
       
   682                         MethodBuilder.parse("public void method2(){}")
       
   683                 ).write(srcDir);
       
   684     }
       
   685 }