test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java
changeset 48654 36f58bd6269f
parent 47216 71c04702a3d5
child 49139 771616d26ca1
equal deleted inserted replaced
48653:89111a0e6355 48654:36f58bd6269f
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    57                 "pkg", "pkg2");
    57                 "pkg", "pkg2");
    58         checkExit(Exit.OK);
    58         checkExit(Exit.OK);
    59 
    59 
    60         checkOutput("pkg/PublicChild.html", true,
    60         checkOutput("pkg/PublicChild.html", true,
    61                 // Field inheritence from non-public superclass.
    61                 // Field inheritence from non-public superclass.
    62                 "<a href=\"../pkg/PublicChild.html#fieldInheritedFromParent\">"
    62                 "<a href=\"#fieldInheritedFromParent\">"
    63                 + "fieldInheritedFromParent</a>",
    63                 + "fieldInheritedFromParent</a>",
    64                 // Method inheritance from non-public superclass.
    64                 // Method inheritance from non-public superclass.
    65                 "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent-int-\">"
    65                 "<a href=\"#methodInheritedFromParent-int-\">"
    66                 + "methodInheritedFromParent</a>",
    66                 + "methodInheritedFromParent</a>",
    67                 // private class does not show up in tree
    67                 // private class does not show up in tree
    68                 "<ul class=\"inheritance\">\n"
    68                 "<ul class=\"inheritance\">\n"
    69                 + "<li>java.lang.Object</li>\n"
    69                 + "<li>java.lang.Object</li>\n"
    70                 + "<li>\n"
    70                 + "<li>\n"
    75                 + "</ul>",
    75                 + "</ul>",
    76                 // Method is documented as though it is declared in the inheriting method.
    76                 // Method is documented as though it is declared in the inheriting method.
    77                 "<pre>public&nbsp;void&nbsp;methodInheritedFromParent&#8203;(int&nbsp;p1)",
    77                 "<pre>public&nbsp;void&nbsp;methodInheritedFromParent&#8203;(int&nbsp;p1)",
    78                 "<dl>\n"
    78                 "<dl>\n"
    79                 + "<dt>All Implemented Interfaces:</dt>\n"
    79                 + "<dt>All Implemented Interfaces:</dt>\n"
    80                 + "<dd><code><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">"
    80                 + "<dd><code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
    81                 + "PublicInterface</a></code></dd>\n"
    81                 + "PublicInterface</a></code></dd>\n"
    82                 + "</dl>");
    82                 + "</dl>");
    83 
    83 
    84         checkOutput("pkg/PublicChild.html", false,
    84         checkOutput("pkg/PublicChild.html", false,
    85                 // Should not document that a method overrides method from private class.
    85                 // Should not document that a method overrides method from private class.
    93                 "PrivateInterface");
    93                 "PrivateInterface");
    94 
    94 
    95         checkOutput("pkg/PublicChild.html", false,
    95         checkOutput("pkg/PublicChild.html", false,
    96                 // Should not document comments from private inherited interfaces
    96                 // Should not document comments from private inherited interfaces
    97                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">" +
    97                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">" +
    98                 "<a href=\"../pkg/PublicChild.html#methodInterface-int-\">" +
    98                 "<a href=\"#methodInterface-int-\">" +
    99                 "methodInterface</a></span>&#8203;(int&nbsp;p1)</code>\n" +
    99                 "methodInterface</a></span>&#8203;(int&nbsp;p1)</code>\n" +
   100                 "<div class=\"block\">Comment from interface.</div>\n</td>",
   100                 "<div class=\"block\">Comment from interface.</div>\n</td>",
   101                 // and similarly one more
   101                 // and similarly one more
   102                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">" +
   102                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">" +
   103                 "<a href=\"../pkg/PublicChild.html#methodInterface2-int-\">" +
   103                 "<a href=\"#methodInterface2-int-\">" +
   104                 "methodInterface2</a></span>&#8203;(int&nbsp;p1)</code>\n" +
   104                 "methodInterface2</a></span>&#8203;(int&nbsp;p1)</code>\n" +
   105                 "<div class=\"block\">Comment from interface.</div>\n</td>"
   105                 "<div class=\"block\">Comment from interface.</div>\n</td>"
   106         );
   106         );
   107 
   107 
   108         checkOutput("pkg/PublicInterface.html", true,
   108         checkOutput("pkg/PublicInterface.html", true,
   109                 // Field inheritance from non-public superinterface.
   109                 // Field inheritance from non-public superinterface.
   110                 "<a href=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">"
   110                 "<a href=\"#fieldInheritedFromInterface\">"
   111                 + "fieldInheritedFromInterface</a>",
   111                 + "fieldInheritedFromInterface</a>",
   112                 // Method inheritance from non-public superinterface.
   112                 // Method inheritance from non-public superinterface.
   113                 "<a href=\"../pkg/PublicInterface.html#methodInterface-int-\">"
   113                 "<a href=\"#methodInterface-int-\">"
   114                 + "methodInterface</a>",
   114                 + "methodInterface</a>",
   115                 //Make sure implemented interfaces from private superclass are inherited
   115                 //Make sure implemented interfaces from private superclass are inherited
   116                 "<dl>\n"
   116                 "<dl>\n"
   117                 + "<dt>All Known Implementing Classes:</dt>\n"
   117                 + "<dt>All Known Implementing Classes:</dt>\n"
   118                 + "<dd><code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
   118                 + "<dd><code><a href=\"PublicChild.html\" title=\"class in pkg\">"
   119                 + "PublicChild</a></code></dd>\n"
   119                 + "PublicChild</a></code></dd>\n"
   120                 + "</dl>");
   120                 + "</dl>");
   121 
   121 
   122         checkOutput("pkg/PublicInterface.html", false,
   122         checkOutput("pkg/PublicInterface.html", false,
   123                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
   123                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
   130                 "This comment should get copied to the implementing class");
   130                 "This comment should get copied to the implementing class");
   131 
   131 
   132         checkOutput("pkg2/C.html", false,
   132         checkOutput("pkg2/C.html", false,
   133                 //Do not inherit private interface method with generic parameters.
   133                 //Do not inherit private interface method with generic parameters.
   134                 //This method has been implemented.
   134                 //This method has been implemented.
   135                 "<span class=\"memberNameLink\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>");
   135                 "<span class=\"memberNameLink\"><a href=\"I.html#hello-T-\">hello</a></span>");
   136 
   136 
   137         checkOutput("constant-values.html", false,
   137         checkOutput("constant-values.html", false,
   138                 // Make inherited constant are documented correctly.
   138                 // Make inherited constant are documented correctly.
   139                 "PrivateInterface");
   139                 "PrivateInterface");
   140     }
   140     }
   148         checkExit(Exit.OK);
   148         checkExit(Exit.OK);
   149 
   149 
   150         checkOutput("pkg/PublicChild.html", true,
   150         checkOutput("pkg/PublicChild.html", true,
   151                 // Field inheritence from non-public superclass.
   151                 // Field inheritence from non-public superclass.
   152                 "Fields inherited from class&nbsp;pkg."
   152                 "Fields inherited from class&nbsp;pkg."
   153                 + "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
   153                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
   154                 + "PrivateParent</a>",
   154                 + "PrivateParent</a>",
   155                 "<a href=\"../pkg/PrivateParent.html#fieldInheritedFromParent\">"
   155                 "<a href=\"PrivateParent.html#fieldInheritedFromParent\">"
   156                 + "fieldInheritedFromParent</a>",
   156                 + "fieldInheritedFromParent</a>",
   157                 // Method inheritence from non-public superclass.
   157                 // Method inheritence from non-public superclass.
   158                 "Methods inherited from class&nbsp;pkg."
   158                 "Methods inherited from class&nbsp;pkg."
   159                 + "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
   159                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
   160                 + "PrivateParent</a>",
   160                 + "PrivateParent</a>",
   161                 "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent-int-\">"
   161                 "<a href=\"PrivateParent.html#methodInheritedFromParent-int-\">"
   162                 + "methodInheritedFromParent</a>",
   162                 + "methodInheritedFromParent</a>",
   163                 // Should document that a method overrides method from private class.
   163                 // Should document that a method overrides method from private class.
   164                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
   164                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
   165                 + "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">"
   165                 + "<dd><code><a href=\"PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">"
   166                 + "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>"
   166                 + "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>"
   167                 + "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
   167                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
   168                 + "PrivateParent</a></code></dd>",
   168                 + "PrivateParent</a></code></dd>",
   169                 // Should document that a method is specified by private interface.
   169                 // Should document that a method is specified by private interface.
   170                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
   170                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
   171                 + "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">"
   171                 + "<dd><code><a href=\"PrivateInterface.html#methodInterface-int-\">"
   172                 + "methodInterface</a></code>&nbsp;in interface&nbsp;<code>"
   172                 + "methodInterface</a></code>&nbsp;in interface&nbsp;<code>"
   173                 + "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
   173                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
   174                 + "PrivateInterface</a></code></dd>",
   174                 + "PrivateInterface</a></code></dd>",
   175                 // Should mention that any documentation was copied.
   175                 // Should mention that any documentation was copied.
   176                 "Description copied from",
   176                 "Description copied from",
   177                 // Extend documented private classes or interfaces
   177                 // Extend documented private classes or interfaces
   178                 "extends",
   178                 "extends",
   179                 "<dl>\n"
   179                 "<dl>\n"
   180                 + "<dt>All Implemented Interfaces:</dt>\n"
   180                 + "<dt>All Implemented Interfaces:</dt>\n"
   181                 + "<dd><code><a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
   181                 + "<dd><code><a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
   182                 + "PrivateInterface</a></code>, "
   182                 + "PrivateInterface</a></code>, "
   183                 + "<code><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">"
   183                 + "<code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
   184                 + "PublicInterface</a></code></dd>\n"
   184                 + "PublicInterface</a></code></dd>\n"
   185                 + "</dl>",
   185                 + "</dl>",
   186                 "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>");
   186                 "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>");
   187 
   187 
   188         checkOutput("pkg/PublicInterface.html", true,
   188         checkOutput("pkg/PublicInterface.html", true,
   189                 // Field inheritence from non-public superinterface.
   189                 // Field inheritence from non-public superinterface.
   190                 "Fields inherited from interface&nbsp;pkg."
   190                 "Fields inherited from interface&nbsp;pkg."
   191                 + "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
   191                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
   192                 + "PrivateInterface</a>",
   192                 + "PrivateInterface</a>",
   193                 "<a href=\"../pkg/PrivateInterface.html#fieldInheritedFromInterface\">"
   193                 "<a href=\"PrivateInterface.html#fieldInheritedFromInterface\">"
   194                 + "fieldInheritedFromInterface</a>",
   194                 + "fieldInheritedFromInterface</a>",
   195                 // Method inheritance from non-public superinterface.
   195                 // Method inheritance from non-public superinterface.
   196                 "Methods inherited from interface&nbsp;pkg."
   196                 "Methods inherited from interface&nbsp;pkg."
   197                 + "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
   197                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
   198                 + "PrivateInterface</a>",
   198                 + "PrivateInterface</a>",
   199                 // Extend documented private classes or interfaces
   199                 // Extend documented private classes or interfaces
   200                 "extends",
   200                 "extends",
   201                 "All Superinterfaces",
   201                 "All Superinterfaces",
   202                 //Make sure implemented interfaces from private superclass are inherited
   202                 //Make sure implemented interfaces from private superclass are inherited
   203                 "<dl>\n"
   203                 "<dl>\n"
   204                 + "<dt>All Known Implementing Classes:</dt>\n"
   204                 + "<dt>All Known Implementing Classes:</dt>\n"
   205                 + "<dd><code><a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
   205                 + "<dd><code><a href=\"PrivateParent.html\" title=\"class in pkg\">"
   206                 + "PrivateParent</a></code>, "
   206                 + "PrivateParent</a></code>, "
   207                 + "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild"
   207                 + "<code><a href=\"PublicChild.html\" title=\"class in pkg\">PublicChild"
   208                 + "</a></code></dd>\n"
   208                 + "</a></code></dd>\n"
   209                 + "</dl>");
   209                 + "</dl>");
   210 
   210 
   211         checkOutput("pkg/PrivateInterface.html", true,
   211         checkOutput("pkg/PrivateInterface.html", true,
   212                 "<a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">"
   212                 "<a href=\"#methodInterface-int-\">"
   213                 + "methodInterface</a>"
   213                 + "methodInterface</a>"
   214         );
   214         );
   215 
   215 
   216         checkOutput("pkg2/C.html", true,
   216         checkOutput("pkg2/C.html", true,
   217                 //Since private flag is used, we can document that private interface method
   217                 //Since private flag is used, we can document that private interface method
   218                 //with generic parameters has been implemented.
   218                 //with generic parameters has been implemented.
   219                 "<span class=\"descfrmTypeLabel\">Description copied from interface:&nbsp;<code>"
   219                 "<span class=\"descfrmTypeLabel\">Description copied from interface:&nbsp;<code>"
   220                 + "<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>",
   220                 + "<a href=\"I.html#hello-T-\">I</a></code></span>",
   221                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
   221                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
   222                 + "<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>"
   222                 + "<dd><code><a href=\"I.html#hello-T-\">hello</a></code>"
   223                 + "&nbsp;in interface&nbsp;<code>"
   223                 + "&nbsp;in interface&nbsp;<code>"
   224                 + "<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>"
   224                 + "<a href=\"I.html\" title=\"interface in pkg2\">I</a>"
   225                 + "&lt;java.lang.String&gt;</code></dd>");
   225                 + "&lt;java.lang.String&gt;</code></dd>");
   226 
   226 
   227         checkOutput("pkg/PrivateParent.html", true,
   227         checkOutput("pkg/PrivateParent.html", true,
   228                 //Make sure when no modifier appear in the class signature, the
   228                 //Make sure when no modifier appear in the class signature, the
   229                 //signature is displayed correctly without extra space at the beginning.
   229                 //signature is displayed correctly without extra space at the beginning.