Search code examples
javadebuggingjvmtijdi

How to know if an `com.sun.jdi.ObjectReference` is an Enum?


How to find out if an com.sun.jdi.ObjectReference instance is an enum? I can get the type of the instance with ObjectReference.type() which gives a ClassType back (if it is a class).


Solution

  • Use the isEnum() method on com.sun.jdi.ClassType