Code generation resilience
View MarkdownStatus: Stable Package:
dev.vertique.codegen.resilienceArtifact:vertique-codegen-resilienceDepends on:vertique-resilience,vertique-codegen-coreAPI reference: javadoc.io
vertique-codegen-resilience is the build-time module boundary for validating
@Resilient and its retry, timeout, circuit-breaker, and bulkhead declarations.
It is an annotation-processor artifact, not a runtime dependency. The processor
generates no sources and always returns false from process().
When To Use It
Section titled “When To Use It”Put this artifact on the annotation-processor path of an application that uses
the resilience annotations, alongside vertique-codegen-aop. Applications
declare vertique-resilience separately at runtime. The vertique-codegen-all
facade includes this processor transitively.
Key Classes
Section titled “Key Classes”ResilienceAnnotationProcessor
Section titled “ResilienceAnnotationProcessor”AbstractProcessor registered via META-INF/services/javax.annotation.processing.Processor.
@SupportedAnnotationTypes({ "dev.vertique.resilience.annotation.Resilient", "dev.vertique.resilience.annotation.Retry", "dev.vertique.resilience.annotation.Timeout", "dev.vertique.resilience.annotation.CircuitBreaker", "dev.vertique.resilience.annotation.Bulkhead"})@SupportedSourceVersion(SourceVersion.RELEASE_21)Validates the resilience annotation family and generates no sources. Always
returns false from process() so Dagger, Lombok, vertique-codegen-aop, and
other processors still see the same elements. See Validation Rules.
Validation Rules
Section titled “Validation Rules”The registered ResilienceAnnotationProcessor validates:
- policy names against
[A-Za-z0-9._~-]{1,128}; - retry, timeout, circuit-breaker, and bulkhead value bounds on every placement, including interfaces;
- method-level anchors and the rule that concrete-class declarations must be
on the same method as
@Resilient; - interface anchors only on
@ServiceContractor REST-client interfaces; - proxyability through the shared
ProxyabilityValidator, including public, non-final, Dagger-managed classes with one@Injectconstructor and overridable instance methods; - concrete
Future<T>return types using the sharedCodegenContext.unwrapFutureclassifier; and - duplicate resilience wrapping between a services contract and its concrete handler or implementor, with service types detected by fully qualified name.
The four declaration annotations are configuration inputs only. They are not aspects by themselves, and this processor does not emit proxies or metadata.
Verification
Section titled “Verification”./mvnw -ntp -pl vertique-codegen/vertique-codegen-resilience,vertique-codegen-all -am verifyDependencies
Section titled “Dependencies”| Artifact | Purpose |
|---|---|
vertique-resilience |
@Resilient and resilience declaration annotations |
vertique-codegen-core |
Shared annotation-processing context, diagnostics, Future classifier, and proxyability validator |