Re: Code analysis: Find all possible concrete classes given a handle to an interface?

Yao Qi <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
First of all, I think ASM is a just BCI util, instead of code analysis
util.  I think WALA
(http://wala.sourceforge.net/wiki/index.php/Main_Page) or SOOT
(http://www.sable.mcgill.ca/soot/) is what you want.

On Mon, Jan 11, 2010 at 12:04 PM, Mark Smith <[email protected]> wrote:
> Hi,
>
> I have a code analysis question.  How can I find all possible concrete classes given a handle to an interface?  I think I need to use an Analyzer and examine Frames to keep track of it, but not sure exactly how.
>

It is a typical problem in Class Hierarchy Analysis.  In WALA, and
Eclipse JDT, we can know all concrete classes, which implement a
certain interface.  So WALA or JDT might be a better candidate for to
this problem.

> For example say I have a large codebase and am calling this method throughout my code:
>
> public class Util{
>  public static void foo(java.util.List<String> someList){
>   /**
>     some code
>    **/
>  }
> }
>
> Is there a way to find all possible concrete classes that get passed into Util::foo() ?  For example someone could pass in a java.util.ArrayList<String> or a java.util.LinkedList<String>.
>

CallGraph may help you.  You can find node Util::foo() in graph, and
then, all the prev nodes of Util::foo() node are caller methods.

> There should be someway to do a backwards data flow analysis to get this, not sure how.  Any help is appreciated.
>
> Thanks,
> Mark
>
>
>
>
>
> --
> You receive this message as a subscriber of the [email protected] mailing list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>



-- 
Yao Qi <qiyaoltc AT gmail DOT com>    GNU/Linux
Developer\nhttp://duewayqi.googlepages.com/
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.