Java Annotations

Annotations as metadata that only means something if code reads it: retention policies and what each one costs, targets and where an annotation on a record component actually lands, @Inherited and its limits, marker interfaces versus marker annotations, @Override as a correctness check rather than decoration, and the gap between annotating something and enforcing it. Use when defining a custom annotation, when an annotation appears to have no effect, when validation or security annotations are trusted without a validator or a proxy invoking them, when @Override is missing on an override, when a naming convention encodes behaviour that an annotation should carry, when annotation scanning slows startup or breaks under native image, or when deciding between a marker interface and a marker annotation. Does not cover nullability annotation contracts (java-null-safety), reflective access mechanics (java-reflection-and-method-handles), or the enum type itself (java-enums).

robsonkades 49e310c 4 files · 27.3 KB Updated

File contents

robsonkades/agent-skills/tree/main/skills/java-annotations commit 49e310c19e

Frequently asked questions

npx skillmds@latest add robsonkades/java-annotations