/** Add an extra UTF8 into the pool */ private CONSTANT_Utf8_info addExtraUtf8(String value) { CONSTANT_Utf8_info item = new CONSTANT_Utf8_info(value); addEntry(null, item); return item; }
/** * Add an entry, but only if it doesn't exist. * * @return the constant pool index of the added or existing item. */ private int addDirectEntry(ConstantPoolEntry item) { ConstantPoolEntry existingItem = findMatchingEntry(item); if (existingItem != null) { item = existingItem; // foundCount++; } else { addEntry(item.getKey(), item); } return item.getIndex(); }
/** Add a UTF8 into the pool and return the index to it. */ private CONSTANT_Utf8_info addUtf8Entry(String value) { CONSTANT_Utf8_info item = (CONSTANT_Utf8_info) findMatchingEntry(value); if (item == null) { item = new CONSTANT_Utf8_info(value); addEntry(value, item); } return item; }
/** Add an index reference. */ private int addIndexReference(int tag, int i1, int i2) { // search for the item using the pre-allocated object searchIndex.set(tag, i1, i2); ConstantPoolEntry item = findMatchingEntry(searchIndex); if (item == null) { item = new CONSTANT_Index_info(tag, i1, i2); addEntry(item.getKey(), item); } return item.getIndex(); }