refactoring to generalize some reflection processing

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2621 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2008-02-26 03:42:20 +00:00
parent 140204230d
commit 769ab11ea0
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
package reflection;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Test of Method.invoke
*/
public class Reflect9 {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
Class c = Class.forName("java.lang.Integer");
Method m = c.getDeclaredMethod("toString", new Class[] {});
m.invoke(new Integer(2), new Object[] {});
}
}