Class CapabilityClasspathValidator
- All Implemented Interfaces:
Validator
@Capability-annotated
interface implemented by an attached role can be fully reflected
upon at build time.
The common shape — class MyRole implements Summarizer
where Summarizer is a @Capability interface — is
already protected by the JVM: if Summarizer were missing
from the classpath, MyRole's class loader would fail
before the role was ever attached. So the trivial "interface
loaded?" check is moot.
What this validator catches is the subtler packaging miss:
- The capability interface loads, but one of its method's
parameter or return types references a class only available
in a sibling jar that was excluded from the deployment
artifact. Java loads parameter / return types lazily, so
class MyRole implements Summarizercan succeed even whenSummarizer.summarize(SummaryOptions)would throwNoClassDefFoundErroron first reflection. - The capability interface declares an annotation whose value
references a missing class —
getAnnotation()throwsTypeNotPresentExceptionat first lookup.
Today these surface at first dispatch as a stack trace whose
root cause is far from the actual configuration mistake; this
validator surfaces them at build() time with the offending
role + capability + missing-type in the issue context.
Scope: walks every role's class, filters
getInterfaces() to @Capability-annotated
interfaces, and for each one attempts to enumerate methods,
resolve generic parameter / return types, and read annotations.
Anything that throws TypeNotPresentException,
NoClassDefFoundError, or LinkageError during that
walk produces an ERROR.
Suppress with AgentBuilder.relaxValidation("AGENT-V007")
— useful when the operator deliberately ships a slimmed-down
deployment and accepts that some capability methods will never be
dispatched at runtime.
- Since:
- 0.5.0 (issue #85 slice)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionid()Short, stable id for logging and test assertions (e.g.Inspect the agent configuration and return any issues detected.
-
Constructor Details
-
CapabilityClasspathValidator
public CapabilityClasspathValidator()
-
-
Method Details
-
id
Description copied from interface:ValidatorShort, stable id for logging and test assertions (e.g."llm-presence"). -
validate
Description copied from interface:ValidatorInspect the agent configuration and return any issues detected. Returning an empty list means "no problems found by this validator".
-