import java.util.function.Function; class Test { Function f = (str) -> () -> { String s = ""; foo(s); }; void foo(String s) {} }