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

TypeFieldWhat it holds
u1tag20
u2name_indexa 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:

OffsetBytesFieldValue
1203 bytes#13 Packagedemo/api
12014tag20 (Package)
12100 0ename_index#14

Open in the viewer

Specification: JVMS §4.4, CONSTANT_Package_info (Java SE 25).