File: TestOverrideMethods.java

package info (click to toggle)
openjdk-23 23.0.2%2B7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 815,324 kB
  • sloc: java: 5,632,909; cpp: 1,303,022; xml: 1,237,193; ansic: 419,177; asm: 404,932; objc: 20,978; sh: 15,486; javascript: 11,040; python: 6,802; makefile: 2,331; perl: 357; awk: 351; sed: 172; pascal: 103; exp: 26; jsp: 24; csh: 3
file content (661 lines) | stat: -rw-r--r-- 32,265 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
/*
 * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

/*
 * @test
 * @bug 8157000 8192850 8182765 8223607 8261976 8281376 8313204
 * @summary  test the behavior of --override-methods option
 * @library  ../../lib
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
 * @build    javadoc.tester.*
 * @run main TestOverrideMethods
 */

import javadoc.tester.JavadocTester;

public class TestOverrideMethods  extends JavadocTester {
    public static void main(String... args) throws Exception {
        var tester = new TestOverrideMethods();
        tester.runTests();
    }

    @Test
    public void testInvalidOption() {
        // Make sure an invalid argument fails
        javadoc("-d", "out-bad-option",
                "-sourcepath", testSrc,
                "-javafx",
                "--disable-javafx-strict-checks",
                "--override-methods=nonsense",
                "pkg5");

        checkExit(Exit.CMDERR);
    }

    @Test
    public void testDetail() {
        // Make sure the option works
        javadoc("-d", "out-detail",
                "-sourcepath", testSrc,
                "-javafx",
                "--disable-javafx-strict-checks",
                "--override-methods=detail",
                "pkg5");

        checkExit(Exit.OK);
    }

