Describe the bug
SpanLimitsBuilder documents five setters as requiring a positive argument, but the code accepts zero. The Javadoc contract does not match the actual behavior.
Steps to reproduce
SpanLimits.builder().setMaxNumberOfAttributes(0); // Javadoc says this throws; it does not
What did you expect to see?
Javadoc that matches the real behavior. The >= 0 check is intentional (PR #7030 relaxed it to follow the spec, which allows 0), so the Javadoc should say the argument must not be negative.
What did you see instead?
setMaxNumberOfAttributes, setMaxNumberOfEvents, setMaxNumberOfLinks, setMaxNumberOfAttributesPerEvent, and setMaxNumberOfAttributesPerLink (SpanLimitsBuilder.java) each say @param ... Must be positive. and @throws IllegalArgumentException if {@code ...} is not positive., but each calls Utils.checkArgument(value >= 0, "... must be non-negative"). Passing 0 is accepted. The sixth setter, setMaxAttributeValueLength, already documents the same >= 0 check correctly as "Must not be negative" / "is negative".
What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-trace
Version: main @ 824334c
How did you reference these artifacts? N/A (source inspection)
Environment
Compiler: Temurin 21
OS: N/A
Additional context
Fix is Javadoc-only, no behavior change. Related: PR #7030.
Describe the bug
SpanLimitsBuilderdocuments five setters as requiring a positive argument, but the code accepts zero. The Javadoc contract does not match the actual behavior.Steps to reproduce
What did you expect to see?
Javadoc that matches the real behavior. The
>= 0check is intentional (PR #7030 relaxed it to follow the spec, which allows 0), so the Javadoc should say the argument must not be negative.What did you see instead?
setMaxNumberOfAttributes,setMaxNumberOfEvents,setMaxNumberOfLinks,setMaxNumberOfAttributesPerEvent, andsetMaxNumberOfAttributesPerLink(SpanLimitsBuilder.java) each say@param ... Must be positive.and@throws IllegalArgumentException if {@code ...} is not positive., but each callsUtils.checkArgument(value >= 0, "... must be non-negative"). Passing 0 is accepted. The sixth setter,setMaxAttributeValueLength, already documents the same>= 0check correctly as "Must not be negative" / "is negative".What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-trace
Version: main @ 824334c
How did you reference these artifacts? N/A (source inspection)
Environment
Compiler: Temurin 21
OS: N/A
Additional context
Fix is Javadoc-only, no behavior change. Related: PR #7030.