RFR: 8340131: Refactor internal makeHiddenClassDefiner to take ClassOption ... instead of Set [v2]

Claes Redestad redestad at openjdk.org
Fri Sep 13 23:54:05 UTC 2024


On Fri, 13 Sep 2024 15:57:41 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with six additional commits since the last revision:
>> 
>>  - no clone
>>  - Update src/java.base/share/classes/java/lang/invoke/MethodHandles.java
>>    
>>    Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
>>  - Update src/java.base/share/classes/java/lang/invoke/MethodHandles.java
>>    
>>    Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
>>  - Update src/java.base/share/classes/java/lang/invoke/MethodHandles.java
>>    
>>    Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
>>  - Update src/java.base/share/classes/java/lang/invoke/MethodHandles.java
>>    
>>    Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
>>  - Update src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
>>    
>>    Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
>
> 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.

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

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


More information about the core-libs-dev mailing list