Menu

#82 Create "anonymous inner class with just one method" rule.

open
nobody
None
5
2013-04-08
2010-11-12
No

Create "anonymous inner class with just one method" rule.
This should be converted to a closure with an "as MyClass" cast.

Discussion

  • Victor Savkin

    Victor Savkin - 2011-06-05

    I'll do it.

    Thanks,
    Victor

     
  • Chris Mair

    Chris Mair - 2013-04-08

    Problem: an anonymous inner class might also be used to extend a superclass and just override one of its methods. And the inner class name is not available in the AST Groovy 1.7, but is available in 1.8. Once we can standardize on Groovy 1.8+, we can implement a rule that checks for the predefined set of one-method interfaces in the JDK. See #171:
    https://sourceforge.net/p/codenarc/feature-requests/171/

     

Log in to post a comment.