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