On Thu, 26 Jun 2025 18:40:59 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> It can be also written as:
>> `return ClassFile.of().transform(classModel, ClassDesc.of(newClassName), 
>> ClassTransform.ACCEPT_ALL`
>> 
>> But be aware this code does not change the class name use anywhere in the 
>> code, descriptors, handles, annotation, etc..., just the class name itself.
>> 
>> Full class remapping was a job of 
>> https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/lang/classfile/components/ClassRemapper.html
>>  which unfortunately didn't make it from 23 preview to 24 :(
>
> Yes, I wanted to use the ClassRemapper but all the tests that used 
> RedefineClassHelper would have had to add @modules.  We can change it later 
> when ClassRemapper becomes available without adding modules.

> the lambda just copies everything over as-is.
..
> But be aware this code does not change the class name use anywhere in the 
> code, descriptors, handles, annotation, etc..., just the class name itself.

@coleenp don't we need to class name to be changed everywhere it appears in the 
classfile? Or do we know these classes are trivial enough that there is only a 
single occurrence of the name (and everything else is symbolic via the constant 
pool) ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25857#discussion_r2170732353

Reply via email to