Can someone make `java.lang.InternalError` or` java.lang.UnknownError` thrown?

I was curious how java.lang.InternalErroror java.lang.UnknownError.

I don't mean just

throw new InternalError();
throw new UnknownError();

but one of them was chosen by the Java SE library or the JVM itself (with a recent regular Oracle implementation).

For example, the specific codes or circumstances that make ArrayList.cloneit really drop out InternalError- this is the answer I want. Below is its source code.

public Object clone() {
    try {
        ArrayList<?> v = (ArrayList<?>) super.clone();
        v.elementData = Arrays.copyOf(elementData, size);
        v.modCount = 0;
        return v;
    } catch (CloneNotSupportedException e) {
        // this shouldn't happen, since we are Cloneable
        throw new InternalError(e);
    }
}
+4
source share
1 answer

If you want to be curious, go to the Java Error Database page and look for errors with InternalErrorand UnknownErroras a keyword.

, - InternalError UnknownError, .

:

  • , , ; .. Java. ( , . ? ?)

  • , , . , . ( , Oracle... .)


, , , , Java (, "rt.jar" ) .

+5

All Articles