On Fri, 13 Sep 2024 23:51:23 GMT, Claes Redestad <redes...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 2223:
>> 
>>> 2221:             }
>>> 2222: 
>>> 2223:             return makeHiddenClassDefiner(bytes.clone(), false, 
>>> options.clone())
>> 
>> Why do we need to clone here, but not in `defineHiddenClass`? 
>> `makeHiddenClassDefiner` seems to always turn the options in flags right 
>> away, so I don't think we need to clone?
>
> I started out adding the .clone() as a standard precaution, analyzed to make 
> sure it wasn't needed then removed it in one out of two places. Now both 
> removed.

The public methods used to throw `IllegalArgumentException` when duplicate 
class options were passed though, as a result of using [`Set.of(…)`].

[`Set.of(…)`]: 
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Set.html#of(E...)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21002#discussion_r1759690770

Reply via email to