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:
parent
140204230d
commit
769ab11ea0
|
@ -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[] {});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue