On Fri, 14 Oct 2022 17:12:51 GMT, Mandy Chung <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
>> line 291:
>>
>>> 289: final List<ClassData> cd = classData;
>>> 290: return switch(cd.size()) {
>>> 291: case 0 -> null;
>>
>> `List.of()` always returns the same singleton instance and does not cause
>> any object allocation. I prefer to keep the `classDataValues()` to return
>> `List<Object>`
>
> Ah, I now see why you have to change the signature because of the single
> element case. I made my comment too quickly.
>
> A couple of suggestions:
> Please add a javadoc for this method to describe what this method returns for
> different cases. It's better to move this method close to `clinit` as they
> are tightly coupled.
I moved the method and added in javadoc. Could you check if the wording is OK?
-------------
PR: https://git.openjdk.org/jdk/pull/10706