Tricks with var and anonymous classes (that you should never use at work)
Read OriginalThis technical article delves into advanced Java features, specifically using the 'var' keyword to infer the types of anonymous classes. It demonstrates tricks like adding ad-hoc fields and methods to anonymous types, which are not expressible in standard Java syntax. The author presents these as interesting explorations of the compiler's type system but explicitly cautions against using them in real-world, professional code due to maintainability and clarity concerns.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser