@Retention(value=CLASS) @Target(value={METHOD,FIELD,PARAMETER,LOCAL_VARIABLE,TYPE_USE}) public @interface NonNegative
@NonNegative declares that the annotated value must be zero or
positive. It aids library maintainers and analysis tools in enforcing
numerical contracts.
Retention and effect: Stored in the class file but ignored by the runtime unless Chronicle tooling checks it.
@NonNegative long size;
| Annotation | Constraint |
|---|---|
Negative | val < 0 |
NonPositive | val <= 0 |
@NonNegative | val >= 0 |
Positive | val > 0 |
void setSize(@NonNegative int size) {
assert size >= 0;
}
These annotations are advisory and may be enforced with
ChronicleAssertions or Java assert.
Negative,
NonPositive,
Positive,
Rangepublic abstract String value
Copyright © 2026 Chronicle Software Ltd. All rights reserved.