private static Constant throwInvalid(int idx) {
    throw new ExceptionWithContext("invalid constant pool index " + Hex.u2(idx));
  }
Throws the right exception for an invalid cpi.

@param idx the bad cpi
@return never
@throws ExceptionWithContext always thrown
android/android_framework/dex-maker/src/main/java/com/android/dx/rop/cst/StdConstantPool.java