CONSTANT_InterfaceMethodref tag 11
A reference to a method of an interface.
- Tag
11- Since
- class file 45.0 (Java 1.0)
- Size
- 5 bytes
- Loadable
- no
- Referred to by
- invokeinterface
- invokestatic and invokespecial on interface methods (Java 8 and later)
- MethodHandle entries of kinds 6, 7 and 9
Layout
| Type | Field | What it holds |
|---|---|---|
u1 | tag | 11 |
u2 | class_index | a Class that is an interface |
u2 | name_and_type_index | a NameAndType |
What it is for
A reference to a method of an interface. The JVM checks the tag matches the class: using a Methodref for an interface method throws IncompatibleClassChangeError.
How common it is
JDK 25.0.5's java.base has 14,940 InterfaceMethodref constants in 2,857 of its 7,391 classes: 1.4% of all 1,059,609 constants.
A real one, byte by byte
Constant #7 of Boxing.class, compiled by javac 25:
| Offset | Bytes | Field | Value |
|---|---|---|---|
| 57 | 5 bytes | #7 InterfaceMethodref | java/util/List.iterator:()Ljava/util/Iterator; |
| 57 | 0b | tag | 11 (InterfaceMethodref) |
| 58 | 00 08 | class_index | #8 |
| 60 | 00 09 | name_and_type_index | #9 |
Specification: JVMS §4.4, CONSTANT_InterfaceMethodref_info (Java SE 25).