This code compiles.
On executing the code, however, I get an error I've never seen before.
What am I missing?
Note: I'm not looking for a workaround; the actual use case was for a MouseListener#mouseClicked(...) in an generified extension of JLabel, easily solved by adding the MouseListener in each subclass.
edit Another, more general, workaround is to pass the field as a parameter to the inner class's constructor. In the example, that would entail providing a String parameter to the Sub constructor and passing text as the value. That executes without errors.
There are no new questions, but there may be new answers.
Playing around with this some more, if the lambda in the super call is replaced with a traditional anonymous inner class, it runs without error.
Is that evidence of a compiler bug? Aren't the two versions -- lambda / inner class -- supposed to be semantically the same?