Title: Theory / Unimportant / CS / Programming / Java / Annotation
Tags: declaration todo_declaration automatedNewLineAfterCommaSpace seen_description empty_card_tonames empty_card_tonotations

Name: Annotation
Definition: a form of metadata, provide data about a program that is not part of the program itself
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Context: java
Denoted by: starting with @

Name: Element
Definition: A parameter to the annotation call
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Context: java annotation

Instruction: ()
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Effect: Call the annotation with no argument
Language: java
Context: @AnnotationName
Abbreviation: nothing

Instruction: (foo)
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Effect: Call the annotation with its only element being set at foo
Language: java
Context: @AnnotationName

Instruction: (
  elt_1 = value_1,
  ...,
  elt_n = value_n
)
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Effect: Call the annotation with element elt_n at value value_n
Language: java
Context: @AnnotationName

Name: A repeating annotation
Definition: Multiple annotation having the same type
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Context: java

Name: Type annotation
Definition: An annotation that applies to a type
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Context: java

Question: On what are annotations are applied
Answer: Declarations
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Context: java
Answer2: type (for type declarations)

Instruction: @interface AnnotationName {
  ..
}
Page: https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
Meaning: Declare an annotation type of the name AnnotationName
Language: java

Instruction: type var();
Page: https://docs.oracle.com/javase/tutorial/java/annotations/declaring.html
Meaning: Declare that AnnotationName has a mandatory element var of type type
Language: java
Context: @interface AnnotationName {
  ..
}

Instruction: type var() default value;
Page: https://docs.oracle.com/javase/tutorial/java/annotations/declaring.html
Meaning: Declare that AnnotationName has a element var of type type. If it is absent, its value is value
Language: java
Context: @interface AnnotationName {
  ..
}

Instruction: @Documented
Page: https://docs.oracle.com/javase/tutorial/java/annotations/declaring.html
Effect: Indicate that all elements of this annotation should be outputed in javadoc as documentation
Language: java
Context: @interface AnnotationName {
  ..
}

Instruction: @Deprecated
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: If the annotated element is used, a warning will appear stating that it is deprecated
Language: java

Instruction: @Override
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: Warns if the annotated method does not override another method
Language: java

Instruction: @SuppressWarning("foo")
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: Ensure that compiler do not generate a warning of category foo
Language: java

Instruction: @SuppressWarning({
  "foo_1",
  ...,
  "foo_n"
})
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: Ensure that compiler do not generate a warning of category foo_i
Language: java

Instruction: @SafeVarargs
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: asserts that the code does not perform potentially unsafe operations on its varargs parameter. When this annotation type is used, unchecked warnings relating to varargs usage are suppressed.
Language: java

Instruction: @FunctionalInterface
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: indicates that the type declaration is intended to be a functional interface, as defined by the Java Language Specification.
Language: java

Name: A meta annotation
Definition: An annotation applied to other annotations
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Context: java

Instruction: @Retention(RetentionPolicy.SOURCE)
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: Indicate that the annotation is not used by the compiler
Language: java

Instruction: @Retention(RetentionPolicy.CLASS)
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Meaning: Indicate that the annotation is used by compiler but not by virtual machine
Language: java

Instruction: @Retention(RetentionPolicy.RUNTIME)
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: Indicate that the annotation are kept at runtime
Language: java

Instruction: @Target({})
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: Indicate that the annotation its applied to can't be used on elements but only as a member type in a complex annotation type declarations
Language: java

Instruction: @Target({
  type1,
  ...,
  type_n
})
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: Indicate that the annotation can only be applied to elements of type type_i
Language: java

Instruction: @Inherited
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: This annotation is inherited when applied to class, unless the same child class have the same annotation
Language: java
Context: meta-annotation

Instruction: @Repeatable(Annotations)
public @interface Annotation {
...
}
public @interface Annotations {
  Annotation[] value();
}
Page: https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html
Effect: indicates that Annotation can be applied more than once to the same declaration or type use. If Annotation is used on a declaration, then Annotations is also used and contain the list of application of Annotation
Language: java
Context: meta-annotation