RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

John Rose john.r.rose at oracle.com
Wed Sep 22 00:13:39 UTC 2021


On Sep 13, 2021, at 10:24 AM, Vladimir Ivanov <vlivanov at openjdk.java.net<mailto:vlivanov at openjdk.java.net>> wrote:

BTW it can be improved even further by caching the immutable List view of parameters.

I would go further:  If I were writing MethodType.java today
I would probably use List.of as the backing store for the
parameters, instead of the private array.  So ptypes should
be List<Class<?>> not Class<?>[].  I don’t think the footprint
or polymorphism effects would be dealbreakers, and the
code would (I think) be simpler overall.  But that’s a messy
change, since the array representation is dug in.



More information about the core-libs-dev mailing list