This code is failing to compile:
import java.util.*;
import java.util.function.*;
class Test {
public interface X {
Object O = new Object() {
Function<String, String> x(Map<String, String> m) {
// Error: local variables referenced from a lambda expression must be final or effectively final
return s -> m.get(s);
}
};
}
}
reported by Paul Sandoz
import java.util.*;
import java.util.function.*;
class Test {
public interface X {
Object O = new Object() {
Function<String, String> x(Map<String, String> m) {
// Error: local variables referenced from a lambda expression must be final or effectively final
return s -> m.get(s);
}
};
}
}
reported by Paul Sandoz
- relates to
-
JDK-8194743 Compiler implementation for Statements before super()
- Resolved