    @Test
    public void testSummary() {
        javadoc("-d", "out-summary",
                "-sourcepath", testSrc,
                "--no-platform-links",
                "-javafx",
                "--disable-javafx-strict-checks",
                "--override-methods=summary",
                "pkg5", "pkg6");

        checkExit(Exit.OK);

        checkOrder("pkg5/Classes.C.html",
                // Check nested classes
                "Nested classes/interfaces declared in class pkg5.",
                "Classes.P",
                "Classes.P.PN.html",
                "Classes.P.PN.html",
                """
                    type parameter in Classes.P.PN">K""",
                "type parameter in Classes.P.PN",
                "V",

                // Check properties
                """
                    Properties declared in class&nbsp;pkg5.<a href="Classes.P.html""",
                "Classes.P",
                """
                    Classes.P.html#rateProperty">rate""",

                // Check fields
                """
                    Fields declared in class&nbsp;pkg5.<a href="Classes.P.html""",
                "Classes.P",
                "Classes.P.html#field0\">field0",

                // Check method summary
                "Method Summary",
                "void",
                "#m1()\" class=\"member-name-link\">m1",
                "A modified method",

                "void",
                """
                    #m4(java.lang.String,java.lang.String)" class="member-name-link">m4""",
                "java.lang.String&nbsp;k,",
                "java.lang.String",
                "&nbsp;v)",

                // Check footnotes
                """
                    Methods declared in class&nbsp;pkg5.<a href="Classes.GP.html""",
                "Classes.GP",
                "Classes.GP.html#m0()\">m0",

                // Check method details for override
                """
                    <dl class="notes">
                    <dt>Overrides:""",
                "Classes.GP.html#m7()\">m7",
                "in class",
                "Classes.GP.html",
                "Classes.GP"
        );

        checkOrder("pkg5/Classes.C.html",
                // Check footnotes 2
                "Methods declared in class&nbsp;pkg5.",
                """
                    Classes.P.html#getRate()">getRate""",
                "Classes.P.html#m2()\">m2",
                "Classes.P.html#m3()\">m3",
                "Classes.P.html#m4(K,V)\">m4",
                """
                    Classes.P.html#rateProperty()">rateProperty""",
                """
                    Classes.P.html#setRate(double)">setRate""",

                // Check @link
                """
                    A test of links to the methods in this class. <p>
                    """,
                "Classes.GP.html#m0()",
                "Classes.GP.m0()",
                "#m1()",
                "m1()",
                "Classes.P.html#m2()",
                "Classes.P.m2()",
                "Classes.P.html#m3()",
                "Classes.P.m3()",
                "m4(java.lang.String,java.lang.String)",
                "Classes.P.html#m5()",
                "Classes.P.m5()",
                "#m6()",
                "m6()",
                "#m7()",
                "m7()",
                "End of links",

                // Check @see
                "See Also:",
                "Classes.GP.html#m0()",
                "Classes.GP.m0()",
                "#m1()",
                "m1()",
                "Classes.P.html#m2()",
                "Classes.P.m2()",
                "Classes.P.html#m3()",
                "Classes.P.m3()",
                "#m4(java.lang.String,java.lang.String)",
                "m4(String k, String v)",
                """
                    Classes.P.html#m5()"><code>Classes.P.m5()""",
                "#m6()\"><code>m6()",
                "#m7()\"><code>m7()"
        );

        // Tests for interfaces

        // Make sure the static methods in the super interface
        // do not make it to this interface
        checkOutput("pkg5/Interfaces.D.html", false,
                "msd", "msn");

        checkOrder("pkg5/Interfaces.D.html",
                "Start of links <p>",
                """
                    Interfaces.A.html#m0()"><code>Interfaces.A.m0()""",
                """
                    Interfaces.A.html#m1()"><code>Interfaces.A.m1()""",
                """
                    Interfaces.A.html#m2()"><code>Interfaces.A.m2()""",
                """
                    Interfaces.A.html#m3()"><code>Interfaces.A.m3()""",
                "#m()\"><code>m()",
                "#n()\"><code>n()",
                """
                    Interfaces.C.html#o()"><code>Interfaces.C.o()""",
                "End of links",

                // Check @see links
                "See Also:",
                """
                    Interfaces.A.html#m0()"><code>Interfaces.A.m0()""",
                """
                    Interfaces.A.html#m1()"><code>Interfaces.A.m1()""",
                """
                    Interfaces.A.html#m2()"><code>Interfaces.A.m2()""",
                """
                    Interfaces.A.html#m3()"><code>Interfaces.A.m3()""",
                "#m()\"><code>m()",
                "#n()\"><code>n()",
                """
                    Interfaces.C.html#o()"><code>Interfaces.C.o()""",

                // Check nested classes
                "Nested classes/interfaces declared in interface&nbsp;pkg5.",
                "Interfaces.A",
                "Interfaces.A.AA.html",
                "Interfaces.A.AA",

                // Check properties
                """
                    Properties declared in interface&nbsp;pkg5.<a href="Interfaces.A.html" title="interface in pkg5">Interfaces.A</a>""",

                // Check Fields
                """
                    Fields declared in interface&nbsp;pkg5.<a href="Interfaces.A.html""",
                "Interfaces.A.html#f",
                "Interfaces.A.html#QUOTE\">QUOTE",
                "Interfaces.A.html#rate\">rate",

                // Check Method Summary
                "Method Summary",
                "#m()\" class=\"member-name-link\">m",
                "#n()\" class=\"member-name-link\">n",

                // Check footnotes
                """
                    Methods declared in interface&nbsp;pkg5.<a href="Interfaces.A.html""",
                """
                    Interfaces.A.html#getRate()">getRate""",
                """
                    Interfaces.A.html#rateProperty()">rateProperty""",
                "Interfaces.A.html#setRate(double)",
                """
                    Methods declared in interface&nbsp;pkg5.<a href="Interfaces.B.html""",
                "Interfaces.B.html#m1()\">m1",
                "Interfaces.B.html#m3()\">m3",
                """
                    Methods declared in interface&nbsp;pkg5.<a href="Interfaces.C.html""",
                """
                    <a href="Interfaces.C.html#o()">o</a>"""
        );

        // Test synthetic values and valuesof of an enum.
        checkOrder("index-all.html",
                """
                    <h2 class="title" id="I:M">M</h2>""",
                """
                    <a href="pkg5/Interfaces.C.html#m()" class="member-name-link">m()""",
                """
                    <a href="pkg5/Interfaces.D.html#m()" class="member-name-link">m()</a>""",
                """
                    <a href="pkg5/Classes.GP.html#m0()" class="member-name-link">m0()""",
                """
                    <a href="pkg5/Interfaces.A.html#m0()" class="member-name-link">m0()</a>""",
                """
                    <a href="pkg5/Classes.C.html#m1()" class="member-name-link">m1()</a>""",
                """
                    <a href="pkg5/Classes.P.html#m1()" class="member-name-link">m1()</a>""",
                """
                    <a href="pkg5/Interfaces.A.html#m1()" class="member-name-link">m1()</a>""",
                """
                    <a href="pkg5/Interfaces.B.html#m1()" class="member-name-link">m1()</a>""",
                """
                    <a href="pkg5/Classes.P.html#m2()" class="member-name-link">m2()</a>""",
                """
                    <a href="pkg5/Interfaces.A.html#m2()" class="member-name-link">m2()</a>""",
                """
                    <a href="pkg5/Classes.P.html#m3()" class="member-name-link">m3()</a>""",
                """
                    <a href="pkg5/Interfaces.A.html#m3()" class="member-name-link">m3()</a>""",
                """
                    <a href="pkg5/Interfaces.B.html#m3()" class="member-name-link">m3()</a>""",
                """
                    <a href="pkg5/Classes.C.html#m4(java.lang.String,java.lang.String)" class="membe\
                    r-name-link">m4(String, String)</a>""",
                """
                    <a href="pkg5/Classes.P.html#m4(K,V)" class="member-name-link">m4(K, V)</a>""",
                """
                    <a href="pkg5/Classes.P.html#m5()" class="member-name-link">m5()</a>""",
                """
                    <a href="pkg5/Classes.C.html#m6()" class="member-name-link">m6()</a>""",
                """
                    <a href="pkg5/Classes.P.html#m6()" class="member-name-link">m6()</a>""",
                """
                    <a href="pkg5/Classes.C.html#m7()" class="member-name-link">m7()</a>""",
                """
                    <a href="pkg5/Classes.GP.html#m7()" class="member-name-link">m7()</a>""",
                "Returns the enum constant of this class with the specified name.",
                """
                    Returns an array containing the constants of this enum class, in
                    the order they are declared."""
        );

        // Check methods with covariant return types, changes in modifiers or thrown exceptions.
        // Only those should be shown in summary; m1, m3, m9 should listed as declared in Base
        checkOutput("pkg6/Sub.html", true,
                """
                    <div class="summary-table three-column-summary">
                    <div class="table-header col-first">Modifier and Type</div>
                    <div class="table-header col-second">Method</div>
                    <div class="table-header col-last">Description</div>
                    <div class="col-first even-row-color method-summary-table method-summary-table-t\
                    ab2 method-summary-table-tab4"><code>java.lang.String</code></div>
                    <div class="col-second even-row-color method-summary-table method-summary-table-\
                    tab2 method-summary-table-tab4"><code><a href="#m2()" class="member-name-link">\
                    m2</a>()</code></div>
                    <div class="col-last even-row-color method-summary-table method-summary-table-ta\
                    b2 method-summary-table-tab4">
                    <div class="block">This is Base::m2.</div>
                    </div>
                    <div class="col-first odd-row-color method-summary-table method-summary-table-ta\
                    b2 method-summary-table-tab4"><code>void</code></div>
                    <div class="col-second odd-row-color method-summary-table method-summary-table-t\
                    ab2 method-summary-table-tab4"><code><a href="#m4()" class="member-name-link">m4\
                    </a>()</code></div>
                    <div class="col-last odd-row-color method-summary-table method-summary-table-tab\
                    2 method-summary-table-tab4">
                    <div class="block">This is Base::m4.</div>
                    </div>
                    <div class="col-first even-row-color method-summary-table method-summary-table-t\
                    ab2 method-summary-table-tab4"><code>java.lang.Object</code></div>
                    <div class="col-second even-row-color method-summary-table method-summary-table-\
                    tab2 method-summary-table-tab4"><code><a href="#m5()" class="member-name-link">m\
                    5</a>()</code></div>
                    <div class="col-last even-row-color method-summary-table method-summary-table-ta\
                    b2 method-summary-table-tab4">
                    <div class="block">This is Base::m5.</div>
                    </div>
                    <div class="col-first odd-row-color method-summary-table method-summary-table-ta\
                    b2 method-summary-table-tab4"><code>final java.lang.Object</code></div>
                    <div class="col-second odd-row-color method-summary-table method-summary-table-t\
                    ab2 method-summary-table-tab4"><code><a href="#m6()" class="member-name-link">m6\
                    </a>()</code></div>
                    <div class="col-last odd-row-color method-summary-table method-summary-table-tab\
                    2 method-summary-table-tab4">
                    <div class="block">This is Base::m6.</div>
                    </div>
                    <div class="col-first even-row-color method-summary-table method-summary-table-t\
                    ab2 method-summary-table-tab4"><code>java.lang.Object</code></div>
                    <div class="col-second even-row-color method-summary-table method-summary-table-\
                    tab2 method-summary-table-tab4"><code><a href="#m7()" class="member-name-link">m\
                    7</a>()</code></div>
                    <div class="col-last even-row-color method-summary-table method-summary-table-ta\
                    b2 method-summary-table-tab4">
                    <div class="block">This is Base::m7.</div>
                    </div>
                    <div class="col-first odd-row-color method-summary-table method-summary-table-ta\
                    b2 method-summary-table-tab3"><code>abstract java.lang.Object</code></div>
                    <div class="col-second odd-row-color method-summary-table method-summary-table-t\
                    ab2 method-summary-table-tab3"><code><a href="#m8()" class="member-name-link">m8\
                    </a>()</code></div>
                    <div class="col-last odd-row-color method-summary-table method-summary-table-tab\
                    2 method-summary-table-tab3">
                    <div class="block">This is Base::m8.</div>
                    </div>
                    """,
                """
                    <div class="inherited-list">
                    <h3 id="methods-inherited-from-class-pkg6.Base">Methods declared in class&nbsp;p\
                    kg6.<a href="Base.html" title="class in pkg6">Base</a></h3>
                    <code><a href="Base.html#m1()">m1</a>, <a href="Base.html#m3()">m3</a>, <a href="Base.html#m9()">m9</a></code></div>
                    """);
    }

