hotspot/test/runtime/SelectionResolution/IllegalAccessErrorTest.java
changeset 37196 f3f7367e8c53
child 40631 ed82623d7831
equal deleted inserted replaced
37195:88b6f1271f64 37196:f3f7367e8c53
       
     1 /*
       
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     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
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     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  * @summary Test of method selection and resolution cases that
       
    27  * generate IllegalAccessErrorTest
       
    28  * @modules java.base/jdk.internal.org.objectweb.asm
       
    29  * @library /runtime/SelectionResolution/classes
       
    30  * @build selectionresolution.*
       
    31  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies IllegalAccessErrorTest
       
    32  */
       
    33 
       
    34 import java.util.Arrays;
       
    35 import java.util.Collection;
       
    36 import java.util.EnumSet;
       
    37 import selectionresolution.ClassData;
       
    38 import selectionresolution.MethodData;
       
    39 import selectionresolution.Result;
       
    40 import selectionresolution.SelectionResolutionTest;
       
    41 import selectionresolution.SelectionResolutionTestCase;
       
    42 import selectionresolution.Template;
       
    43 
       
    44 public class IllegalAccessErrorTest extends SelectionResolutionTest {
       
    45 
       
    46     private static final SelectionResolutionTestCase.Builder initBuilder =
       
    47         new SelectionResolutionTestCase.Builder();
       
    48 
       
    49     static {
       
    50         initBuilder.setResult(Result.IAE);
       
    51     }
       
    52 
       
    53     private static final Collection<TestGroup> testgroups =
       
    54         Arrays.asList(
       
    55                 /* invokestatic tests */
       
    56                 /* Group 125 : callsite = methodref, methodref !=
       
    57                  * expected, expected is class
       
    58                  */
       
    59                 new TestGroup.Simple(initBuilder,
       
    60                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
    61                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
    62                                              EnumSet.of(MethodData.Access.PRIVATE),
       
    63                                              EnumSet.of(MethodData.Context.STATIC),
       
    64                                              EnumSet.of(ClassData.Package.SAME)),
       
    65                         Template.MethodrefNotEqualsExpectedClass,
       
    66                         Template.CallsiteEqualsMethodref,
       
    67                         Template.TrivialObjectref),
       
    68                 /* Group 126: callsite :> methodref, methodref = expected,
       
    69                  * expected is class, expected and callsite in the same package
       
    70                  */
       
    71                 new TestGroup.Simple(initBuilder,
       
    72                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
    73                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
    74                                              EnumSet.of(MethodData.Access.PRIVATE),
       
    75                                              EnumSet.of(MethodData.Context.STATIC),
       
    76                                              EnumSet.of(ClassData.Package.SAME)),
       
    77                         Template.MethodrefEqualsExpected,
       
    78                         Template.CallsiteSubclassMethodref,
       
    79                         Template.TrivialObjectref),
       
    80                 /* Group 127: callsite :> methodref, methodref != expected,
       
    81                  * expected is class, expected and callsite in the same package
       
    82                  */
       
    83                 new TestGroup.Simple(initBuilder,
       
    84                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
    85                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
    86                                              EnumSet.of(MethodData.Access.PRIVATE),
       
    87                                              EnumSet.of(MethodData.Context.STATIC),
       
    88                                              EnumSet.of(ClassData.Package.SAME)),
       
    89                         Template.MethodrefNotEqualsExpectedClass,
       
    90                         Template.CallsiteSubclassMethodref,
       
    91                         Template.TrivialObjectref),
       
    92                 /* Group 128: callsite unrelated to methodref, methodref = expected,
       
    93                  * expected is class, expected and callsite in the same package
       
    94                  */
       
    95                 new TestGroup.Simple(initBuilder,
       
    96                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
    97                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
    98                                              EnumSet.of(MethodData.Access.PRIVATE),
       
    99                                              EnumSet.of(MethodData.Context.STATIC),
       
   100                                              EnumSet.of(ClassData.Package.SAME)),
       
   101                         Template.MethodrefEqualsExpected,
       
   102                         Template.CallsiteUnrelatedToMethodref,
       
   103                         Template.TrivialObjectref),
       
   104                 /* Group 129: callsite unrelated to methodref, methodref != expected,
       
   105                  * expected is class, expected and callsite in the same package
       
   106                  */
       
   107                 new TestGroup.Simple(initBuilder,
       
   108                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
   109                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   110                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   111                                              EnumSet.of(MethodData.Context.STATIC),
       
   112                                              EnumSet.of(ClassData.Package.SAME)),
       
   113                         Template.MethodrefNotEqualsExpectedClass,
       
   114                         Template.CallsiteUnrelatedToMethodref,
       
   115                         Template.TrivialObjectref),
       
   116                 /* Group 130: callsite = methodref, methodref != expected,
       
   117                  * expected is class, expected and callsite not in the same package
       
   118                  */
       
   119                 new TestGroup.Simple(initBuilder,
       
   120                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
   121                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   122                                              EnumSet.of(MethodData.Access.PRIVATE,
       
   123                                                         MethodData.Access.PACKAGE),
       
   124                                              EnumSet.of(MethodData.Context.STATIC),
       
   125                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   126                         Template.MethodrefNotEqualsExpectedClass,
       
   127                         Template.CallsiteEqualsMethodref,
       
   128                         Template.TrivialObjectref),
       
   129                 /* Group 131: callsite :> methodref, methodref = expected,
       
   130                  * expected is class, expected and callsite not in the same package
       
   131                  */
       
   132                 new TestGroup.Simple(initBuilder,
       
   133                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
   134                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   135                                              EnumSet.of(MethodData.Access.PRIVATE,
       
   136                                                         MethodData.Access.PACKAGE),
       
   137                                              EnumSet.of(MethodData.Context.STATIC),
       
   138                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   139                         Template.MethodrefEqualsExpected,
       
   140                         Template.CallsiteSubclassMethodref,
       
   141                         Template.TrivialObjectref),
       
   142                 /* Group 132: callsite :> methodref, methodref != expected,
       
   143                  * expected is class, expected and callsite not in the same package
       
   144                  */
       
   145                 new TestGroup.Simple(initBuilder,
       
   146                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
   147                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   148                                              EnumSet.of(MethodData.Access.PRIVATE,
       
   149                                                         MethodData.Access.PACKAGE),
       
   150                                              EnumSet.of(MethodData.Context.STATIC),
       
   151                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   152                         Template.MethodrefNotEqualsExpectedClass,
       
   153                         Template.CallsiteSubclassMethodref,
       
   154                         Template.TrivialObjectref),
       
   155                 /* Group 133: callsite unrelated to methodref, methodref = expected,
       
   156                  * expected is class, expected and callsite not in the same package
       
   157                  */
       
   158                 new TestGroup.Simple(initBuilder,
       
   159                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
   160                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   161                                              EnumSet.of(MethodData.Access.PRIVATE,
       
   162                                                         MethodData.Access.PROTECTED,
       
   163                                                         MethodData.Access.PACKAGE),
       
   164                                              EnumSet.of(MethodData.Context.STATIC),
       
   165                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   166                         Template.MethodrefEqualsExpected,
       
   167                         Template.CallsiteUnrelatedToMethodref,
       
   168                         Template.TrivialObjectref),
       
   169                 /* Group 134: callsite unrelated to methodref, methodref != expected,
       
   170                  * expected is class, expected and callsite not in the same package
       
   171                  */
       
   172                 new TestGroup.Simple(initBuilder,
       
   173                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESTATIC),
       
   174                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   175                                              EnumSet.of(MethodData.Access.PRIVATE,
       
   176                                                         MethodData.Access.PROTECTED,
       
   177                                                         MethodData.Access.PACKAGE),
       
   178                                              EnumSet.of(MethodData.Context.STATIC),
       
   179                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   180                         Template.MethodrefNotEqualsExpectedClass,
       
   181                         Template.CallsiteUnrelatedToMethodref,
       
   182                         Template.TrivialObjectref),
       
   183 
       
   184                 /* invokevirtual tests */
       
   185                 /* Group 135: callsite = methodref, methodref != expected,
       
   186                  * expected is class, expected and callsite in the same package
       
   187                  */
       
   188                 new TestGroup.Simple(initBuilder,
       
   189                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   190                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   191                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   192                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   193                                              EnumSet.of(ClassData.Package.SAME)),
       
   194                         Template.OverrideAbstractExpectedClass,
       
   195                         Template.MethodrefNotEqualsExpectedClass,
       
   196                         Template.IgnoredAbstract,
       
   197                         Template.CallsiteEqualsMethodref,
       
   198                         Template.MethodrefSelectionResolvedIsClass),
       
   199                 /* Group 136: callsite :> methodref, methodref = expected,
       
   200                  * expected is class, expected and callsite in the same package
       
   201                  */
       
   202                 new TestGroup.Simple(initBuilder,
       
   203                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   204                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   205                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   206                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   207                                              EnumSet.of(ClassData.Package.SAME)),
       
   208                         Template.OverrideAbstractExpectedClass,
       
   209                         Template.MethodrefEqualsExpected,
       
   210                         Template.IgnoredAbstract,
       
   211                         Template.CallsiteSubclassMethodref,
       
   212                         Template.MethodrefSelectionResolvedIsClass),
       
   213                 /* Group 137: callsite :> methodref, methodref != expected,
       
   214                  * expected is class, expected and callsite in the same package
       
   215                  */
       
   216                 new TestGroup.Simple(initBuilder,
       
   217                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   218                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   219                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   220                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   221                                              EnumSet.of(ClassData.Package.SAME)),
       
   222                         Template.OverrideAbstractExpectedClass,
       
   223                         Template.MethodrefNotEqualsExpectedClass,
       
   224                         Template.IgnoredAbstract,
       
   225                         Template.CallsiteSubclassMethodref,
       
   226                         Template.MethodrefSelectionResolvedIsClass),
       
   227                 /* Group 138: callsite unrelated to methodref, methodref = expected,
       
   228                  * expected is class, expected and callsite in the same package
       
   229                  */
       
   230                 new TestGroup.Simple(initBuilder,
       
   231                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   232                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   233                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   234                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   235                                              EnumSet.of(ClassData.Package.SAME)),
       
   236                         Template.OverrideAbstractExpectedClass,
       
   237                         Template.MethodrefEqualsExpected,
       
   238                         Template.IgnoredAbstract,
       
   239                         Template.CallsiteUnrelatedToMethodref,
       
   240                         Template.MethodrefSelectionResolvedIsClass),
       
   241                 /* Group 139: callsite unrelated to methodref, methodref != expected,
       
   242                  * expected is class, expected and callsite in the same package
       
   243                  */
       
   244                 new TestGroup.Simple(initBuilder,
       
   245                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   246                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   247                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   248                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   249                                              EnumSet.of(ClassData.Package.SAME)),
       
   250                         Template.OverrideAbstractExpectedClass,
       
   251                         Template.MethodrefNotEqualsExpectedClass,
       
   252                         Template.IgnoredAbstract,
       
   253                         Template.CallsiteUnrelatedToMethodref,
       
   254                         Template.MethodrefSelectionResolvedIsClass),
       
   255                 /* Group 140: callsite = methodref, methodref != expected,
       
   256                  * expected is class, expected and callsite not in the same package
       
   257                  */
       
   258                 new TestGroup.Simple(initBuilder,
       
   259                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   260                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   261                                              EnumSet.of(MethodData.Access.PACKAGE,
       
   262                                                         MethodData.Access.PRIVATE),
       
   263                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   264                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   265                         Template.OverrideAbstractExpectedClass,
       
   266                         Template.MethodrefNotEqualsExpectedClass,
       
   267                         Template.IgnoredAbstract,
       
   268                         Template.CallsiteEqualsMethodref,
       
   269                         Template.MethodrefSelectionResolvedIsClass),
       
   270                 /* Group 141: callsite :> methodref, methodref = expected,
       
   271                  * expected is class, expected and callsite not in the same package
       
   272                  */
       
   273                 new TestGroup.Simple(initBuilder,
       
   274                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   275                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   276                                              EnumSet.of(MethodData.Access.PACKAGE,
       
   277                                                         MethodData.Access.PRIVATE),
       
   278                                              EnumSet.of(MethodData.Context.INSTANCE,
       
   279                                                         MethodData.Context.ABSTRACT),
       
   280                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   281                         Template.OverrideAbstractExpectedClass,
       
   282                         Template.MethodrefEqualsExpected,
       
   283                         Template.IgnoredAbstract,
       
   284                         Template.CallsiteSubclassMethodref,
       
   285                         Template.MethodrefSelectionResolvedIsClass),
       
   286                 /* Group 142: callsite :> methodref, methodref = expected,
       
   287                  * expected is class, expected and callsite not in the same package
       
   288                  */
       
   289                 new TestGroup.Simple(initBuilder,
       
   290                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   291                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   292                                              EnumSet.of(MethodData.Access.PACKAGE,
       
   293                                                         MethodData.Access.PRIVATE),
       
   294                                              EnumSet.of(MethodData.Context.INSTANCE,
       
   295                                                         MethodData.Context.ABSTRACT),
       
   296                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   297                         Template.OverrideAbstractExpectedClass,
       
   298                         Template.MethodrefNotEqualsExpectedClass,
       
   299                         Template.IgnoredAbstract,
       
   300                         Template.CallsiteSubclassMethodref,
       
   301                         Template.MethodrefSelectionResolvedIsClass),
       
   302                 /* Group 143: callsite unrelated to methodref, methodref = expected,
       
   303                  * expected is class, expected and callsite not in the same package
       
   304                  */
       
   305                 new TestGroup.Simple(initBuilder,
       
   306                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   307                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   308                                              EnumSet.of(MethodData.Access.PACKAGE,
       
   309                                                         // protected causes verifier error.
       
   310                                                         MethodData.Access.PRIVATE),
       
   311                                              EnumSet.of(MethodData.Context.INSTANCE,
       
   312                                                         MethodData.Context.ABSTRACT),
       
   313                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   314                         Template.OverrideAbstractExpectedClass,
       
   315                         Template.MethodrefEqualsExpected,
       
   316                         Template.IgnoredAbstract,
       
   317                         Template.CallsiteUnrelatedToMethodref,
       
   318                         Template.MethodrefSelectionResolvedIsClass),
       
   319                 /* Group 144: callsite unrelated to methodref, methodref != expected,
       
   320                  * expected is class, expected and callsite not in the same package
       
   321                  */
       
   322                 new TestGroup.Simple(initBuilder,
       
   323                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEVIRTUAL),
       
   324                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   325                                              EnumSet.of(MethodData.Access.PACKAGE,
       
   326                                                         // protected causes verifier error.
       
   327                                                         MethodData.Access.PRIVATE),
       
   328                                              EnumSet.of(MethodData.Context.INSTANCE,
       
   329                                                         MethodData.Context.ABSTRACT),
       
   330                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   331                         Template.OverrideAbstractExpectedClass,
       
   332                         Template.MethodrefNotEqualsExpectedClass,
       
   333                         Template.IgnoredAbstract,
       
   334                         Template.CallsiteUnrelatedToMethodref,
       
   335                         Template.MethodrefSelectionResolvedIsClass),
       
   336 
       
   337                 /* invokeinterface tests */
       
   338                 /* Group 145: callsite = methodref = expected */
       
   339                 new TestGroup.Simple(initBuilder,
       
   340                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEINTERFACE),
       
   341                         Template.ResultCombo(EnumSet.of(Template.Kind.INTERFACE),
       
   342                                              EnumSet.of(MethodData.Access.PUBLIC),
       
   343                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   344                                              EnumSet.of(ClassData.Package.SAME)),
       
   345                         Template.OverrideAbstractExpectedIface,
       
   346                         Template.MethodrefEqualsExpected,
       
   347                         Template.IgnoredAbstract,
       
   348                         Template.CallsiteEqualsMethodref,
       
   349                         Template.IfaceMethodrefSelectionOverrideNonPublic),
       
   350                 /* Group 146: callsite = methodref, methodref != expected */
       
   351                 new TestGroup.Simple(initBuilder,
       
   352                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEINTERFACE),
       
   353                         Template.ResultCombo(EnumSet.of(Template.Kind.INTERFACE),
       
   354                                              EnumSet.of(MethodData.Access.PUBLIC),
       
   355                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   356                                              EnumSet.of(ClassData.Package.SAME,
       
   357                                                         ClassData.Package.DIFFERENT)),
       
   358                         Template.OverrideAbstractExpectedIface,
       
   359                         Template.IfaceMethodrefNotEqualsExpected,
       
   360                         Template.IgnoredAbstract,
       
   361                         Template.CallsiteEqualsMethodref,
       
   362                         Template.IfaceMethodrefSelectionOverrideNonPublic),
       
   363                 /* Group 147: callsite :> methodref, methodref = expected */
       
   364                 new TestGroup.Simple(initBuilder,
       
   365                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEINTERFACE),
       
   366                         Template.ResultCombo(EnumSet.of(Template.Kind.INTERFACE),
       
   367                                              EnumSet.of(MethodData.Access.PUBLIC),
       
   368                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   369                                              EnumSet.of(ClassData.Package.SAME,
       
   370                                                         ClassData.Package.DIFFERENT)),
       
   371                         Template.OverrideAbstractExpectedIface,
       
   372                         Template.MethodrefEqualsExpected,
       
   373                         Template.IgnoredAbstract,
       
   374                         Template.CallsiteSubclassMethodref,
       
   375                         Template.IfaceMethodrefSelectionOverrideNonPublic),
       
   376                 /* Group 148: callsite :> methodref, methodref != expected */
       
   377                 new TestGroup.Simple(initBuilder,
       
   378                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEINTERFACE),
       
   379                         Template.ResultCombo(EnumSet.of(Template.Kind.INTERFACE),
       
   380                                              EnumSet.of(MethodData.Access.PUBLIC),
       
   381                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   382                                              EnumSet.of(ClassData.Package.SAME,
       
   383                                                         ClassData.Package.DIFFERENT)),
       
   384                         Template.OverrideAbstractExpectedIface,
       
   385                         Template.IfaceMethodrefNotEqualsExpected,
       
   386                         Template.IgnoredAbstract,
       
   387                         Template.CallsiteSubclassMethodref,
       
   388                         Template.IfaceMethodrefSelectionOverrideNonPublic),
       
   389                 /* Group 149: callsite unrelated to methodref, methodref = expected */
       
   390                 new TestGroup.Simple(initBuilder,
       
   391                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEINTERFACE),
       
   392                         Template.ResultCombo(EnumSet.of(Template.Kind.INTERFACE),
       
   393                                              EnumSet.of(MethodData.Access.PUBLIC),
       
   394                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   395                                              EnumSet.of(ClassData.Package.SAME,
       
   396                                                         ClassData.Package.DIFFERENT)),
       
   397                         Template.OverrideAbstractExpectedIface,
       
   398                         Template.MethodrefEqualsExpected,
       
   399                         Template.IgnoredAbstract,
       
   400                         Template.CallsiteUnrelatedToMethodref,
       
   401                         Template.IfaceMethodrefSelectionOverrideNonPublic),
       
   402                 /* Group 150: callsite unrelated to methodref, methodref != expected */
       
   403                 new TestGroup.Simple(initBuilder,
       
   404                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKEINTERFACE),
       
   405                         Template.ResultCombo(EnumSet.of(Template.Kind.INTERFACE),
       
   406                                              EnumSet.of(MethodData.Access.PUBLIC),
       
   407                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   408                                              EnumSet.of(ClassData.Package.SAME,
       
   409                                                         ClassData.Package.DIFFERENT)),
       
   410                         Template.OverrideAbstractExpectedIface,
       
   411                         Template.IfaceMethodrefNotEqualsExpected,
       
   412                         Template.IgnoredAbstract,
       
   413                         Template.CallsiteUnrelatedToMethodref,
       
   414                         Template.IfaceMethodrefSelectionOverrideNonPublic),
       
   415 
       
   416                 /* invokespecial tests */
       
   417                 /* Group 151: callsite = methodref, methodref != expected,
       
   418                  * expected is class, expected and callsite in the same package
       
   419                  */
       
   420                 new TestGroup.Simple(initBuilder,
       
   421                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESPECIAL),
       
   422                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   423                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   424                                              EnumSet.of(MethodData.Context.INSTANCE,
       
   425                                                         MethodData.Context.ABSTRACT),
       
   426                                              EnumSet.of(ClassData.Package.SAME)),
       
   427                         Template.OverrideAbstractExpectedClass,
       
   428                         Template.MethodrefNotEqualsExpectedClass,
       
   429                         Template.IgnoredAbstract,
       
   430                         Template.CallsiteEqualsMethodref,
       
   431                         Template.ObjectrefAssignableToCallsite),
       
   432                 /* Group 152: callsite :> methodref, methodref = expected,
       
   433                  * expected is class, expected and callsite in the same package
       
   434                  */
       
   435                 new TestGroup.Simple(initBuilder,
       
   436                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESPECIAL),
       
   437                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   438                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   439                                              EnumSet.of(MethodData.Context.INSTANCE,
       
   440                                                         MethodData.Context.ABSTRACT),
       
   441                                              EnumSet.of(ClassData.Package.SAME)),
       
   442                         Template.OverrideAbstractExpectedClass,
       
   443                         Template.MethodrefEqualsExpected,
       
   444                         Template.IgnoredAbstract,
       
   445                         Template.CallsiteSubclassMethodref,
       
   446                         Template.ObjectrefAssignableToCallsite),
       
   447                 /* Group 153: callsite :> methodref, methodref != expected,
       
   448                  * expected is class, expected and callsite in the same package
       
   449                  */
       
   450                 new TestGroup.Simple(initBuilder,
       
   451                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESPECIAL),
       
   452                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   453                                              EnumSet.of(MethodData.Access.PRIVATE),
       
   454                                              EnumSet.of(MethodData.Context.INSTANCE,
       
   455                                                         MethodData.Context.ABSTRACT),
       
   456                                              EnumSet.of(ClassData.Package.SAME)),
       
   457                         Template.OverrideAbstractExpectedClass,
       
   458                         Template.MethodrefNotEqualsExpectedClass,
       
   459                         Template.IgnoredAbstract,
       
   460                         Template.CallsiteSubclassMethodref,
       
   461                         Template.ObjectrefAssignableToCallsite),
       
   462                 /* Group 154: callsite = methodref, methodref != expected,
       
   463                  * expected is class, expected and callsite not in the same package
       
   464                  */
       
   465                 new TestGroup.Simple(initBuilder,
       
   466                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESPECIAL),
       
   467                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   468                                              EnumSet.of(MethodData.Access.PACKAGE,
       
   469                                                         MethodData.Access.PRIVATE),
       
   470                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   471                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   472                         Template.OverrideAbstractExpectedClass,
       
   473                         Template.MethodrefNotEqualsExpectedClass,
       
   474                         Template.IgnoredAbstract,
       
   475                         Template.CallsiteEqualsMethodref,
       
   476                         Template.ObjectrefExactSubclassOfCallsite),
       
   477                 /* Group 155: callsite :> methodref, methodref = expected,
       
   478                  * expected is class, expected and callsite not in the same package
       
   479                  */
       
   480                 new TestGroup.Simple(initBuilder,
       
   481                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESPECIAL),
       
   482                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   483                                              EnumSet.of(MethodData.Access.PACKAGE,
       
   484                                                         MethodData.Access.PRIVATE),
       
   485                                              EnumSet.of(MethodData.Context.INSTANCE),
       
   486                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   487                         Template.OverrideAbstractExpectedClass,
       
   488                         Template.MethodrefEqualsExpected,
       
   489                         Template.IgnoredAbstract,
       
   490                         Template.CallsiteSubclassMethodref,
       
   491                         Template.ObjectrefExactSubclassOfCallsite),
       
   492                 /* Group 156: callsite :> methodref, methodref != expected,
       
   493                  * expected is class, expected and callsite not in the same package
       
   494                  */
       
   495                 new TestGroup.Simple(initBuilder,
       
   496                         Template.SetInvoke(SelectionResolutionTestCase.InvokeInstruction.INVOKESPECIAL),
       
   497                         Template.ResultCombo(EnumSet.of(Template.Kind.CLASS),
       
   498                                              EnumSet.of(MethodData.Access.PACKAGE,
       
   499                                                         MethodData.Access.PRIVATE),
       
   500                                              EnumSet.of(MethodData.Context.INSTANCE,
       
   501                                                         MethodData.Context.ABSTRACT),
       
   502                                              EnumSet.of(ClassData.Package.DIFFERENT)),
       
   503                         Template.OverrideAbstractExpectedClass,
       
   504                         Template.MethodrefNotEqualsExpectedClass,
       
   505                         Template.IgnoredAbstract,
       
   506                         Template.CallsiteSubclassMethodref,
       
   507                         Template.ObjectrefExactSubclassOfCallsite)
       
   508             );
       
   509 
       
   510     private IllegalAccessErrorTest() {
       
   511         super(testgroups);
       
   512     }
       
   513 
       
   514     public static void main(final String... args) {
       
   515         new IllegalAccessErrorTest().run();
       
   516     }
       
   517 }