Say I have a Class object which represents an anonymous inner class. Is there any way I can get the compiler’s number for the class it created? For example I have a class here whose compilation has resulted in a
Thing$1.class
file being created. How can I find out this number from the Class object?
This works:
I can’t imagine anything useful you could do with that number, though. More importantly, this naming scheme for anonymous classes is AFAIK not mandated by the language or VM specs. It’s an implementation detail that could change.