pengzhendong
pengzhendong

Reputation: 3

How to get the subclass of a class by soot?

I can get the superclass of a class by SootClass.getSuperclass(), but I don't know how to get its subclass.

Have I need to load the subclass first? There is no getSubclass() function. Thanks!

Upvotes: 0

Views: 840

Answers (2)

Eric
Eric

Reputation: 1393

You need to use Scene.v().getHierarchy() or Scene.v().getFastHierarchy()

Upvotes: 4

Randy
Randy

Reputation: 36

You cannot simply get "the subclass", because there can be many such classes, subclassing one specific class or implementing a certain interface.

I suppose, you would have to iterate over all classes in the scene and for each such class check if its superclass is the given class/interface.

Upvotes: 1

Related Questions