Reports redundant creation of date/time objects using java.time classes when simpler method calls can be used or creation can be avoided.

The main java.date classes are marked as @jdk.internal.ValueBased. Such creations should be avoided as these classes are designed to be used in a value-based manner.

Example:


LocalDateTime now = LocalDateTime.now();
return LocalDateTime.from(now);

After the quick-fix is applied:


LocalDateTime now = LocalDateTime.now();
return now;

New in 2024.3