mirror of
https://github.com/corda/corda.git
synced 2025-06-14 13:18:18 +00:00
implement basic Java 8 lambda support
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.
This commit is contained in:
@ -18,7 +18,7 @@ import avian.Classes;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
public class Method<T> extends AccessibleObject implements Member {
|
||||
private final VMMethod vmMethod;
|
||||
public final VMMethod vmMethod;
|
||||
private boolean accessible;
|
||||
|
||||
public Method(VMMethod vmMethod) {
|
||||
@ -59,6 +59,18 @@ public class Method<T> extends AccessibleObject implements Member {
|
||||
return getSpec(vmMethod);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (vmMethod.class_ != null) {
|
||||
sb.append(Classes.makeString(vmMethod.class_.name, 0,
|
||||
vmMethod.class_.name.length - 1));
|
||||
sb.append(".");
|
||||
}
|
||||
sb.append(getName());
|
||||
sb.append(getSpec());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getSpec(VMMethod vmMethod) {
|
||||
return Classes.makeString(vmMethod.spec, 0, vmMethod.spec.length - 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user