Add possiblity to use primitive long as scalar dependency
@@ -44,6 +44,7 @@ import javax.annotation.Nullable;
import java.lang.annotation.Annotation;
import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
@@ -144,13 +145,13 @@ public class ScalarImplementation
}
MethodHandle methodHandle = this.methodHandle;
for (ImplementationDependency dependency : dependencies) {
- methodHandle = methodHandle.bindTo(dependency.resolve(boundVariables, typeManager, functionRegistry));
+ methodHandle = MethodHandles.insertArguments(methodHandle, 0, dependency.resolve(boundVariables, typeManager, functionRegistry));
}
MethodHandle constructor = null;
if (this.constructor.isPresent()) {
constructor = this.constructor.get();
for (ImplementationDependency dependency : constructorDependencies) {
- constructor = constructor.bindTo(dependency.resolve(boundVariables, typeManager, functionRegistry));
+ constructor = MethodHandles.insertArguments(constructor, 0, dependency.resolve(boundVariables, typeManager, functionRegistry));
}
}
return Optional.of(new MethodHandleAndConstructor(methodHandle, Optional.ofNullable(constructor)));
