On Mon, 3 Apr 2023 19:26:13 GMT, Mandy Chung <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 2536:
>>
>>> 2534: }
>>> 2535: } else {
>>> 2536: name += ".failed-" +
>>> dumper.incrementAndGetCounter();
>>
>> I think it makes more sense to move the counter to `ClassDefiner`. It is not
>> used by `ClassFileDumper` itself.
>>
>> (make it `static` if it's possible to have multiple definer instances with
>> the same class name)
>
> I see your point. If it were a static counter for all dumpers,
> multiple`.failed-xxx` dumped by a single dumper may not be in sequence if
> other dumpers have `.failed-xxx` class files.
If the counter has to be per dumper, maybe it makes sense to push the logic
that derives the file name into ClassFileDumper too. e.g. have a
`dumpClass(name, Class<?>, bytes)` and `dumpFailed(name, bytes)`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13182#discussion_r1156387213