Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- regression/jvm/MethodTest.java | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/regression/jvm/MethodTest.java b/regression/jvm/MethodTest.java index c633f8c..b805da4 100644 --- a/regression/jvm/MethodTest.java +++ b/regression/jvm/MethodTest.java @@ -36,7 +36,7 @@ public class MethodTest extends TestCase { assertEquals(Modifier.STATIC | Modifier.PUBLIC, modifiers("publicClassMethod")); assertEquals(Modifier.PUBLIC, modifiers("publicInstanceMethod")); } - + private static int modifiers(String name) throws Exception { return Klass.class.getMethod(name, new Class[] { }).getModifiers(); } @@ -45,9 +45,27 @@ public class MethodTest extends TestCase { public final void publicFinalInstanceMethod() { } public static void publicClassMethod() { } public void publicInstanceMethod() { } + + public static int intIncrement(int x) { + return x + 1; + } + } + + public static Object invoke(String name, Class arg_class, Object arg) { + try { + return Klass.class.getMethod(name, new Class[] { arg_class }).invoke(null, new Object[] { arg }); + } catch (Exception e) { + fail(); + return null; + } + } + + public static void testMethodReflectionInvoke() { + assertObjectEquals(Integer.valueOf(2), invoke("intIncrement", int.class, Integer.valueOf(1))); } public static void main(String[] args) throws Exception { testMethodModifiers(); + testMethodReflectionInvoke(); } } -- 1.6.0.4 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel