Class HolderAccessors
- java.lang.Object
-
- net.openosrs.api.identity.HolderAccessors
-
public final class HolderAccessors extends java.lang.ObjectRead access to game values kept in constant-dynamicString[]holders.Some builds store a credential in a one-element array produced by a
ConstantBootstraps.invokebootstrap and written by a static setter of the exact shapeldc condy; iconst_0; aload_0; aastore; return. The array exists only in the owner class's resolved constant pool: nothing outside that class can load it, and there is no native getter to call.This emits one public static getter next to the setter, loading the same constant, so it returns the very array the game reads and writes. The getter is marked synthetic and named after its setter.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGETTER_SUFFIX
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.objectweb.asm.tree.MethodNodeensureGetter(org.objectweb.asm.tree.ClassNode owner, java.lang.String setterName)Add the getter forowner.setterName, or return the existing one.static java.lang.StringgetterName(java.lang.String setterName)static org.objectweb.asm.ConstantDynamicholder(org.objectweb.asm.tree.MethodNode method)The constant written by a holder setter, ornullif the method is not exactlyldc condy String[]; iconst_0; aload_0; aastore; return.static voidrequireDistinctDynamics(byte[] original, java.lang.String className)Refuse to rewrite a class whose constant pool holds two value-equal mutable (array) dynamic constants.
-
-
-
Field Detail
-
GETTER_SUFFIX
public static final java.lang.String GETTER_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getterName
public static java.lang.String getterName(java.lang.String setterName)
-
ensureGetter
public static org.objectweb.asm.tree.MethodNode ensureGetter(org.objectweb.asm.tree.ClassNode owner, java.lang.String setterName)Add the getter forowner.setterName, or return the existing one.- Throws:
java.lang.IllegalStateException- if the setter does not have the exact holder shape
-
holder
public static org.objectweb.asm.ConstantDynamic holder(org.objectweb.asm.tree.MethodNode method)
The constant written by a holder setter, ornullif the method is not exactlyldc condy String[]; iconst_0; aload_0; aastore; return.
-
requireDistinctDynamics
public static void requireDistinctDynamics(byte[] original, java.lang.String className)Refuse to rewrite a class whose constant pool holds two value-equal mutable (array) dynamic constants.ASM rebuilds the pool from the tree and merges equal constants. Two distinct holders that happened to share a bootstrap would then collapse into one array, silently aliasing credentials. Every current holder has its own factory method, so this never fires today; it exists so that a future build which changes that fails loudly instead of logging someone in wrong.
-
-