equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 package pool.sub; |
24 package pool.sub; |
25 |
25 |
26 import jdk.test.lib.Pair; |
|
27 import pool.MethodHolder; |
26 import pool.MethodHolder; |
28 |
27 import pool.SubMethodHolder; |
29 import java.lang.reflect.Executable; |
|
30 import java.util.ArrayList; |
|
31 import java.util.List; |
|
32 import java.util.concurrent.Callable; |
|
33 |
28 |
34 /** |
29 /** |
35 * Simple class with methods to test signatures |
30 * Simple class with methods to test signatures |
36 */ |
31 */ |
37 public class Klass extends MethodHolder { |
32 public class Klass extends MethodHolder { |
51 Integer var = 1024; |
46 Integer var = 1024; |
52 return arg + var; |
47 return arg + var; |
53 } |
48 } |
54 |
49 |
55 // Internal class and constructor |
50 // Internal class and constructor |
56 public static class Internal extends MethodHolder { |
51 public static class Internal extends SubMethodHolder { |
57 public Internal() { } |
52 public Internal() { } |
58 |
53 |
59 public Double method(Float fl) { return Double.valueOf(fl); } |
54 public Double method(Float fl) { return Double.valueOf(fl); } |
60 |
55 |
61 public Double methodDup() { |
56 public Double methodDup() { |
64 |
59 |
65 public static Integer smethod(Integer arg) { |
60 public static Integer smethod(Integer arg) { |
66 Integer var = 1024; |
61 Integer var = 1024; |
67 return arg + var; |
62 return arg + var; |
68 } |
63 } |
69 |
|
70 @Override |
|
71 public List<Pair<Executable, Callable<?>>> getAllMethods() { |
|
72 List<Pair<Executable, Callable<?>>> pairs = new ArrayList<>(); |
|
73 Pair<Executable, Callable<?>> pair = new Pair<> |
|
74 (getMethod(this, "method", Float.class), |
|
75 () -> this.method(3.141592f)); |
|
76 pairs.add(pair); |
|
77 pair = new Pair<>(getMethod(this, "methodDup"), this::methodDup); |
|
78 pairs.add(pair); |
|
79 pair = new Pair<>(getMethod(this, "smethod", Integer.class), |
|
80 () -> smethod(1024)); |
|
81 pairs.add(pair); |
|
82 try { |
|
83 pair = new Pair<>(this.getClass().getConstructor(), |
|
84 Internal::new); |
|
85 pairs.add(pair); |
|
86 } catch (NoSuchMethodException e) { |
|
87 throw new Error("TESTBUG: unable to get constructor"); |
|
88 } |
|
89 return pairs; |
|
90 } |
|
91 } |
64 } |
92 } |
65 } |