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