3.15. Annotations

The representation of annotations in class files is described in §4.7.16 and §4.7.17, which make it clear how to represent annotations on types, fields, and methods in the class file format. Package annotations require additional rules, given here.

When the compiler encounters an annotated package declaration that must be made available at run time, it emits a class file that represents an interface whose name is the internal form (§4.2.1) of package-name.package-info. The interface has default access (JLS §6.6.1) and no superinterfaces. The ACC_INTERFACE and ACC_ABSTRACT flags (Table 4.1) of the ClassFile structure (§4.1) are set. If the emitted class file version number is less than 50.0, then the ACC_SYNTHETIC flag is unset; ...

Get The Java® Virtual Machine Specification, Java SE 7 Edition, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.