A garbage collection is requested from code

tx0/java:explicit-gcrecommendedwarningperformance

What it finds

System.gc() asks for a full garbage collection. The collector knows better when to run, a forced collection can stop every thread for a long time, and with -XX:+DisableExplicitGC the call does nothing at all, so code that relies on it behaves differently from one deployment to the next.

From the rule's source, explicit_gc.rs.

Example from the rule's tests
class Memory {  void clean() {    System.gc();tx0 reports: a garbage collection is forced here    Runtime.getRuntime().gc();tx0 reports: a garbage collection is forced here  }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/java:explicit-gc" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/java:explicit-gc] reason="..."

tx0 explain tx0/java:explicit-gc shows the same in the terminal. Found a false positive? Report it.