Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#607 Exclude Java Collections from Class Fan out

Future
closed
nobody
None
1
2013-11-05
2013-02-22
Vincent Massol
No

The purpose of the ClassFanOutComplexityCheck is to ensure that classes don't get too complex and stay easy to maintain. Some classes are excluded from computation by default (like java.lang.*) because every java dev know about them and they don't increase the maintenance.

I'd like to propose to add the Java Collections too (Map, HashMap, List, ArrayList, etc) too since they're part of the language and every java dev know about them too (similar to the String class for example).

These classes are causing unnecessary class fan out violations on code.

Could you please consider excluding them?

Thanks

Discussion

  • Oliver Burn
    Oliver Burn
    2013-02-24

    I can understand the reason for the request.

    I am thinking to add a parameter to the check to allow the names of packages to be ignored to be specified. By default it would be "java.lang". This would allow, in your case, for "java.util" to be specified.

    Of course, this is then contingent on being able to use introspection to determine the names of all the classes defined in the specified packages. I believe this will be possible, but need to check.

    Would this suit your needs?

     
  • Vincent Massol
    Vincent Massol
    2013-02-25

    Yes that would suit my need. BTW you have another ticket opened around this too: https://sourceforge.net/p/checkstyle/feature-requests/575/

    Being able to exclude a full package would be really nice.

    What you could provide is the option to specify regexes against fully qualified class names, so that we could for example specify "java.lang.util..*"

    ATM the AbstractClassCouplingCheck isn't computing the fully qualified class name so indeed you'd need to find out how to do that first :)

    Thanks

     
  • Vincent Massol
    Vincent Massol
    2013-10-27

    As a consequence this issue can be closed now.

     
  • Roman Ivanov
    Roman Ivanov
    2013-11-05

    • status: open --> closed
     
  • Roman Ivanov
    Roman Ivanov
    2013-11-05

    discussion is moved to github