#639 FinalClass check should ignore subclassed types

release_1.0
closed
Oliver Burn
5
2013-11-05
2011-03-31
Hollis Waite
No

The existence of inner classes renders private constructors accessible. The 'FinalClass' check should verify that subclasses don't exist before flagging a non-final class.

Discussion

  • Andreas Klotz
    Andreas Klotz
    2012-01-12

    I ran in to the same issue. I have two private inner classes. One of it extending the other. I think inner classes should not be checked with "FinalClass" at all since it relies only on the assumption that private non accessible constructors do avoid subclassing. But in regard to inner classes this assumption is not valid.

    Best regards,
    Andreas

     
  • Roman Ivanov
    Roman Ivanov
    2013-11-05

    • status: open --> closed
    • Group: --> release_1.0
     
  • Roman Ivanov
    Roman Ivanov
    2013-11-05

    can not reproduce on latest 5.6 code
    public class Util {

    private Util() {
    //
    }

    private class Utils2 {

    }
    }

    if still a problem welcome to https://github.com/checkstyle/checkstyle/issues