When `Class.getEnumConstants()` is called on a bad enum class where `values()` 
is an instance method, or returns a non‑array, then it throws 
`NullPointerException` or `ClassCastException` respectively. 

This patch fixes `Class.getEnumConstants()` method to handle above mentioned 
bad enums and adds relevant tests.

Please review.

Thanks,
Adam

-------------

Commit messages:
 - 8296196: Class.getEnumConstants() throws undocumented ClassCastException and 
NullPointerException

Changes: https://git.openjdk.org/jdk/pull/11056/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11056&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8296196
  Stats: 119 lines in 4 files changed: 118 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/11056.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11056/head:pull/11056

PR: https://git.openjdk.org/jdk/pull/11056

Reply via email to