01: /***************************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- * The software
05: * in this package is published under the terms of the LGPL license * a copy of which has been
06: * included with this distribution in the license.txt file. *
07: **************************************************************************************************/package test.reflection;
08:
09: import java.lang.reflect.Method;
10:
11: public class Child extends Super {
12: public int incr(int value) {
13: int res = super .incr(value);
14: return (res >= 0) ? (res + 1) : (res - 1);
15: }
16:
17: public static int incrStatic(int value) {
18: int res = Super.incrStatic(value);
19: return (res >= 0) ? (res + 1) : (res - 1);
20: }
21:
22: public int do$2(int i) {
23: return i;
24: }
25:
26: public int do$1(int i) {
27: return i;
28: }
29:
30: public int reflectionCallIncr(int value) {
31: try {
32: Method m = this .getClass().getMethod("incr",
33: new Class[] { int.class });
34: Integer res = (Integer) m.invoke(this ,
35: new Object[] { new Integer(value) });
36: return res.intValue();
37: } catch (Throwable t) {
38: return -1000;
39: }
40: }
41: }
|