CONSTANT_Package tag 20
A package exported or opened by a module, by its internal name (demo/api).
- Tag
20- Since
- class file 53.0 (Java 9)
- Size
- 3 bytes
- Loadable
- no
- Referred to by
- the Module attribute (exports and opens)
- the ModulePackages attribute
Layout
| Type | Field | What it holds |
|---|---|---|
u1 | tag | 20 |
u2 | name_index | a Utf8 package name in internal form, with slashes |
What it is for
A package exported or opened by a module, by its internal name (demo/api). Like Module, it may appear only in module-info.class.
How common it is
JDK 25.0.5's java.base has 196 Package constants in 1 of its 7,391 classes: 0.02% of all 1,059,609 constants.
A real one, byte by byte
Constant #13 of module-info.class, compiled by javac 25:
| Offset | Bytes | Field | Value |
|---|---|---|---|
| 120 | 3 bytes | #13 Package | demo/api |
| 120 | 14 | tag | 20 (Package) |
| 121 | 00 0e | name_index | #14 |
Specification: JVMS §4.4, CONSTANT_Package_info (Java SE 25).