Can CheckClassAdapter.checkTypeRef throw a more specific exception?
This method throws AssertionError for unsurpported typeRef:
static void checkTypeRef(final int typeRef) { int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: ... default: throw new AssertionError(); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException( "Invalid type reference 0x" + Integer.toHexString(typeRef)); } }
AssertionError is a general exception and it is not quite meaningful. Is it better to throw UnsupportedOperationException? Or else, it shall be consistent, if it throws IllegalArgumentException, as the follow-up lines do.