Annotations don't directly affect program semantics
They can affect treatment by tools and libraries
Can be read from: source, class file, or reflectively
Examples: transient, @deprecated
Notes:
Why Metadata?
• Many APIs require a fair amount of boilerplate
─ Example: JAX-RPC web service requires
paired interface and implementation
─ Boilerplate could be generated automatically
• Many APIs require “side files� to be maintained
─ Examples: BeanInfo class, deployment descriptor
─ Information could be maintained in program
• Many APIs use naming patterns
─ Example: JUnit
─ Naming pattern could be replace by annotation