< prev index next >

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

Print this page


   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  */


4377                             builder.classdata.get(builder.expected);
4378                          final ClassData withDef =
4379                              new ClassData(pck, oldexpected.methoddata);
4380                          final MethodData meth =
4381                              new MethodData(MethodData.Access.PUBLIC,
4382                                             MethodData.Context.STATIC);
4383                          final ClassData withStatDef =
4384                              new ClassData(pck, meth);
4385                          final int I = builder.methodref;
4386                          final int C3 = builder.addClass(withDef);
4387                          final int C2 = builder.addClass(withStatDef);
4388                          final int C1 = builder.addClass(emptyClass(pck));
4389                          builder.hier.addInherit(C1, I);
4390                          builder.hier.addInherit(C1, C2);
4391                          builder.hier.addInherit(C2, C3);
4392                          builder.hier.addInherit(C2, I);
4393                          builder.expected = C3;
4394                          builder.objectref = C1;
4395                      });
4396 









4397     public static final Template IfaceMethodrefSelectionOverrideNonPublic =
4398         new Template("IfaceMethodrefSelection",
4399                      /* Case 1: Objectref overrides.
4400                       *
4401                       * I[](*) = mref
4402                       * C[I](priv) = oref = expected
4403                       */
4404                      (final SelectionResolutionTestCase.Builder builder) -> {
4405                          final ClassData.Package pck =
4406                              builder.classdata.get(builder.methodref).packageId;
4407                          final ClassData oldexpected =
4408                              builder.classdata.get(builder.expected);
4409                          final MethodData meth =
4410                              new MethodData(MethodData.Access.PRIVATE,
4411                                             MethodData.Context.INSTANCE);
4412                          final ClassData withDef =
4413                              new ClassData(pck, meth);
4414                          final int I = builder.methodref;
4415                          final int C = builder.addClass(withDef);
4416                          builder.hier.addInherit(C, I);
4417                          builder.objectref = C;
4418                          builder.expected = C;
4419                      },
4420                      /* Case 2: Objectref overrides.
4421                       *
4422                       * I[](*) = mref
4423                       * C[I](prot) = oref = expected
4424                       */
4425                      (final SelectionResolutionTestCase.Builder builder) -> {
4426                          final ClassData.Package pck =
4427                              builder.classdata.get(builder.methodref).packageId;
4428                          final ClassData oldexpected =
4429                              builder.classdata.get(builder.expected);
4430                          final MethodData meth =
4431                              new MethodData(MethodData.Access.PROTECTED,
4432                                             MethodData.Context.INSTANCE);
4433                          final ClassData withDef =
4434                              new ClassData(pck, meth);
4435                          final int I = builder.methodref;
4436                          final int C = builder.addClass(withDef);
4437                          builder.hier.addInherit(C, I);
4438                          builder.objectref = C;
4439                          builder.expected = C;


4449                          final ClassData oldexpected =
4450                              builder.classdata.get(builder.expected);
4451                          final MethodData meth =
4452                              new MethodData(MethodData.Access.PACKAGE,
4453                                             MethodData.Context.INSTANCE);
4454                          final ClassData withDef =
4455                              new ClassData(pck, meth);
4456                          final int I = builder.methodref;
4457                          final int C = builder.addClass(withDef);
4458                          builder.hier.addInherit(C, I);
4459                          builder.objectref = C;
4460                          builder.expected = C;
4461                      },
4462                      /* Case 4: Diamond, with superclass, expected at top,
4463                       * class overriding with private.
4464                       *
4465                       * I2[](*) = mref
4466                       * C2[I2](priv) = expected, I1[I2]()
4467                       * C1[I1,C2]() = oref
4468                       */
4469                      (final SelectionResolutionTestCase.Builder builder) -> {
4470                          final ClassData.Package pck =
4471                              builder.classdata.get(builder.expected).packageId;
4472                          final ClassData oldexpected =
4473                              builder.classdata.get(builder.expected);
4474                          final MethodData meth =
4475                              new MethodData(MethodData.Access.PRIVATE,
4476                                             MethodData.Context.INSTANCE);
4477                          final ClassData withDef =
4478                              new ClassData(pck, meth);
4479                          final int I2 = builder.methodref;
4480                          final int I1 = builder.addInterface(emptyClass(pck));
4481                          final int C2 = builder.addClass(withDef);
4482                          final int C1 = builder.addClass(emptyClass(pck));
4483                          builder.hier.addInherit(C1, I1);
4484                          builder.hier.addInherit(C1, C2);
4485                          builder.hier.addInherit(I1, I2);
4486                          builder.hier.addInherit(C2, I2);
4487                          builder.objectref = C1;
4488                          builder.expected = C2;
4489                      },
4490                      /* Case 5: Diamond, with superclass, expected at top,
4491                       * class overriding with package private.
4492                       *
4493                       * I2[](*) = mref
4494                       * C2[I2](pack) = expected, I1[I2]()
4495                       * C1[I1,C2]() = oref
4496                       */
4497                      (final SelectionResolutionTestCase.Builder builder) -> {
4498                          final ClassData.Package pck =
4499                              builder.classdata.get(builder.expected).packageId;
4500                          final ClassData oldexpected =
4501                              builder.classdata.get(builder.expected);
4502                          final MethodData meth =
4503                              new MethodData(MethodData.Access.PACKAGE,
4504                                             MethodData.Context.INSTANCE);
4505                          final ClassData withDef =
4506                              new ClassData(pck, meth);
4507                          final int I2 = builder.methodref;
4508                          final int I1 = builder.addInterface(emptyClass(pck));
4509                          final int C2 = builder.addClass(withDef);


4532                                             MethodData.Context.INSTANCE);
4533                          final ClassData withDef =
4534                              new ClassData(pck, meth);
4535                          final int I2 = builder.methodref;
4536                          final int I1 = builder.addInterface(emptyClass(pck));
4537                          final int C2 = builder.addClass(withDef);
4538                          final int C1 = builder.addClass(emptyClass(pck));
4539                          builder.hier.addInherit(C1, I1);
4540                          builder.hier.addInherit(C1, C2);
4541                          builder.hier.addInherit(I1, I2);
4542                          builder.hier.addInherit(C2, I2);
4543                          builder.objectref = C1;
4544                          builder.expected = C2;
4545                      },
4546                      /* Case 7: Y, with superclass, overlaping, expected
4547                       * at top, class overrides
4548                       *
4549                       * C2[](priv) = expected, I1[](*) = mref
4550                       * C1[I1,C2]() = oref
4551                       */
4552                      (final SelectionResolutionTestCase.Builder builder) -> {
4553                          final ClassData.Package pck =
4554                              builder.classdata.get(builder.expected).packageId;
4555                         final ClassData oldexpected =
4556                             builder.classdata.get(builder.expected);
4557                          final MethodData meth =
4558                              new MethodData(MethodData.Access.PRIVATE,
4559                                             MethodData.Context.INSTANCE);
4560                         final ClassData withDef =
4561                             new ClassData(pck, meth);
4562                          final int I1 = builder.methodref;
4563                          final int C2 = builder.addClass(withDef);
4564                          final int C1 = builder.addClass(emptyClass(pck));
4565                          builder.hier.addInherit(C1, I1);
4566                          builder.hier.addInherit(C1, C2);
4567                          builder.objectref = C1;
4568                          builder.expected = C2;
4569                      },
4570                      /* Case 8: Y, with superclass, overlaping, expected
4571                       * at top, class overrides
4572                       *
4573                       * C2[](prot) = expected, I1[](*) = mref
4574                       * C1[I1,C2]() = oref
4575                       */
4576                      (final SelectionResolutionTestCase.Builder builder) -> {
4577                          final ClassData.Package pck =
4578                              builder.classdata.get(builder.expected).packageId;
4579                         final ClassData oldexpected =
4580                             builder.classdata.get(builder.expected);
4581                          final MethodData meth =
4582                              new MethodData(MethodData.Access.PROTECTED,
4583                                             MethodData.Context.INSTANCE);
4584                         final ClassData withDef =
4585                             new ClassData(pck, meth);
4586                          final int I1 = builder.methodref;
4587                          final int C2 = builder.addClass(withDef);
4588                          final int C1 = builder.addClass(emptyClass(pck));
4589                          builder.hier.addInherit(C1, I1);


4605                          final MethodData meth =
4606                              new MethodData(MethodData.Access.PACKAGE,
4607                                             MethodData.Context.INSTANCE);
4608                          final ClassData withDef =
4609                              new ClassData(pck, meth);
4610                          final int I1 = builder.methodref;
4611                          final int C2 = builder.addClass(withDef);
4612                          final int C1 = builder.addClass(emptyClass(pck));
4613                          builder.hier.addInherit(C1, I1);
4614                          builder.hier.addInherit(C1, C2);
4615                          builder.objectref = C1;
4616                          builder.expected = C2;
4617                      },
4618                      /* Case 10: Diamond, with superclass, overlaping, expected
4619                       * at top, class overrides
4620                       *
4621                       * I2[](def) = old expected
4622                       * C2[I2](priv) = expected, I1[](*) = mref
4623                       * C1[I1,C2]() = oref
4624                       */
4625                      (final SelectionResolutionTestCase.Builder builder) -> {
4626                          final ClassData.Package pck =
4627                              builder.classdata.get(builder.expected).packageId;
4628                          final ClassData oldexpected =
4629                              builder.classdata.get(builder.expected);
4630                          final MethodData meth =
4631                              new MethodData(MethodData.Access.PRIVATE,
4632                                             MethodData.Context.INSTANCE);
4633                          final ClassData withDef =
4634                              new ClassData(pck, meth);
4635                          final int I2 = builder.expected;
4636                          final int I1 = builder.methodref;
4637                          final int C2 = builder.addClass(withDef);
4638                          final int C1 = builder.addClass(emptyClass(pck));
4639                          builder.hier.addInherit(C1, I1);
4640                          builder.hier.addInherit(C1, C2);
4641                          builder.hier.addInherit(C2, I2);
4642                          builder.objectref = C1;
4643                          builder.expected = C2;
4644                      },
4645                      /* Case 11: Diamond, with superclass, overlaping, expected
4646                       * at top, class overrides
4647                       *
4648                       * I2[](def) = old expected
4649                       * C2[I2](pack) = expected, I1[](*) = mref
4650                       * C1[I1,C2]() = oref
4651                       */
4652                      (final SelectionResolutionTestCase.Builder builder) -> {
4653                          final ClassData.Package pck =
4654                              builder.classdata.get(builder.expected).packageId;
4655                          final ClassData oldexpected =
4656                              builder.classdata.get(builder.expected);
4657                          final MethodData meth =
4658                              new MethodData(MethodData.Access.PACKAGE,
4659                                             MethodData.Context.INSTANCE);
4660                          final ClassData withDef =
4661                              new ClassData(pck, meth);
4662                          final int I2 = builder.expected;
4663                          final int I1 = builder.methodref;
4664                          final int C2 = builder.addClass(withDef);


4685                              new MethodData(MethodData.Access.PROTECTED,
4686                                             MethodData.Context.INSTANCE);
4687                          final ClassData withDef =
4688                              new ClassData(pck, meth);
4689                          final int I2 = builder.expected;
4690                          final int I1 = builder.methodref;
4691                          final int C2 = builder.addClass(withDef);
4692                          final int C1 = builder.addClass(emptyClass(pck));
4693                          builder.hier.addInherit(C1, I1);
4694                          builder.hier.addInherit(C1, C2);
4695                          builder.hier.addInherit(C2, I2);
4696                          builder.objectref = C1;
4697                          builder.expected = C2;
4698                      },
4699                      /* Case 13: Superclass overrides.
4700                       *
4701                       * I[](*) = mref
4702                       * C2[I](priv) = expected
4703                       * C1[C2]() = oref
4704                       */
4705                      (final SelectionResolutionTestCase.Builder builder) -> {
4706                          final ClassData.Package pck =
4707                              builder.classdata.get(builder.expected).packageId;
4708                          final ClassData oldexpected =
4709                              builder.classdata.get(builder.expected);
4710                          final MethodData meth =
4711                              new MethodData(MethodData.Access.PRIVATE,
4712                                             MethodData.Context.INSTANCE);
4713                          final ClassData withDef =
4714                              new ClassData(pck, meth);
4715                          final int I = builder.methodref;
4716                          final int C2 = builder.addClass(withDef);
4717                          final int C1 = builder.addClass(emptyClass(pck));
4718                          builder.hier.addInherit(C1, I);
4719                          builder.hier.addInherit(C1, C2);
4720                          builder.hier.addInherit(C2, I);
4721                          builder.expected = C2;
4722                          builder.objectref = C1;
4723                      },
4724                      /* Case 14: Superclass overrides.
4725                       *
4726                       * I[](*) = mref
4727                       * C2[I](prot) = expected
4728                       * C1[C2]() = oref
4729                       */
4730                      (final SelectionResolutionTestCase.Builder builder) -> {
4731                          final ClassData.Package pck =
4732                              builder.classdata.get(builder.expected).packageId;
4733                          final ClassData oldexpected =
4734                              builder.classdata.get(builder.expected);
4735                          final MethodData meth =
4736                              new MethodData(MethodData.Access.PROTECTED,
4737                                             MethodData.Context.INSTANCE);
4738                          final ClassData withDef =
4739                              new ClassData(pck, meth);
4740                          final int I = builder.methodref;
4741                          final int C2 = builder.addClass(withDef);
4742                          final int C1 = builder.addClass(emptyClass(pck));
4743                          builder.hier.addInherit(C1, I);


   1 /*
   2  * Copyright (c) 2016, 2018, 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  */


4377                             builder.classdata.get(builder.expected);
4378                          final ClassData withDef =
4379                              new ClassData(pck, oldexpected.methoddata);
4380                          final MethodData meth =
4381                              new MethodData(MethodData.Access.PUBLIC,
4382                                             MethodData.Context.STATIC);
4383                          final ClassData withStatDef =
4384                              new ClassData(pck, meth);
4385                          final int I = builder.methodref;
4386                          final int C3 = builder.addClass(withDef);
4387                          final int C2 = builder.addClass(withStatDef);
4388                          final int C1 = builder.addClass(emptyClass(pck));
4389                          builder.hier.addInherit(C1, I);
4390                          builder.hier.addInherit(C1, C2);
4391                          builder.hier.addInherit(C2, C3);
4392                          builder.hier.addInherit(C2, I);
4393                          builder.expected = C3;
4394                          builder.objectref = C1;
4395                      });
4396 
4397     // NOTE: The selection changes in JVMS 11 mean that private class methods
4398     // are never selected to satisfy an interface method invocation, and so no
4399     // IllegalAccessError is subsequently thrown. Because of this all the
4400     // "private" cases below are commented out. At some point in the future
4401     // these should be factored out and moved to a test that expects success
4402     // but it is not that simple as the commented out cases result in 2600
4403     // testcases being excluded, but only ~150 failing cases were seen. Though
4404     // it is not clear from the test if a single failure can result in further
4405     // testcases being skipped.
4406     public static final Template IfaceMethodrefSelectionOverrideNonPublic =
4407         new Template("IfaceMethodrefSelection",
4408                      /* Case 1: Objectref overrides.
4409                       *
4410                       * I[](*) = mref
4411                       * C[I](priv) = oref = expected
4412                       */
4413                      // (final SelectionResolutionTestCase.Builder builder) -> {
4414                      //     final ClassData.Package pck =
4415                      //         builder.classdata.get(builder.methodref).packageId;
4416                      //     final ClassData oldexpected =
4417                      //         builder.classdata.get(builder.expected);
4418                      //     final MethodData meth =
4419                      //         new MethodData(MethodData.Access.PRIVATE,
4420                      //                        MethodData.Context.INSTANCE);
4421                      //     final ClassData withDef =
4422                      //         new ClassData(pck, meth);
4423                      //     final int I = builder.methodref;
4424                      //     final int C = builder.addClass(withDef);
4425                      //     builder.hier.addInherit(C, I);
4426                      //     builder.objectref = C;
4427                      //     builder.expected = C;
4428                      // },
4429                      /* Case 2: Objectref overrides.
4430                       *
4431                       * I[](*) = mref
4432                       * C[I](prot) = oref = expected
4433                       */
4434                      (final SelectionResolutionTestCase.Builder builder) -> {
4435                          final ClassData.Package pck =
4436                              builder.classdata.get(builder.methodref).packageId;
4437                          final ClassData oldexpected =
4438                              builder.classdata.get(builder.expected);
4439                          final MethodData meth =
4440                              new MethodData(MethodData.Access.PROTECTED,
4441                                             MethodData.Context.INSTANCE);
4442                          final ClassData withDef =
4443                              new ClassData(pck, meth);
4444                          final int I = builder.methodref;
4445                          final int C = builder.addClass(withDef);
4446                          builder.hier.addInherit(C, I);
4447                          builder.objectref = C;
4448                          builder.expected = C;


4458                          final ClassData oldexpected =
4459                              builder.classdata.get(builder.expected);
4460                          final MethodData meth =
4461                              new MethodData(MethodData.Access.PACKAGE,
4462                                             MethodData.Context.INSTANCE);
4463                          final ClassData withDef =
4464                              new ClassData(pck, meth);
4465                          final int I = builder.methodref;
4466                          final int C = builder.addClass(withDef);
4467                          builder.hier.addInherit(C, I);
4468                          builder.objectref = C;
4469                          builder.expected = C;
4470                      },
4471                      /* Case 4: Diamond, with superclass, expected at top,
4472                       * class overriding with private.
4473                       *
4474                       * I2[](*) = mref
4475                       * C2[I2](priv) = expected, I1[I2]()
4476                       * C1[I1,C2]() = oref
4477                       */
4478                      // (final SelectionResolutionTestCase.Builder builder) -> {
4479                      //     final ClassData.Package pck =
4480                      //         builder.classdata.get(builder.expected).packageId;
4481                      //     final ClassData oldexpected =
4482                      //         builder.classdata.get(builder.expected);
4483                      //     final MethodData meth =
4484                      //         new MethodData(MethodData.Access.PRIVATE,
4485                      //                        MethodData.Context.INSTANCE);
4486                      //     final ClassData withDef =
4487                      //         new ClassData(pck, meth);
4488                      //     final int I2 = builder.methodref;
4489                      //     final int I1 = builder.addInterface(emptyClass(pck));
4490                      //     final int C2 = builder.addClass(withDef);
4491                      //     final int C1 = builder.addClass(emptyClass(pck));
4492                      //     builder.hier.addInherit(C1, I1);
4493                      //     builder.hier.addInherit(C1, C2);
4494                      //     builder.hier.addInherit(I1, I2);
4495                      //     builder.hier.addInherit(C2, I2);
4496                      //     builder.objectref = C1;
4497                      //     builder.expected = C2;
4498                      // },
4499                      /* Case 5: Diamond, with superclass, expected at top,
4500                       * class overriding with package private.
4501                       *
4502                       * I2[](*) = mref
4503                       * C2[I2](pack) = expected, I1[I2]()
4504                       * C1[I1,C2]() = oref
4505                       */
4506                      (final SelectionResolutionTestCase.Builder builder) -> {
4507                          final ClassData.Package pck =
4508                              builder.classdata.get(builder.expected).packageId;
4509                          final ClassData oldexpected =
4510                              builder.classdata.get(builder.expected);
4511                          final MethodData meth =
4512                              new MethodData(MethodData.Access.PACKAGE,
4513                                             MethodData.Context.INSTANCE);
4514                          final ClassData withDef =
4515                              new ClassData(pck, meth);
4516                          final int I2 = builder.methodref;
4517                          final int I1 = builder.addInterface(emptyClass(pck));
4518                          final int C2 = builder.addClass(withDef);


4541                                             MethodData.Context.INSTANCE);
4542                          final ClassData withDef =
4543                              new ClassData(pck, meth);
4544                          final int I2 = builder.methodref;
4545                          final int I1 = builder.addInterface(emptyClass(pck));
4546                          final int C2 = builder.addClass(withDef);
4547                          final int C1 = builder.addClass(emptyClass(pck));
4548                          builder.hier.addInherit(C1, I1);
4549                          builder.hier.addInherit(C1, C2);
4550                          builder.hier.addInherit(I1, I2);
4551                          builder.hier.addInherit(C2, I2);
4552                          builder.objectref = C1;
4553                          builder.expected = C2;
4554                      },
4555                      /* Case 7: Y, with superclass, overlaping, expected
4556                       * at top, class overrides
4557                       *
4558                       * C2[](priv) = expected, I1[](*) = mref
4559                       * C1[I1,C2]() = oref
4560                       */
4561                      // (final SelectionResolutionTestCase.Builder builder) -> {
4562                      //     final ClassData.Package pck =
4563                      //         builder.classdata.get(builder.expected).packageId;
4564                      //    final ClassData oldexpected =
4565                      //        builder.classdata.get(builder.expected);
4566                      //     final MethodData meth =
4567                      //         new MethodData(MethodData.Access.PRIVATE,
4568                      //                        MethodData.Context.INSTANCE);
4569                      //    final ClassData withDef =
4570                      //        new ClassData(pck, meth);
4571                      //     final int I1 = builder.methodref;
4572                      //     final int C2 = builder.addClass(withDef);
4573                      //     final int C1 = builder.addClass(emptyClass(pck));
4574                      //     builder.hier.addInherit(C1, I1);
4575                      //     builder.hier.addInherit(C1, C2);
4576                      //     builder.objectref = C1;
4577                      //     builder.expected = C2;
4578                      // },
4579                      /* Case 8: Y, with superclass, overlaping, expected
4580                       * at top, class overrides
4581                       *
4582                       * C2[](prot) = expected, I1[](*) = mref
4583                       * C1[I1,C2]() = oref
4584                       */
4585                      (final SelectionResolutionTestCase.Builder builder) -> {
4586                          final ClassData.Package pck =
4587                              builder.classdata.get(builder.expected).packageId;
4588                         final ClassData oldexpected =
4589                             builder.classdata.get(builder.expected);
4590                          final MethodData meth =
4591                              new MethodData(MethodData.Access.PROTECTED,
4592                                             MethodData.Context.INSTANCE);
4593                         final ClassData withDef =
4594                             new ClassData(pck, meth);
4595                          final int I1 = builder.methodref;
4596                          final int C2 = builder.addClass(withDef);
4597                          final int C1 = builder.addClass(emptyClass(pck));
4598                          builder.hier.addInherit(C1, I1);


4614                          final MethodData meth =
4615                              new MethodData(MethodData.Access.PACKAGE,
4616                                             MethodData.Context.INSTANCE);
4617                          final ClassData withDef =
4618                              new ClassData(pck, meth);
4619                          final int I1 = builder.methodref;
4620                          final int C2 = builder.addClass(withDef);
4621                          final int C1 = builder.addClass(emptyClass(pck));
4622                          builder.hier.addInherit(C1, I1);
4623                          builder.hier.addInherit(C1, C2);
4624                          builder.objectref = C1;
4625                          builder.expected = C2;
4626                      },
4627                      /* Case 10: Diamond, with superclass, overlaping, expected
4628                       * at top, class overrides
4629                       *
4630                       * I2[](def) = old expected
4631                       * C2[I2](priv) = expected, I1[](*) = mref
4632                       * C1[I1,C2]() = oref
4633                       */
4634                      // (final SelectionResolutionTestCase.Builder builder) -> {
4635                      //     final ClassData.Package pck =
4636                      //         builder.classdata.get(builder.expected).packageId;
4637                      //     final ClassData oldexpected =
4638                      //         builder.classdata.get(builder.expected);
4639                      //     final MethodData meth =
4640                      //         new MethodData(MethodData.Access.PRIVATE,
4641                      //                        MethodData.Context.INSTANCE);
4642                      //     final ClassData withDef =
4643                      //         new ClassData(pck, meth);
4644                      //     final int I2 = builder.expected;
4645                      //     final int I1 = builder.methodref;
4646                      //     final int C2 = builder.addClass(withDef);
4647                      //     final int C1 = builder.addClass(emptyClass(pck));
4648                      //     builder.hier.addInherit(C1, I1);
4649                      //     builder.hier.addInherit(C1, C2);
4650                      //     builder.hier.addInherit(C2, I2);
4651                      //     builder.objectref = C1;
4652                      //     builder.expected = C2;
4653                      // },
4654                      /* Case 11: Diamond, with superclass, overlaping, expected
4655                       * at top, class overrides
4656                       *
4657                       * I2[](def) = old expected
4658                       * C2[I2](pack) = expected, I1[](*) = mref
4659                       * C1[I1,C2]() = oref
4660                       */
4661                      (final SelectionResolutionTestCase.Builder builder) -> {
4662                          final ClassData.Package pck =
4663                              builder.classdata.get(builder.expected).packageId;
4664                          final ClassData oldexpected =
4665                              builder.classdata.get(builder.expected);
4666                          final MethodData meth =
4667                              new MethodData(MethodData.Access.PACKAGE,
4668                                             MethodData.Context.INSTANCE);
4669                          final ClassData withDef =
4670                              new ClassData(pck, meth);
4671                          final int I2 = builder.expected;
4672                          final int I1 = builder.methodref;
4673                          final int C2 = builder.addClass(withDef);


4694                              new MethodData(MethodData.Access.PROTECTED,
4695                                             MethodData.Context.INSTANCE);
4696                          final ClassData withDef =
4697                              new ClassData(pck, meth);
4698                          final int I2 = builder.expected;
4699                          final int I1 = builder.methodref;
4700                          final int C2 = builder.addClass(withDef);
4701                          final int C1 = builder.addClass(emptyClass(pck));
4702                          builder.hier.addInherit(C1, I1);
4703                          builder.hier.addInherit(C1, C2);
4704                          builder.hier.addInherit(C2, I2);
4705                          builder.objectref = C1;
4706                          builder.expected = C2;
4707                      },
4708                      /* Case 13: Superclass overrides.
4709                       *
4710                       * I[](*) = mref
4711                       * C2[I](priv) = expected
4712                       * C1[C2]() = oref
4713                       */
4714                      // (final SelectionResolutionTestCase.Builder builder) -> {
4715                      //     final ClassData.Package pck =
4716                      //         builder.classdata.get(builder.expected).packageId;
4717                      //     final ClassData oldexpected =
4718                      //         builder.classdata.get(builder.expected);
4719                      //     final MethodData meth =
4720                      //         new MethodData(MethodData.Access.PRIVATE,
4721                      //                        MethodData.Context.INSTANCE);
4722                      //     final ClassData withDef =
4723                      //         new ClassData(pck, meth);
4724                      //     final int I = builder.methodref;
4725                      //     final int C2 = builder.addClass(withDef);
4726                      //     final int C1 = builder.addClass(emptyClass(pck));
4727                      //     builder.hier.addInherit(C1, I);
4728                      //     builder.hier.addInherit(C1, C2);
4729                      //     builder.hier.addInherit(C2, I);
4730                      //     builder.expected = C2;
4731                      //     builder.objectref = C1;
4732                      // },
4733                      /* Case 14: Superclass overrides.
4734                       *
4735                       * I[](*) = mref
4736                       * C2[I](prot) = expected
4737                       * C1[C2]() = oref
4738                       */
4739                      (final SelectionResolutionTestCase.Builder builder) -> {
4740                          final ClassData.Package pck =
4741                              builder.classdata.get(builder.expected).packageId;
4742                          final ClassData oldexpected =
4743                              builder.classdata.get(builder.expected);
4744                          final MethodData meth =
4745                              new MethodData(MethodData.Access.PROTECTED,
4746                                             MethodData.Context.INSTANCE);
4747                          final ClassData withDef =
4748                              new ClassData(pck, meth);
4749                          final int I = builder.methodref;
4750                          final int C2 = builder.addClass(withDef);
4751                          final int C1 = builder.addClass(emptyClass(pck));
4752                          builder.hier.addInherit(C1, I);


< prev index next >