< prev index next >

test/hotspot/jtreg/runtime/SelectionResolution/classes/selectionresolution/Template.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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.

@@ -4392,33 +4392,42 @@
                          builder.hier.addInherit(C2, I);
                          builder.expected = C3;
                          builder.objectref = C1;
                      });
 
+    // NOTE: The selection changes in JVMS 11 mean that private class methods
+    // are never selected to satisfy an interface method invocation, and so no
+    // IllegalAccessError is subsequently thrown. Because of this all the
+    // "private" cases below are commented out. At some point in the future
+    // these should be factored out and moved to a test that expects success
+    // but it is not that simple as the commented out cases result in 2600
+    // testcases being excluded, but only ~150 failing cases were seen. Though
+    // it is not clear from the test if a single failure can result in further
+    // testcases being skipped.
     public static final Template IfaceMethodrefSelectionOverrideNonPublic =
         new Template("IfaceMethodrefSelection",
                      /* Case 1: Objectref overrides.
                       *
                       * I[](*) = mref
                       * C[I](priv) = oref = expected
                       */
-                     (final SelectionResolutionTestCase.Builder builder) -> {
-                         final ClassData.Package pck =
-                             builder.classdata.get(builder.methodref).packageId;
-                         final ClassData oldexpected =
-                             builder.classdata.get(builder.expected);
-                         final MethodData meth =
-                             new MethodData(MethodData.Access.PRIVATE,
-                                            MethodData.Context.INSTANCE);
-                         final ClassData withDef =
-                             new ClassData(pck, meth);
-                         final int I = builder.methodref;
-                         final int C = builder.addClass(withDef);
-                         builder.hier.addInherit(C, I);
-                         builder.objectref = C;
-                         builder.expected = C;
-                     },
+                     // (final SelectionResolutionTestCase.Builder builder) -> {
+                     //     final ClassData.Package pck =
+                     //         builder.classdata.get(builder.methodref).packageId;
+                     //     final ClassData oldexpected =
+                     //         builder.classdata.get(builder.expected);
+                     //     final MethodData meth =
+                     //         new MethodData(MethodData.Access.PRIVATE,
+                     //                        MethodData.Context.INSTANCE);
+                     //     final ClassData withDef =
+                     //         new ClassData(pck, meth);
+                     //     final int I = builder.methodref;
+                     //     final int C = builder.addClass(withDef);
+                     //     builder.hier.addInherit(C, I);
+                     //     builder.objectref = C;
+                     //     builder.expected = C;
+                     // },
                      /* Case 2: Objectref overrides.
                       *
                       * I[](*) = mref
                       * C[I](prot) = oref = expected
                       */

@@ -4464,31 +4473,31 @@
                       *
                       * I2[](*) = mref
                       * C2[I2](priv) = expected, I1[I2]()
                       * C1[I1,C2]() = oref
                       */
-                     (final SelectionResolutionTestCase.Builder builder) -> {
-                         final ClassData.Package pck =
-                             builder.classdata.get(builder.expected).packageId;
-                         final ClassData oldexpected =
-                             builder.classdata.get(builder.expected);
-                         final MethodData meth =
-                             new MethodData(MethodData.Access.PRIVATE,
-                                            MethodData.Context.INSTANCE);
-                         final ClassData withDef =
-                             new ClassData(pck, meth);
-                         final int I2 = builder.methodref;
-                         final int I1 = builder.addInterface(emptyClass(pck));
-                         final int C2 = builder.addClass(withDef);
-                         final int C1 = builder.addClass(emptyClass(pck));
-                         builder.hier.addInherit(C1, I1);
-                         builder.hier.addInherit(C1, C2);
-                         builder.hier.addInherit(I1, I2);
-                         builder.hier.addInherit(C2, I2);
-                         builder.objectref = C1;
-                         builder.expected = C2;
-                     },
+                     // (final SelectionResolutionTestCase.Builder builder) -> {
+                     //     final ClassData.Package pck =
+                     //         builder.classdata.get(builder.expected).packageId;
+                     //     final ClassData oldexpected =
+                     //         builder.classdata.get(builder.expected);
+                     //     final MethodData meth =
+                     //         new MethodData(MethodData.Access.PRIVATE,
+                     //                        MethodData.Context.INSTANCE);
+                     //     final ClassData withDef =
+                     //         new ClassData(pck, meth);
+                     //     final int I2 = builder.methodref;
+                     //     final int I1 = builder.addInterface(emptyClass(pck));
+                     //     final int C2 = builder.addClass(withDef);
+                     //     final int C1 = builder.addClass(emptyClass(pck));
+                     //     builder.hier.addInherit(C1, I1);
+                     //     builder.hier.addInherit(C1, C2);
+                     //     builder.hier.addInherit(I1, I2);
+                     //     builder.hier.addInherit(C2, I2);
+                     //     builder.objectref = C1;
+                     //     builder.expected = C2;
+                     // },
                      /* Case 5: Diamond, with superclass, expected at top,
                       * class overriding with package private.
                       *
                       * I2[](*) = mref
                       * C2[I2](pack) = expected, I1[I2]()

@@ -4547,28 +4556,28 @@
                       * at top, class overrides
                       *
                       * C2[](priv) = expected, I1[](*) = mref
                       * C1[I1,C2]() = oref
                       */
-                     (final SelectionResolutionTestCase.Builder builder) -> {
-                         final ClassData.Package pck =
-                             builder.classdata.get(builder.expected).packageId;
-                        final ClassData oldexpected =
-                            builder.classdata.get(builder.expected);
-                         final MethodData meth =
-                             new MethodData(MethodData.Access.PRIVATE,
-                                            MethodData.Context.INSTANCE);
-                        final ClassData withDef =
-                            new ClassData(pck, meth);
-                         final int I1 = builder.methodref;
-                         final int C2 = builder.addClass(withDef);
-                         final int C1 = builder.addClass(emptyClass(pck));
-                         builder.hier.addInherit(C1, I1);
-                         builder.hier.addInherit(C1, C2);
-                         builder.objectref = C1;
-                         builder.expected = C2;
-                     },
+                     // (final SelectionResolutionTestCase.Builder builder) -> {
+                     //     final ClassData.Package pck =
+                     //         builder.classdata.get(builder.expected).packageId;
+                     //    final ClassData oldexpected =
+                     //        builder.classdata.get(builder.expected);
+                     //     final MethodData meth =
+                     //         new MethodData(MethodData.Access.PRIVATE,
+                     //                        MethodData.Context.INSTANCE);
+                     //    final ClassData withDef =
+                     //        new ClassData(pck, meth);
+                     //     final int I1 = builder.methodref;
+                     //     final int C2 = builder.addClass(withDef);
+                     //     final int C1 = builder.addClass(emptyClass(pck));
+                     //     builder.hier.addInherit(C1, I1);
+                     //     builder.hier.addInherit(C1, C2);
+                     //     builder.objectref = C1;
+                     //     builder.expected = C2;
+                     // },
                      /* Case 8: Y, with superclass, overlaping, expected
                       * at top, class overrides
                       *
                       * C2[](prot) = expected, I1[](*) = mref
                       * C1[I1,C2]() = oref

@@ -4620,30 +4629,30 @@
                       *
                       * I2[](def) = old expected
                       * C2[I2](priv) = expected, I1[](*) = mref
                       * C1[I1,C2]() = oref
                       */
-                     (final SelectionResolutionTestCase.Builder builder) -> {
-                         final ClassData.Package pck =
-                             builder.classdata.get(builder.expected).packageId;
-                         final ClassData oldexpected =
-                             builder.classdata.get(builder.expected);
-                         final MethodData meth =
-                             new MethodData(MethodData.Access.PRIVATE,
-                                            MethodData.Context.INSTANCE);
-                         final ClassData withDef =
-                             new ClassData(pck, meth);
-                         final int I2 = builder.expected;
-                         final int I1 = builder.methodref;
-                         final int C2 = builder.addClass(withDef);
-                         final int C1 = builder.addClass(emptyClass(pck));
-                         builder.hier.addInherit(C1, I1);
-                         builder.hier.addInherit(C1, C2);
-                         builder.hier.addInherit(C2, I2);
-                         builder.objectref = C1;
-                         builder.expected = C2;
-                     },
+                     // (final SelectionResolutionTestCase.Builder builder) -> {
+                     //     final ClassData.Package pck =
+                     //         builder.classdata.get(builder.expected).packageId;
+                     //     final ClassData oldexpected =
+                     //         builder.classdata.get(builder.expected);
+                     //     final MethodData meth =
+                     //         new MethodData(MethodData.Access.PRIVATE,
+                     //                        MethodData.Context.INSTANCE);
+                     //     final ClassData withDef =
+                     //         new ClassData(pck, meth);
+                     //     final int I2 = builder.expected;
+                     //     final int I1 = builder.methodref;
+                     //     final int C2 = builder.addClass(withDef);
+                     //     final int C1 = builder.addClass(emptyClass(pck));
+                     //     builder.hier.addInherit(C1, I1);
+                     //     builder.hier.addInherit(C1, C2);
+                     //     builder.hier.addInherit(C2, I2);
+                     //     builder.objectref = C1;
+                     //     builder.expected = C2;
+                     // },
                      /* Case 11: Diamond, with superclass, overlaping, expected
                       * at top, class overrides
                       *
                       * I2[](def) = old expected
                       * C2[I2](pack) = expected, I1[](*) = mref

@@ -4700,29 +4709,29 @@
                       *
                       * I[](*) = mref
                       * C2[I](priv) = expected
                       * C1[C2]() = oref
                       */
-                     (final SelectionResolutionTestCase.Builder builder) -> {
-                         final ClassData.Package pck =
-                             builder.classdata.get(builder.expected).packageId;
-                         final ClassData oldexpected =
-                             builder.classdata.get(builder.expected);
-                         final MethodData meth =
-                             new MethodData(MethodData.Access.PRIVATE,
-                                            MethodData.Context.INSTANCE);
-                         final ClassData withDef =
-                             new ClassData(pck, meth);
-                         final int I = builder.methodref;
-                         final int C2 = builder.addClass(withDef);
-                         final int C1 = builder.addClass(emptyClass(pck));
-                         builder.hier.addInherit(C1, I);
-                         builder.hier.addInherit(C1, C2);
-                         builder.hier.addInherit(C2, I);
-                         builder.expected = C2;
-                         builder.objectref = C1;
-                     },
+                     // (final SelectionResolutionTestCase.Builder builder) -> {
+                     //     final ClassData.Package pck =
+                     //         builder.classdata.get(builder.expected).packageId;
+                     //     final ClassData oldexpected =
+                     //         builder.classdata.get(builder.expected);
+                     //     final MethodData meth =
+                     //         new MethodData(MethodData.Access.PRIVATE,
+                     //                        MethodData.Context.INSTANCE);
+                     //     final ClassData withDef =
+                     //         new ClassData(pck, meth);
+                     //     final int I = builder.methodref;
+                     //     final int C2 = builder.addClass(withDef);
+                     //     final int C1 = builder.addClass(emptyClass(pck));
+                     //     builder.hier.addInherit(C1, I);
+                     //     builder.hier.addInherit(C1, C2);
+                     //     builder.hier.addInherit(C2, I);
+                     //     builder.expected = C2;
+                     //     builder.objectref = C1;
+                     // },
                      /* Case 14: Superclass overrides.
                       *
                       * I[](*) = mref
                       * C2[I](prot) = expected
                       * C1[C2]() = oref
< prev index next >