On Sep 13, 2021, at 10:24 AM, Vladimir Ivanov <vliva...@openjdk.java.net<mailto:vliva...@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.