Remove unneeded type adaption and add error message on violation

This commit is contained in:
Uwe Schindler 2016-06-15 19:48:38 +02:00
parent ca2e0e1660
commit 8d3c411298
1 changed files with 3 additions and 2 deletions

View File

@ -99,6 +99,9 @@ public final class DefBootstrap {
PIC(Lookup lookup, String name, MethodType type, int flavor, Object[] args) {
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.name = name;
this.flavor = flavor;
@ -178,8 +181,6 @@ public final class DefBootstrap {
final MethodHandle target = lookup(flavor, name, receiver, callArgs).asType(type);
MethodHandle test = CHECK_CLASS.bindTo(receiver);
test = test.asType(test.type().changeParameterType(0, type.parameterType(0)));
MethodHandle guard = MethodHandles.guardWithTest(test, target, getTarget());
depth++;