RFR: JDK-8282798 java.lang.runtime.Carrier

Jens Li duke at openjdk.java.net
Tue Mar 8 18:55:08 UTC 2022


On Tue, 8 Mar 2022 14:02:39 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

> We propose to provide a runtime anonymous carrier class object generator; java.lang.runtime.Carrier. This generator class is designed to share anonymous classes when shapes are similar. For example, if several clients require objects containing two integer fields, then Carrier will ensure that each client generates carrier objects using the same underlying anonymous class. 
> 
> See JBS for details.

test/jdk/java/lang/runtime/CarrierTest.java line 45:

> 43:     }
> 44: 
> 45:     static void assertTrue(boolean test, String message) {

This test does not use TestNG like the other tests in the package. Is that intentional?

(Please tell me if its weird that I as a total rando pops in and makes comments here!)

test/jdk/java/lang/runtime/CarrierTest.java line 143:

> 141:             MethodHandle constructor = Carrier.constructor(methodType);
> 142:         } catch (IllegalArgumentException ex) {
> 143:             passed = true;

There is `Assert.assertThrows` for this kind of assertions if TestNG is used.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7744


More information about the core-libs-dev mailing list