A class that the framework subclasses at run time is final, or an entity has final methods

tx0/java:final-proxied-classdefaulterrorbug

What it finds

Spring subclasses @Configuration classes so that calls between @Bean methods return the shared bean, and JPA providers subclass entities to load them lazily. A final class cannot be subclassed, so Spring refuses to start, and a final method of an entity cannot be intercepted, so it reads fields that were never loaded.

Reported is a final class annotated @Configuration, unless it sets proxyBeanMethods to false, or @Entity, @Embeddable or @MappedSuperclass, and a final instance method of such an entity class that is not private.

From the rule's source, final_proxied_class.rs.

Example from the rule's tests
import javax.persistence.Entity;import org.springframework.context.annotation.Configuration; @Configurationfinal class AppConfig {}tx0 reports: cannot be final @Configuration(proxyBeanMethods = false)final class LiteConfig {} @Entityclass Order {  public final long total() {tx0 reports: cannot be intercepted    return 0;  }   private final long hidden() {    return 0;  }}
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 in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/java:final-proxied-class" = "off"

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:final-proxied-class] reason="..."

tx0 explain tx0/java:final-proxied-class shows the same in the terminal. Found a false positive? Report it.