< prev index next >

test/runtime/Nestmates/privateConstructors/TestInvokeSpecial.java

Print this page




   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 8046171
  27  * @summary Test access to private constructors between nestmates and nest-top
  28  *          using different flavours of named nested types that will
  29  *          generate invokespecial for the calls
  30  * @compile -XDdisablePrivateAccessors TestInvokeSpecial.java

  31  * @run main TestInvokeSpecial

  32  */
  33 
  34 public class TestInvokeSpecial {
  35 
  36     // All constructors are private to ensure nestmate access checks apply
  37 
  38     // All doConstruct methods are public so they don't involve invoke_special
  39 
  40     private TestInvokeSpecial() {}
  41 
  42     // The various nestmates
  43 
  44     static interface StaticIface {
  45 
  46         // Methods that will access private constructors of nestmates.
  47         // The arg is a dummy for overloading purposes
  48 
  49         default void doConstruct(TestInvokeSpecial o) {
  50             Object obj = new TestInvokeSpecial();
  51         }




   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 8046171
  27  * @summary Test access to private constructors between nestmates and nest-top
  28  *          using different flavours of named nested types that will
  29  *          generate invokespecial for the calls. The -Xcomp run is a special
  30  *          regression test for a compiler assertion that would fire when
  31  *          "loading" a nest-top class.
  32  * @run main TestInvokeSpecial
  33  * @run main/othervm -Xcomp TestInvokeSpecial
  34  */
  35 
  36 public class TestInvokeSpecial {
  37 
  38     // All constructors are private to ensure nestmate access checks apply
  39 
  40     // All doConstruct methods are public so they don't involve invoke_special
  41 
  42     private TestInvokeSpecial() {}
  43 
  44     // The various nestmates
  45 
  46     static interface StaticIface {
  47 
  48         // Methods that will access private constructors of nestmates.
  49         // The arg is a dummy for overloading purposes
  50 
  51         default void doConstruct(TestInvokeSpecial o) {
  52             Object obj = new TestInvokeSpecial();
  53         }


< prev index next >