in modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java [312:345]
private boolean invokeDynamicImportedMethod(final String name, final String descriptor,
final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) {
OptionalInt handleIndex = OptionalInt.empty();
for (int i = 0; i < bootstrapMethodArguments.length; i++) {
if (bootstrapMethodArguments[i] instanceof Handle) {
if (handleIndex.isPresent()) {
return false;
}
handleIndex = OptionalInt.of(i);
}
}
if (handleIndex.isPresent()) {
final Handle handle = (Handle) bootstrapMethodArguments[handleIndex.getAsInt()];
if (handle.getTag() == Opcodes.H_INVOKESTATIC) {
final Pair<Type, Method> methodKey =
methodKey(handle.getOwner(), handle.getName(), handle.getDesc());
if (shouldImport(methodKey)) {
final String importedName = importMethod(methodKey);
final Object[] args = bootstrapMethodArguments.clone();
args[handleIndex.getAsInt()] =
new Handle(handle.getTag(), className, importedName, handle.getDesc(), false);
super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, args);
return true;
}
validateLambda(handle);
}
}
return false;
}