2015-05-04 02:57:38 +00:00
|
|
|
package java.lang.invoke;
|
2015-08-05 21:55:52 +00:00
|
|
|
|
2015-08-06 19:24:06 +00:00
|
|
|
import avian.Classes;
|
|
|
|
|
2015-08-05 21:55:52 +00:00
|
|
|
public class MethodHandle {
|
2015-08-06 19:24:06 +00:00
|
|
|
static final int REF_invokeStatic = 6;
|
|
|
|
static final int REF_invokeSpecial = 7;
|
|
|
|
|
|
|
|
final int kind;
|
2015-08-05 21:55:52 +00:00
|
|
|
private final ClassLoader loader;
|
|
|
|
final avian.VMMethod method;
|
|
|
|
private volatile MethodType type;
|
|
|
|
|
2015-08-06 19:24:06 +00:00
|
|
|
MethodHandle(int kind, ClassLoader loader, avian.VMMethod method) {
|
|
|
|
this.kind = kind;
|
2015-08-05 21:55:52 +00:00
|
|
|
this.loader = loader;
|
|
|
|
this.method = method;
|
|
|
|
}
|
2015-08-06 19:24:06 +00:00
|
|
|
|
2015-08-05 21:55:52 +00:00
|
|
|
public String toString() {
|
2015-08-06 19:24:06 +00:00
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (method.class_ != null) {
|
|
|
|
sb.append(Classes.makeString(method.class_.name, 0,
|
|
|
|
method.class_.name.length - 1));
|
|
|
|
sb.append(".");
|
|
|
|
}
|
|
|
|
sb.append(Classes.makeString(method.name, 0,
|
|
|
|
method.name.length - 1));
|
|
|
|
sb.append(Classes.makeString(method.spec, 0,
|
|
|
|
method.spec.length - 1));
|
|
|
|
return sb.toString();
|
|
|
|
}
|
2015-08-05 21:55:52 +00:00
|
|
|
|
|
|
|
public MethodType type() {
|
|
|
|
if (type == null) {
|
|
|
|
type = new MethodType(loader, method.spec);
|
|
|
|
}
|
|
|
|
return type;
|
|
|
|
}
|
2015-05-04 02:57:38 +00:00
|
|
|
}
|