Browse by Topic

Popular

Latest

Latest Java Posts

A diagram showing multiple annotation tags being grouped into a single container annotation in Java.
Java

Java Repeatable Annotations: Syntax and Usage

How to declare and read repeatable annotations in Java, including container annotation requirements and reflection usage.

JavaAnnotationsReflectionJava 8
A Java class hierarchy with an @Inherited annotation propagating from a base class to a subclass, shown as a diagram.
Java

Java Inherited Annotation: @Inherited Explained

How Java's @Inherited meta-annotation controls inherited class-level annotations: behavior, limitations, and reflection resolution.

Java annotations@Inheritedmeta-annotationsreflection
Diagram showing Java @Target annotation restricting annotation placement to specific Java elements like methods and fields.
Java

Java @Target Annotation: Restricting Where Annotations Apply

Learn how Java's @Target meta-annotation restricts where custom annotations can be applied, with ElementType values, code examples, and common pitfalls.

Java annotationsmeta-annotationcustom annotationsElementType
Diagram showing the three retention policies of a Java annotation: source, class, and runtime, with visibility levels.
Java

Java Retention Annotation: How to Control Annotation Lifecycle

Understand how Java's @Retention meta-annotation controls whether annotations are available in source code, compiled class files, or at runtime, and how to choose the right policy.

Java annotationsReflectionAnnotation processingMeta-annotations
Diagram showing a Java annotation declaration with retention and target attributes.
Java

Java Annotation Declaration: Syntax and Usage

Learn how to declare custom annotations in Java, set retention and target, define elements, and process them with reflection.

JavaAnnotationsReflectionCustom Annotations
Diagram showing a Java annotation being attached to a method symbol and processed by a reflective reader at runtime.
Java

Java Custom Annotation: Syntax, Retention, and Processing

Learn how to create Java custom annotations, control their retention and targets, and process them at runtime with reflection.

annotationsreflectionmetaprogrammingjava
Diagram showing the @SuppressWarnings annotation applied to a Java method to suppress compiler warnings.
Java

Java SuppressWarnings: When and How to Use It

Learn how to use Java's @SuppressWarnings annotation: syntax and placement, common warning names, and when suppressing a compiler warning is justified versus when it hides real problems.

annotationcompiler warningscode qualityunchecked warnings
A Java code editor showing a deprecated method with a warning marker and a replacement suggestion.
Java

Using @Deprecated in Java to Manage API Evolution

Learn how to use Java's @Deprecated annotation to mark outdated APIs, manage compiler warnings, and plan API removal.

Java@DeprecateddeprecationAPI design
Illustration of Java built-in annotations like @Override and @Deprecated with compiler checks
Java

Java Built-In Annotations: Usage and Pitfalls

Learn how Java's built-in annotations @Override, @Deprecated, @SuppressWarnings, @FunctionalInterface, and @SafeVarargs work, including retention, targets, and common mistakes.

Java annotations@Override@Deprecated@SuppressWarnings
Diagram showing Java annotation syntax elements such as @interface, retention, target, and reflection processing.
Java

Java Annotation Syntax: Declaring and Using Annotations

Learn the exact syntax for declaring and using Java annotations, including retention policies, target restrictions, and runtime reflection processing.

JavaAnnotationsReflectionMetadata