test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenPrivateMethodsWithPackageFlag.java
changeset 53562 0d9dee001667
parent 53097 2e82ca64b25d
equal deleted inserted replaced
53561:3f4b89a17892 53562:0d9dee001667
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2019, 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.
    86         // different packages.
    86         // different packages.
    87         checkOutput("pkg2/SubClass.html", false,
    87         checkOutput("pkg2/SubClass.html", false,
    88                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
    88                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
    89                 + "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">");
    89                 + "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">");
    90     }
    90     }
    91 
       
    92     @Test
       
    93     public void test_html4() {
       
    94         javadoc("-d", "out-html4",
       
    95                 "-html4",
       
    96                 "-sourcepath", testSrc,
       
    97                 "-package",
       
    98                 "pkg1", "pkg2");
       
    99         checkExit(Exit.OK);
       
   100 
       
   101         // The public method should be overridden
       
   102         checkOutput("pkg1/SubClass.html", true,
       
   103                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
       
   104                 + "<dd><code><a href=\"BaseClass.html#publicMethod--\">"
       
   105                 + "publicMethod</a></code>&nbsp;in class&nbsp;<code>"
       
   106                 + "<a href=\"BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
       
   107 
       
   108         // The public method in different package should be overridden
       
   109         checkOutput("pkg2/SubClass.html", true,
       
   110                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
       
   111                 + "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">"
       
   112                 + "publicMethod</a></code>&nbsp;in class&nbsp;<code>"
       
   113                 + "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
       
   114 
       
   115         // The package private method should be overridden since the base and sub class are in the same
       
   116         // package.
       
   117         checkOutput("pkg1/SubClass.html", true,
       
   118                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
       
   119                 + "<dd><code><a href=\"BaseClass.html#packagePrivateMethod--\">"
       
   120                 + "packagePrivateMethod</a></code>&nbsp;in class&nbsp;<code>"
       
   121                 + "<a href=\"BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
       
   122 
       
   123         // The private method in should not be overridden
       
   124         checkOutput("pkg1/SubClass.html", false,
       
   125                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
       
   126                 + "<dd><code><a href=\"BaseClass.html#privateMethod()\">");
       
   127 
       
   128         // The private method in different package should not be overridden
       
   129         checkOutput("pkg2/SubClass.html", false,
       
   130                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
       
   131                 + "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">");
       
   132 
       
   133         // The package private method should not be overridden since the base and sub class are in
       
   134         // different packages.
       
   135         checkOutput("pkg2/SubClass.html", false,
       
   136                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
       
   137                 + "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">");
       
   138     }
       
   139 }
    91 }