So having not used anonymous inner classes all that much in practice other than to add a listener in swing, I was surprised to discover the existence of anonymous local variables.
For review, those are local variables that must be marked as final, that an anonymous inner class can essentially borrow and save a reference to. In the case that I was working, the original reference for the object was lost but the inner class, which never declared the variable but simply used it, was able to keep access to.
Why is such a thing allowed? And also, what's the proper way to call this anonymous variable outside the class? Can reflection be used? What modifiers are attached to the object such as private/public, etc.
Really, what bothers me about it is it feels like sloppy programming. If you are going to pass a variable to a class, it should be passed explicitly as an argument -or- at the very least stored in the class as a private member variable. I don't like the idea of a
java class automatically creating an instance member variable for every final local variable available.