On Fri, 13 Dec 2024 15:57:31 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:

> > if no agents are loaded, I would print "JVMTI agents: none" 
> > unconditionally. Makes it more obvious than just a missing entry; >that 
> > could be also an error.
> 
> Maybe after the while loop something like this ?
> 
> ```
>   bool first_agent = true;
>   while (it.has_next()) {
>       ...
>   }
>   **if (first_agent) st->print_cr("JVMTI agents: none");**
> ```

You can do it before the loop:

if (it.has_next()) {
  st->print_cr("JVMTI agents:");
} else {
  st->print_cr("JVMTI agents: none");
}

and get rid of `first_agent` variable

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

PR Comment: https://git.openjdk.org/jdk/pull/22706#issuecomment-2542400056

Reply via email to