Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have an anonymous inner class inside another class (SomeClass).

Both SomeClass.class.getClasses() and SomeClass.class.getDeclaredClasses() return empty arrays.

I couldn't find some hints on this in Class' Javadocs.

Can anonymous inner classes be retrieved using reflection in some way?

What else are notable differences between anonymous inner classes and normal inner classes?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
492 views
Welcome To Ask or Share your Answers For Others

1 Answer

You could try a brute force search of Class$1 ... Class$n until you can't find any more.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...