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