On Fri, 16 Aug 2024 04:46:13 GMT, Chen Liang <[email protected]> wrote:
>> test/jdk/java/lang/reflect/Generics/TestMissingTypeVariable.java line 43:
>>
>>> 41: public class TestMissingTypeVariable {
>>> 42:
>>> 43: public static void main(String[] args) throws Exception {
>>
>> To make the test more understandable to casual readers, I suggest putting
>> the corresponding source code, as much as possible, as a comment.
>
> An alternative approach could be to write a package-private or nested class
> in the same file:
>
> static class Generic<T> {
> T field;
> }
>
> // ...
>
> var cf = ClassFile.of();
> var generic = cf.parse(Path.of(System.getProperty("test.classes"),
> "TestMissingTypeVariable$Generic.class"));
> var result = cf.transformClass(generic, ClassTransform.dropping(ce -> ce
> instanceof SignatureAttribute);
> var missing = ByteCodeLoader.load("TestMissingTypeVariable$Generic", result);
> // proceed
>
>
> Would be more straightforward to readers.
I added a comment, I think that makes it clearest.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20535#discussion_r1763447133