mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
Remove unneeded type adaption and add error message on violation
This commit is contained in:
parent
ca2e0e1660
commit
8d3c411298
@ -99,6 +99,9 @@ public final class DefBootstrap {
|
|||||||
|
|
||||||
PIC(Lookup lookup, String name, MethodType type, int flavor, Object[] args) {
|
PIC(Lookup lookup, String name, MethodType type, int flavor, Object[] args) {
|
||||||
super(type);
|
super(type);
|
||||||
|
if (type.parameterType(0) != Object.class) {
|
||||||
|
throw new BootstrapMethodError("The receiver type (1st arg) of invokedynamic descriptor must be Object.");
|
||||||
|
}
|
||||||
this.lookup = lookup;
|
this.lookup = lookup;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.flavor = flavor;
|
this.flavor = flavor;
|
||||||
@ -178,8 +181,6 @@ public final class DefBootstrap {
|
|||||||
final MethodHandle target = lookup(flavor, name, receiver, callArgs).asType(type);
|
final MethodHandle target = lookup(flavor, name, receiver, callArgs).asType(type);
|
||||||
|
|
||||||
MethodHandle test = CHECK_CLASS.bindTo(receiver);
|
MethodHandle test = CHECK_CLASS.bindTo(receiver);
|
||||||
test = test.asType(test.type().changeParameterType(0, type.parameterType(0)));
|
|
||||||
|
|
||||||
MethodHandle guard = MethodHandles.guardWithTest(test, target, getTarget());
|
MethodHandle guard = MethodHandles.guardWithTest(test, target, getTarget());
|
||||||
|
|
||||||
depth++;
|
depth++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user