-
Notifications
You must be signed in to change notification settings - Fork 0
Adding and managing interfaces
hydrophobis edited this page Mar 25, 2025
·
1 revision
These functions manage the interfaces section of the Java class file. This section lists interfaces implemented by the class.
-
void interfaces_start()
Initializes the interfaces section. Reserves space for theinterfaces_countand starts the counter at0. -
void interfaces_end()
Finalizes the interfaces section by patching the total entry count at the reserved location.
-
Interface Reference →
interface_entry(uint16_t interface_val)
Adds an interface reference to the section. Increments the counter.
-
void patch_u2(size_t pos, uint16_t v)
Updates a 2-byte value in the buffer (used to finalizeinterfaces_count).
interfaces_start();
interface_entry(1); // Adds an interface reference to the first object in the constant pool
interface_entry(2); // Adds another interface reference to the second
interfaces_end();This will generate an interfaces section with two entries.