roterdam / jchord

Automatically exported from code.google.com/p/jchord
3 stars 0 forks source link

support static analysis of loadClass/newInstance/getMethod/invoke reflection sequence #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Submitted by Ariel Rabkin:

I've run across code that looks like the following:

           Class sparkClass = loader.loadClass("org.jivesoftware.Spark");
           Object instanceOfSpark = sparkClass.newInstance();
           Method startupMethod = sparkClass.getMethod("startup");
           startupMethod.invoke(instanceOfSpark);

Seems like it should be possible to special-case this in the rapid
type analysis, using the fact that the classname is a compile-time
constant.  There's an easy workaround -- adding a cast and changing
the type on line 2 -- so it's a probably not a major priority for me
or anybody else.

Original issue reported on code.google.com by mayur.naik on 22 Jun 2010 at 9:04