---
type: archive
area: archive
status: archived
date: 2026-05-03
created: 2026-05-03
updated: 1980-01-01
tags:
  - archive
---
- Annotation a form of metadata.

- Types of annotations:
	-  SOURCE : just exist in src code ignored by compiler
	- CLASS : retained by compiler but ignored by JVM
	- RUNTIME :  is retained by the JVM and readable at run time.
- An element of an annotation can have a default value (that can be a constant)

- Some Important annotation to use when defining annotation
	- @Retention(RetentionPolicy.(...))
	- @Target(Element.TYPE) 
	- (Optionnal) @Reapeatable(CLassName)

- Value element does not have to be specified by name
- Annotations are not Inherited unless the annotation is marked as inherited
- We can decide if a annotation is documented or not.
- We can use some methods to interact with annotations and use them for a specific processing.

#### Some Frequently used annotations:
	- @FunctionalInterface
		- Verify that interface contain only 1 abstract method
	- @Override
		- Check that Method is truely overrided
	- @Depracted
		- To warn people that never use this method 
	- @SuppressWarnings
		- Delete warnings tha compiler give us
	- @SafeVarargs
		- used when methods can cause Heap Pollution
		- used when a methods used indefined number of arguments 
		- methods when we use should be final or private because overriden method can not be safe Heap Pollution

- Heap Pollution incorrect use if varargs with generics .
- varargs when passing to a method indefined number of parameters.
