Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/compilercontrol/share/pool/SubMethodHolder.java
41161 views
1
package compiler.compilercontrol.share.pool;
2
3
import jdk.test.lib.util.Pair;
4
5
import java.lang.reflect.Constructor;
6
import java.lang.reflect.Executable;
7
import java.lang.reflect.Method;
8
import java.util.ArrayList;
9
import java.util.List;
10
import java.util.concurrent.Callable;
11
12
/**
13
* A helper class that creates executables and callables for internal classes
14
* It's necessary to have this class to make all helper lambdas not contain
15
* any of class names that could be used as a pattern (Internal*, *Klass*)
16
*/
17
public abstract class SubMethodHolder extends MethodHolder {
18
@Override
19
public List<Pair<Executable, Callable<?>>> getAllMethods() {
20
List<Pair<Executable, Callable<?>>> pairs = new ArrayList<>();
21
{
22
Method method = getMethod(this, "method", Float.class);
23
Pair<Executable, Callable<?>> pair = new Pair<>(method,
24
() -> method.invoke(this, 3.141592f));
25
pairs.add(pair);
26
}
27
{
28
Method method = getMethod(this, "methodDup");
29
Pair<Executable, Callable<?>> pair = new Pair<>(method,
30
() -> method.invoke(this));
31
pairs.add(pair);
32
}
33
{
34
Method method = getMethod(this, "smethod", Integer.class);
35
Pair<Executable, Callable<?>> pair = new Pair<>(method,
36
() -> method.invoke(this, 1024));
37
pairs.add(pair);
38
}
39
try {
40
Constructor constructor = this.getClass().getConstructor();
41
Pair<Executable, Callable<?>> pair = new Pair<>(constructor,
42
constructor::newInstance);
43
pairs.add(pair);
44
} catch (NoSuchMethodException e) {
45
throw new Error("TESTBUG: unable to get constructor");
46
}
47
return pairs;
48
}
49
}
50
51