< prev index next >

test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java

Print this page




  58                 "pkg", "pkg2");
  59         checkExit(Exit.OK);
  60 
  61         checkOutput("pkg/PublicChild.html", true,
  62                 // Field inheritence from non-public superclass.
  63                 "<a href=\"#fieldInheritedFromParent\">"
  64                 + "fieldInheritedFromParent</a>",
  65                 // Method inheritance from non-public superclass.
  66                 "<a href=\"#methodInheritedFromParent(int)\">"
  67                 + "methodInheritedFromParent</a>",
  68                 // private class does not show up in tree
  69                 "<ul class=\"inheritance\">\n"
  70                 + "<li>java.lang.Object</li>\n"
  71                 + "<li>\n"
  72                 + "<ul class=\"inheritance\">\n"
  73                 + "<li>pkg.PublicChild</li>\n"
  74                 + "</ul>\n"
  75                 + "</li>\n"
  76                 + "</ul>",
  77                 // Method is documented as though it is declared in the inheriting method.
  78                 "<pre class=\"methodSignature\">public&nbsp;void&nbsp;methodInheritedFromParent​(int&nbsp;p1)",
  79                 "<dl>\n"
  80                 + "<dt>All Implemented Interfaces:</dt>\n"
  81                 + "<dd><code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
  82                 + "PublicInterface</a></code></dd>\n"
  83                 + "</dl>");
  84 
  85         checkOutput("pkg/PublicChild.html", false,
  86                 // Should not document that a method overrides method from private class.
  87                 "<span class=\"overrideSpecifyLabel\">Overrides:</span>",
  88                 // Should not document that a method specified by private interface.
  89                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
  90                 // Should not mention that any documentation was copied.
  91                 "Description copied from",
  92                 // Don't extend private classes or interfaces
  93                 "PrivateParent",
  94                 "PrivateInterface");
  95 
  96         checkOutput("pkg/PublicChild.html", false,
  97                 // Should not document comments from private inherited interfaces
  98                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
  99                 + "<a href=\"#methodInterface(int)\">"
 100                 + "methodInterface</a></span>​(int&nbsp;p1)</code>\n"
 101                 + "<div class=\"block\">Comment from interface.</div>\n</td>",
 102                 // and similarly one more
 103                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
 104                 + "<a href=\"#methodInterface2(int)\">"
 105                 + "methodInterface2</a></span>​(int&nbsp;p1)</code>\n"
 106                 + "<div class=\"block\">Comment from interface.</div>\n</td>"
 107         );
 108 
 109         checkOutput("pkg/PublicInterface.html", true,
 110                 // Field inheritance from non-public superinterface.
 111                 "<a href=\"#fieldInheritedFromInterface\">"
 112                 + "fieldInheritedFromInterface</a>",
 113                 // Method inheritance from non-public superinterface.
 114                 "<a href=\"#methodInterface(int)\">"
 115                 + "methodInterface</a>",
 116                 //Make sure implemented interfaces from private superclass are inherited
 117                 "<dl>\n"
 118                 + "<dt>All Known Implementing Classes:</dt>\n"
 119                 + "<dd><code><a href=\"PublicChild.html\" title=\"class in pkg\">"
 120                 + "PublicChild</a></code></dd>\n"
 121                 + "</dl>");
 122 
 123         checkOutput("pkg/PublicInterface.html", false,
 124                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
 125                 "Description copied from",
 126                 "PrivateInterface",
 127                 "All Superinterfaces");
 128 
 129         checkOutput("pkg2/C.html", false,
 130                 //Generic interface method test.
 131                 "This comment should get copied to the implementing class");
 132 
 133         checkOutput("pkg2/C.html", false,
 134                 //Do not inherit private interface method with generic parameters.
 135                 //This method has been implemented.
 136                 "<span class=\"memberNameLink\"><a href=\"I.html#hello(T)\">hello</a></span>");
 137 
 138         checkOutput("constant-values.html", false,
 139                 // Make inherited constant are documented correctly.
 140                 "PrivateInterface");
 141     }
 142 
 143     @Test
 144     public void testPrivate() {
 145         javadoc("-d", "out-private",
 146                 "-sourcepath", testSrc,
 147                 "-private",
 148                 "pkg", "pkg2");
 149         checkExit(Exit.OK);
 150 
 151         checkOutput("pkg/PublicChild.html", true,
 152                 // Field inheritence from non-public superclass.
 153                 "Fields inherited from class&nbsp;pkg."
 154                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 155                 + "PrivateParent</a>",
 156                 "<a href=\"PrivateParent.html#fieldInheritedFromParent\">"
 157                 + "fieldInheritedFromParent</a>",
 158                 // Method inheritence from non-public superclass.
 159                 "Methods inherited from class&nbsp;pkg."
 160                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 161                 + "PrivateParent</a>",
 162                 "<a href=\"PrivateParent.html#methodInheritedFromParent(int)\">"
 163                 + "methodInheritedFromParent</a>",
 164                 // Should document that a method overrides method from private class.
 165                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
 166                 + "<dd><code><a href=\"PrivateParent.html#methodOverridenFromParent(char%5B%5D,int,T,V,java.util.List)\">"
 167                 + "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>"
 168                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 169                 + "PrivateParent</a></code></dd>",
 170                 // Should document that a method is specified by private interface.
 171                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 172                 + "<dd><code><a href=\"PrivateInterface.html#methodInterface(int)\">"
 173                 + "methodInterface</a></code>&nbsp;in interface&nbsp;<code>"
 174                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 175                 + "PrivateInterface</a></code></dd>",
 176                 // Should mention that any documentation was copied.
 177                 "Description copied from",
 178                 // Extend documented private classes or interfaces
 179                 "extends",
 180                 "<dl>\n"
 181                 + "<dt>All Implemented Interfaces:</dt>\n"
 182                 + "<dd><code><a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 183                 + "PrivateInterface</a></code>, "
 184                 + "<code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
 185                 + "PublicInterface</a></code></dd>\n"
 186                 + "</dl>",
 187                 "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>");
 188 
 189         checkOutput("pkg/PublicInterface.html", true,
 190                 // Field inheritence from non-public superinterface.
 191                 "Fields inherited from interface&nbsp;pkg."
 192                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 193                 + "PrivateInterface</a>",
 194                 "<a href=\"PrivateInterface.html#fieldInheritedFromInterface\">"
 195                 + "fieldInheritedFromInterface</a>",
 196                 // Method inheritance from non-public superinterface.
 197                 "Methods inherited from interface&nbsp;pkg."
 198                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 199                 + "PrivateInterface</a>",
 200                 // Extend documented private classes or interfaces
 201                 "extends",
 202                 "All Superinterfaces",
 203                 //Make sure implemented interfaces from private superclass are inherited
 204                 "<dl>\n"
 205                 + "<dt>All Known Implementing Classes:</dt>\n"
 206                 + "<dd><code><a href=\"PrivateParent.html\" title=\"class in pkg\">"
 207                 + "PrivateParent</a></code>, "
 208                 + "<code><a href=\"PublicChild.html\" title=\"class in pkg\">PublicChild"
 209                 + "</a></code></dd>\n"
 210                 + "</dl>");
 211 
 212         checkOutput("pkg/PrivateInterface.html", true,
 213                 "<a href=\"#methodInterface(int)\">"
 214                 + "methodInterface</a>"
 215         );
 216 
 217         checkOutput("pkg2/C.html", true,
 218                 //Since private flag is used, we can document that private interface method
 219                 //with generic parameters has been implemented.
 220                 "<span class=\"descfrmTypeLabel\">Description copied from interface:&nbsp;<code>"
 221                 + "<a href=\"I.html#hello(T)\">I</a></code></span>",
 222                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 223                 + "<dd><code><a href=\"I.html#hello(T)\">hello</a></code>"
 224                 + "&nbsp;in interface&nbsp;<code>"
 225                 + "<a href=\"I.html\" title=\"interface in pkg2\">I</a>"
 226                 + "&lt;java.lang.String&gt;</code></dd>");
 227 
 228         checkOutput("pkg/PrivateParent.html", true,
 229                 //Make sure when no modifier appear in the class signature, the
 230                 //signature is displayed correctly without extra space at the beginning.
 231                 "<pre>class <span class=\"typeNameLabel\">PrivateParent</span>");
 232 
 233         checkOutput("pkg/PrivateParent.html", false,
 234                 "<pre> class <span class=\"typeNameLabel\">PrivateParent</span>");
 235     }
 236 }


  58                 "pkg", "pkg2");
  59         checkExit(Exit.OK);
  60 
  61         checkOutput("pkg/PublicChild.html", true,
  62                 // Field inheritence from non-public superclass.
  63                 "<a href=\"#fieldInheritedFromParent\">"
  64                 + "fieldInheritedFromParent</a>",
  65                 // Method inheritance from non-public superclass.
  66                 "<a href=\"#methodInheritedFromParent(int)\">"
  67                 + "methodInheritedFromParent</a>",
  68                 // private class does not show up in tree
  69                 "<ul class=\"inheritance\">\n"
  70                 + "<li>java.lang.Object</li>\n"
  71                 + "<li>\n"
  72                 + "<ul class=\"inheritance\">\n"
  73                 + "<li>pkg.PublicChild</li>\n"
  74                 + "</ul>\n"
  75                 + "</li>\n"
  76                 + "</ul>",
  77                 // Method is documented as though it is declared in the inheriting method.
  78                 "<pre>public&nbsp;void&nbsp;methodInheritedFromParent​(int&nbsp;p1)",
  79                 "<dl>\n"
  80                 + "<dt>All Implemented Interfaces:</dt>\n"
  81                 + "<dd><code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
  82                 + "PublicInterface</a></code></dd>\n"
  83                 + "</dl>");
  84 
  85         checkOutput("pkg/PublicChild.html", false,
  86                 // Should not document that a method overrides method from private class.
  87                 "<span class=\"overrideSpecifyLabel\">Overrides:</span>",
  88                 // Should not document that a method specified by private interface.
  89                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
  90                 // Should not mention that any documentation was copied.
  91                 "Description copied from",
  92                 // Don't extend private classes or interfaces
  93                 "PrivateParent",
  94                 "PrivateInterface");
  95 
  96         checkOutput("pkg/PublicChild.html", false,
  97                 // Should not document comments from private inherited interfaces
  98                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
  99                 + "<a href=\"#methodInterface(int)\">"
 100                 + "methodInterface</a></span>​(int&nbsp;p1)</code>\n"
 101                 + "<div class=\"block\">Comment from interface.</div>\n</td>",
 102                 // and similarly one more
 103                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
 104                 + "<a href=\"#methodInterface2(int)\">"
 105                 + "methodInterface2</a></span>​(int&nbsp;p1)</code>\n"
 106                 + "<div class=\"block\">Comment from interface.</div>\n</td>"
 107         );
 108 
 109         checkOutput("pkg/PublicInterface.html", true,
 110                 // Field inheritance from non-public superinterface.
 111                 "<a href=\"#fieldInheritedFromInterface\">"
 112                 + "fieldInheritedFromInterface</a>",
 113                 // Method inheritance from non-public superinterface.
 114                 "<a href=\"#methodInterface(int)\">"
 115                 + "methodInterface</a>",
 116                 //Make sure implemented interfaces from private superclass are inherited
 117                 "<dl>\n"
 118                 + "<dt>All Known Implementing Classes:</dt>\n"
 119                 + "<dd><code><a href=\"PublicChild.html\" title=\"class in pkg\">"
 120                 + "PublicChild</a></code></dd>\n"
 121                 + "</dl>");
 122 
 123         checkOutput("pkg/PublicInterface.html", false,
 124                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
 125                 "Description copied from",
 126                 "PrivateInterface",
 127                 "All Superinterfaces");
 128 
 129         checkOutput("pkg2/C.html", false,
 130                 //Generic interface method test.
 131                 "This comment should get copied to the implementing class");
 132 
 133         checkOutput("pkg2/C.html", false,
 134                 //Do not inherit private interface method with generic parameters.
 135                 //This method has been implemented.
 136                 "<span class=\"memberNameLink\"><a href=\"I.html#hello(T)\">hello</a></span>");
 137 
 138         checkOutput("constant-values.html", false,
 139                 // Make inherited constant are documented correctly.
 140                 "PrivateInterface");
 141     }
 142 
 143     @Test
 144     public void testPrivate() {
 145         javadoc("-d", "out-private",
 146                 "-sourcepath", testSrc,
 147                 "-private",
 148                 "pkg", "pkg2");
 149         checkExit(Exit.OK);
 150 
 151         checkOutput("pkg/PublicChild.html", true,
 152                 // Field inheritence from non-public superclass.
 153                 "Fields inherited from class&nbsp;pkg."
 154                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 155                 + "PrivateParent</a>",
 156                 "<a href=\"PrivateParent.html#fieldInheritedFromParent\">"
 157                 + "fieldInheritedFromParent</a>",
 158                 // Method inheritence from non-public superclass.
 159                 "Methods inherited from class&nbsp;pkg."
 160                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 161                 + "PrivateParent</a>",
 162                 "<a href=\"PrivateParent.html#methodInheritedFromParent(int)\">"
 163                 + "methodInheritedFromParent</a>",
 164                 // Should document that a method overrides method from private class.
 165                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
 166                 + "<dd><code><a href=\"PrivateParent.html#methodOverridenFromParent(char%5B%5D,int,T,V,java.util.List)\">"
 167                 + "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>"
 168                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 169                 + "PrivateParent</a></code></dd>",
 170                 // Should document that a method is specified by private interface.
 171                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 172                 + "<dd><code><a href=\"PrivateInterface.html#methodInterface(int)\">"
 173                 + "methodInterface</a></code>&nbsp;in interface&nbsp;<code>"
 174                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 175                 + "PrivateInterface</a></code></dd>",
 176                 // Should mention that any documentation was copied.
 177                 "Description copied from",
 178                 // Extend documented private classes or interfaces
 179                 "extends",
 180                 "<dl>\n"
 181                 + "<dt>All Implemented Interfaces:</dt>\n"
 182                 + "<dd><code><a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 183                 + "PrivateInterface</a></code>, "
 184                 + "<code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
 185                 + "PublicInterface</a></code></dd>\n"
 186                 + "</dl>",
 187                 "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>");
 188 
 189         checkOutput("pkg/PublicInterface.html", true,
 190                 // Field inheritence from non-public superinterface.
 191                 "Fields inherited from interface&nbsp;pkg."
 192                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 193                 + "PrivateInterface</a>",
 194                 "<a href=\"PrivateInterface.html#fieldInheritedFromInterface\">"
 195                 + "fieldInheritedFromInterface</a>",
 196                 // Method inheritance from non-public superinterface.
 197                 "Methods inherited from interface&nbsp;pkg."
 198                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 199                 + "PrivateInterface</a>",
 200                 // Extend documented private classes or interfaces
 201                 "extends",
 202                 "All Superinterfaces",
 203                 //Make sure implemented interfaces from private superclass are inherited
 204                 "<dl>\n"
 205                 + "<dt>All Known Implementing Classes:</dt>\n"
 206                 + "<dd><code><a href=\"PrivateParent.html\" title=\"class in pkg\">"
 207                 + "PrivateParent</a></code>, "
 208                 + "<code><a href=\"PublicChild.html\" title=\"class in pkg\">PublicChild"
 209                 + "</a></code></dd>\n"
 210                 + "</dl>");
 211 
 212         checkOutput("pkg/PrivateInterface.html", true,
 213                 "<a href=\"#methodInterface(int)\">"
 214                 + "methodInterface</a>"
 215         );
 216 
 217         checkOutput("pkg2/C.html", true,
 218                 //Since private flag is used, we can document that private interface method
 219                 //with generic parameters has been implemented.
 220                 "<span class=\"descfrmTypeLabel\">Description copied from interface:&nbsp;<code>"
 221                 + "<a href=\"I.html#hello(T)\">I</a></code></span>",
 222                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 223                 + "<dd><code><a href=\"I.html#hello(T)\">hello</a></code>"
 224                 + "&nbsp;in interface&nbsp;<code>"
 225                 + "<a href=\"I.html\" title=\"interface in pkg2\">I</a>"
 226                 + "&lt;java.lang.String&gt;</code></dd>");
 227 
 228         checkOutput("pkg/PrivateParent.html", true,
 229                 //Make sure when no modifier appear in the class signature, the
 230                 //signature is displayed correctly without extra space at the beginning.
 231                 "<pre>class <span class=\"typeNameLabel\">PrivateParent</span>");
 232 
 233         checkOutput("pkg/PrivateParent.html", false,
 234                 "<pre> class <span class=\"typeNameLabel\">PrivateParent</span>");
 235     }
 236 }
< prev index next >