Skip to content

Code generation resilience

View Markdown

Status: Stable Package: dev.vertique.codegen.resilience Artifact: vertique-codegen-resilience Depends on: vertique-resilience, vertique-codegen-core API 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().

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.

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.

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 @ServiceContract or REST-client interfaces;
  • proxyability through the shared ProxyabilityValidator, including public, non-final, Dagger-managed classes with one @Inject constructor and overridable instance methods;
  • concrete Future<T> return types using the shared CodegenContext.unwrapFuture classifier; 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.

./mvnw -ntp -pl vertique-codegen/vertique-codegen-resilience,vertique-codegen-all -am verify
Artifact Purpose
vertique-resilience @Resilient and resilience declaration annotations
vertique-codegen-core Shared annotation-processing context, diagnostics, Future classifier, and proxyability validator