There's this, and the fact that it's effectively unenforceable.
String t = ((Supplier) () -> {
final String s = myMethod();
return s;
}).get();
So you keep the compiler happy but the desire to force only final retention
of the reference (which, like Raffaello, I don't understand the use-c
Hello,
I don't get why the author of myMethod() would/should be interested in
forcing the caller of the method to declare the variable b to be final.
Stated otherwise, what is the problem addressed by this suggestion?
Have you some specific case in mind?
Greetings
Raffaello
On 2022-02-02 20