Processor safety rules
Method and class shapes that the static proxy processors refuse to generate code for, and why.
The static-proxy processors fail compilation for method and class shapes that
cannot be safely proxied. The rules are intentional: a proxy that silently
misses a method or one that pretends to override final would do more harm
than refusing the build.
What is refused
finalclasses annotated for static proxy generation. The generated class needs to extend or implement the target type. Afinalclass cannot be extended; an interface declaredfinalis a compile error anyway, so this rule mainly catchesfinalimplementations being annotated by mistake.finalmethods. A generated proxy must override every interface method. Overridingfinalis not allowed.privatemethods. A proxy cannot interpose on a private call. If you see this finding, move the method to a different surface or strip the annotation off the type.staticmethods. Static methods cannot be overridden, so the proxy cannot interpose on them. The processor refuses by default. Use-Aproxybuilder.failOnStaticMethods=falseto downgrade the finding to a warning if you have a legacy interface mixing instance and static methods.
What is not generated as proxy methods
Methods declared by java.lang.Object are skipped — the generated class
inherits them through normal Java inheritance. Specifically:
equalshashCodetoStringfinalizewait,notify,notifyAllgetClass
If you want a logging or metrics wrapper around toString for debugging,
write a @StaticLoggingProxy-equivalent custom processor that opts in to
those methods explicitly.
Where the diagnostics show up
Findings are emitted through processingEnv.getMessager(). They appear in
the Maven build log with the file and line of the offending element, and
they fail the build at the compile phase.
How to override
Aside from the failOnStaticMethods flag, the rules are non-negotiable by
design. If you have a legitimate reason to relax one, write a custom
processor that does not subclass BasicStaticProxyAnnotationProcessor and
implements its own safety checks (or none).