mirror of
https://github.com/corda/corda.git
synced 2025-01-10 06:52:44 +00:00
2465459079
The two big pieces here are basic invokedynamic support and a working version of LambdaMetaFactory.metafactory. The latter works by dynamically building a synthetic class with three methods: a static factory method, a constructor for the factory method to call, and a method to satisfy the requested interface which defers to the specified MethodHandle. This work relies heavily on Avian's specific MethodType and MethodHandle implementations, which provide extra, non-standard features to make code generation easier. That means we'll probably need to use Avian's versions of java.lang.invoke.* even when building with the OpenJDK or Android class libraries.
24 lines
506 B
Java
24 lines
506 B
Java
package java.lang.invoke;
|
|
|
|
public class MethodHandle {
|
|
private final ClassLoader loader;
|
|
final avian.VMMethod method;
|
|
private volatile MethodType type;
|
|
|
|
MethodHandle(ClassLoader loader, avian.VMMethod method) {
|
|
this.loader = loader;
|
|
this.method = method;
|
|
}
|
|
|
|
public String toString() {
|
|
return new java.lang.reflect.Method(method).toString();
|
|
}
|
|
|
|
public MethodType type() {
|
|
if (type == null) {
|
|
type = new MethodType(loader, method.spec);
|
|
}
|
|
return type;
|
|
}
|
|
}
|