/** * Gets the {@link IndexedItem} corresponding to the given constant, * if it is a constant that has such a correspondence, or return * {@code null} if it isn't such a constant. This will throw * an exception if the given constant <i>should</i> have been found * but wasn't. * * @param cst {@code non-null;} the constant to look up * @return {@code null-ok;} its corresponding item, if it has a corresponding * item, or {@code null} if it's not that sort of constant */ /*package*/ IndexedItem findItemOrNull(Constant cst) { if (cst instanceof CstString) { return stringIds.get(cst); } else if (cst instanceof CstType) { return typeIds.get(cst); } else if (cst instanceof CstBaseMethodRef) { return methodIds.get(cst); } else if (cst instanceof CstFieldRef) { return fieldIds.get(cst); } else if (cst instanceof CstProtoRef) { return protoIds.get(cst); } else { return null; } }
return fieldIds.intern(((CstEnumRef) cst).getFieldRef()); } else if (cst instanceof CstProtoRef) { return protoIds.get(cst); } else if (cst instanceof CstMethodHandle) { return methodHandles.get(cst);