    @Test
    public void testSummaryAnnotations() {
        javadoc("-d", "out-summary-annotations",
                "-sourcepath", testSrc,
                "--no-platform-links",
                "-javafx",
                "--disable-javafx-strict-checks",
                "--override-methods=summary",
                "-private",
                "pkg7");

        checkExit(Exit.OK);

        checkOutput("pkg7/AnnotatedSub1.html", true,
                """
                    <div class="inherited-list">
                    <h3 id="methods-inherited-from-class-pkg7.AnnotatedBase">Methods declared in int\
                    erface&nbsp;pkg7.<a href="AnnotatedBase.html" title="interface in pkg7">Annotate\
                    dBase</a></h3>
                    <code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">m1</a></code></div>""");

        checkOutput("pkg7/AnnotatedSub2.html", true,
                """
                    <div class="member-signature"><span class="annotations"><a href="A.html" title="\
                    annotation interface in pkg7">@A</a>
                    </span><span class="return-type"><a href="A.html" title="annotation interface in\
                     pkg7">@A</a> java.lang.Iterable&lt;java.lang.String&gt;</span>&nbsp;<span class\
                    ="element-name">m1</span><wbr><span class="parameters">(java.lang.Class&lt;? ext\
                    ends java.lang.CharSequence&gt;&nbsp;p1,
                     int[]&nbsp;p2)</span></div>
                    <div class="block"><span class="description-from-type-label">Description copied from inte\
                    rface:&nbsp;<code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">Ann\
                    otatedBase</a></code></span></div>
                    <div class="block">This is AnnotatedBase::m1.</div>
                    <dl class="notes">
                    <dt>Specified by:</dt>
                    <dd><code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">m1</a></cod\
                    e>&nbsp;in interface&nbsp;<code><a href="AnnotatedBase.html" title="interface in\
                     pkg7">AnnotatedBase</a></code></dd>
                    <dt>Parameters:</dt>
                    <dd><code>p1</code> - first parameter</dd>
                    <dd><code>p2</code> - second parameter</dd>
                    <dt>Returns:</dt>
                    <dd>something</dd>
                    </dl>""");

        checkOutput("pkg7/AnnotatedSub3.html", true,
                """
                    <div class="member-signature"><span class="annotations"><a href="A.html" title="\
                    annotation interface in pkg7">@A</a>
                    </span><span class="return-type"><a href="A.html" title="annotation interface in\
                     pkg7">@A</a> java.lang.Iterable&lt;java.lang.String&gt;</span>&nbsp;<span class\
                    ="element-name">m1</span><wbr><span class="parameters">(java.lang.Class&lt;? ext\
                    ends java.lang.CharSequence&gt;&nbsp;p1,
                     int[]&nbsp;p2)</span></div>
                    <div class="block"><span class="description-from-type-label">Description copied from inte\
                    rface:&nbsp;<code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">Ann\
                    otatedBase</a></code></span></div>
                    <div class="block">This is AnnotatedBase::m1.</div>
                    <dl class="notes">
                    <dt>Specified by:</dt>
                    <dd><code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">m1</a></cod\
                    e>&nbsp;in interface&nbsp;<code><a href="AnnotatedBase.html" title="interface in\
                     pkg7">AnnotatedBase</a></code></dd>
                    <dt>Parameters:</dt>
                    <dd><code>p1</code> - first parameter</dd>
                    <dd><code>p2</code> - second parameter</dd>
                    <dt>Returns:</dt>
                    <dd>something</dd>
                    </dl>""");

        checkOutput("pkg7/AnnotatedSub4.html", true,
                """
                    <div class="member-signature"><span class="return-type">java.lang.Iterable&lt;<a\
                     href="A.html" title="annotation interface in pkg7">@A</a> java.lang.String&gt;<\
                    /span>&nbsp;<span class="element-name">m1</span><wbr><span class="parameters">(j\
                    ava.lang.Class&lt;? extends java.lang.CharSequence&gt;&nbsp;p1,
                     int[]&nbsp;p2)</span></div>
                    <div class="block"><span class="description-from-type-label">Description copied from inte\
                    rface:&nbsp;<code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">Ann\
                    otatedBase</a></code></span></div>
                    <div class="block">This is AnnotatedBase::m1.</div>
                    <dl class="notes">
                    <dt>Specified by:</dt>
                    <dd><code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">m1</a></cod\
                    e>&nbsp;in interface&nbsp;<code><a href="AnnotatedBase.html" title="interface in\
                     pkg7">AnnotatedBase</a></code></dd>
                    <dt>Parameters:</dt>
                    <dd><code>p1</code> - first parameter</dd>
                    <dd><code>p2</code> - second parameter</dd>
                    <dt>Returns:</dt>
                    <dd>something</dd>
                    </dl>""");

        checkOutput("pkg7/AnnotatedSub5.html", true,
                """
                    <div class="member-signature"><span class="return-type">java.lang.Iterable&lt;ja\
                    va.lang.String&gt;</span>&nbsp;<span class="element-name">m1</span><wbr><span cl\
                    ass="parameters">(<a href="A.html" title="annotation interface in pkg7">@A</a>
                     <a href="A.html" title="annotation interface in pkg7">@A</a> java.lang.Class&lt\
                    ;? extends java.lang.CharSequence&gt;&nbsp;p1,
                     int[]&nbsp;p2)</span></div>
                    <div class="block"><span class="description-from-type-label">Description copied from inte\
                    rface:&nbsp;<code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">Ann\
                    otatedBase</a></code></span></div>
                    <div class="block">This is AnnotatedBase::m1.</div>
                    <dl class="notes">
                    <dt>Specified by:</dt>
                    <dd><code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">m1</a></cod\
                    e>&nbsp;in interface&nbsp;<code><a href="AnnotatedBase.html" title="interface in\
                     pkg7">AnnotatedBase</a></code></dd>
                    <dt>Parameters:</dt>
                    <dd><code>p1</code> - first parameter</dd>
                    <dd><code>p2</code> - second parameter</dd>
                    <dt>Returns:</dt>
                    <dd>something</dd>
                    </dl>""");

        checkOutput("pkg7/AnnotatedSub6.html", true,
                """
                    <div class="member-signature"><span class="return-type">java.lang.Iterable&lt;ja\
                    va.lang.String&gt;</span>&nbsp;<span class="element-name">m1</span><wbr><span cl\
                    ass="parameters">(java.lang.Class&lt;<a href="A.html" title="annotation interfac\
                    e in pkg7">@A</a> ? extends java.lang.CharSequence&gt;&nbsp;p1,
                     int[]&nbsp;p2)</span></div>
                    <div class="block"><span class="description-from-type-label">Description copied from inte\
                    rface:&nbsp;<code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">Ann\
                    otatedBase</a></code></span></div>
                    <div class="block">This is AnnotatedBase::m1.</div>
                    <dl class="notes">
                    <dt>Specified by:</dt>
                    <dd><code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">m1</a></cod\
                    e>&nbsp;in interface&nbsp;<code><a href="AnnotatedBase.html" title="interface in\
                     pkg7">AnnotatedBase</a></code></dd>
                    <dt>Parameters:</dt>
                    <dd><code>p1</code> - first parameter</dd>
                    <dd><code>p2</code> - second parameter</dd>
                    <dt>Returns:</dt>
                    <dd>something</dd>
                    </dl>""");

        checkOutput("pkg7/AnnotatedSub7.html", true,
                """
                    <div class="member-signature"><span class="return-type">java.lang.Iterable&lt;ja\
                    va.lang.String&gt;</span>&nbsp;<span class="element-name">m1</span><wbr><span cl\
                    ass="parameters">(java.lang.Class&lt;? extends <a href="A.html" title="annotatio\
                    n interface in pkg7">@A</a> java.lang.CharSequence&gt;&nbsp;p1,
                     int[]&nbsp;p2)</span></div>
                    <div class="block"><span class="description-from-type-label">Description copied from inte\
                    rface:&nbsp;<code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">Ann\
                    otatedBase</a></code></span></div>
                    <div class="block">This is AnnotatedBase::m1.</div>
                    <dl class="notes">
                    <dt>Specified by:</dt>
                    <dd><code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">m1</a></cod\
                    e>&nbsp;in interface&nbsp;<code><a href="AnnotatedBase.html" title="interface in\
                     pkg7">AnnotatedBase</a></code></dd>
                    <dt>Parameters:</dt>
                    <dd><code>p1</code> - first parameter</dd>
                    <dd><code>p2</code> - second parameter</dd>
                    <dt>Returns:</dt>
                    <dd>something</dd>
                    </dl>""");

        checkOutput("pkg7/AnnotatedSub8.html", true,
                """
                    <div class="member-signature"><span class="return-type">java.lang.Iterable&lt;ja\
                    va.lang.String&gt;</span>&nbsp;<span class="element-name">m1</span><wbr><span cl\
                    ass="parameters">(java.lang.Class&lt;? extends java.lang.CharSequence&gt;&nbsp;p1,
                     int <a href="A.html" title="annotation interface in pkg7">@A</a> []&nbsp;p2)</s\
                    pan></div>
                    <div class="block"><span class="description-from-type-label">Description copied from inte\
                    rface:&nbsp;<code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">Ann\
                    otatedBase</a></code></span></div>
                    <div class="block">This is AnnotatedBase::m1.</div>
                    <dl class="notes">
                    <dt>Specified by:</dt>
                    <dd><code><a href="AnnotatedBase.html#m1(java.lang.Class,int%5B%5D)">m1</a></cod\
                    e>&nbsp;in interface&nbsp;<code><a href="AnnotatedBase.html" title="interface in\
                     pkg7">AnnotatedBase</a></code></dd>
                    <dt>Parameters:</dt>
                    <dd><code>p1</code> - first parameter</dd>
                    <dd><code>p2</code> - second parameter</dd>
                    <dt>Returns:</dt>
                    <dd>something</dd>
                    </dl>""");
    }

    @Test
    public void testPolymorphicDetail() {
        javadoc("-d", "out-polymorphic-detail",
                "-sourcepath", testSrc,
                "--override-methods=detail",
                "pkg8");

        checkExit(Exit.OK);

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="P.html#m1()">m1</a></code>&nbsp;in class&nbsp;\
                    <code><a href="P.html" title="class in pkg8">P</a></code></dd>""");

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="P.html#m2()">m2</a></code>&nbsp;in class&nbsp;\
                    <code><a href="P.html" title="class in pkg8">P</a></code></dd>""");

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="P.html#m3()">m3</a></code>&nbsp;in class&nbsp;\
                    <code><a href="P.html" title="class in pkg8">P</a></code></dd>""");
    }

    @Test // results should be the same as that of "detail"
    public void testPolymorphicDefault() {
        javadoc("-d", "out-polymorphic-default",
                "-sourcepath", testSrc,
                "pkg8");

        checkExit(Exit.OK);

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="P.html#m1()">m1</a></code>&nbsp;in class&nbsp;\
                    <code><a href="P.html" title="class in pkg8">P</a></code></dd>""");

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="P.html#m2()">m2</a></code>&nbsp;in class&nbsp;\
                    <code><a href="P.html" title="class in pkg8">P</a></code></dd>""");

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="P.html#m3()">m3</a></code>&nbsp;in class&nbsp;\
                    <code><a href="P.html" title="class in pkg8">P</a></code></dd>""");
    }

    @Test
    public void testPolymorphicSummary() {
        javadoc("-d", "out-polymorphic-summary",
                "-sourcepath", testSrc,
                "--override-methods=summary",
                "pkg8");

        checkExit(Exit.OK);

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="GP.html#m1()">m1</a></code>&nbsp;in class&nbsp;\
                    <code><a href="GP.html" title="class in pkg8">GP</a></code></dd>""");

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="GP.html#m2()">m2</a></code>&nbsp;in class&nbsp;\
                    <code><a href="GP.html" title="class in pkg8">GP</a></code></dd>""");

        checkOutput("pkg8/C.html", true,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="GP.html#m3()">m3</a></code>&nbsp;in class&nbsp;\
                    <code><a href="GP.html" title="class in pkg8">GP</a></code></dd>""");

        checkOutput("pkg8/C.html", false,
                """
                    <dt>Overrides:</dt>
                    <dd><code><a href="GP.html#m1()">m1</a></code>&nbsp;in class&nbsp;\
                    <code><a href="P.html" title="class in pkg8">P</a></code></dd>""");
    }
}