0

How to resolve this check style error

Method 'getUserDAO' is not designed for extension

in

public UserDAO getUserDAO() {
    return userDAO;
}
MeBigFatGuy
  • 28,272
  • 7
  • 61
  • 66
Romi
  • 4,833
  • 28
  • 81
  • 113
  • possible duplicate of [Howto design for extension](http://stackoverflow.com/questions/662598/howto-design-for-extension) – Brian Roach Oct 15 '11 at 06:13

2 Answers2

1

The tool is telling you that public methods should be final. That way a subclass won't be able to change how a class operates.

    public final UserDAO getUserDAO() {
        return userDAO;
    }
sbzoom
  • 3,273
  • 4
  • 29
  • 34
1
  • Read the corresponding documentation
  • Make the method final
  • or make the class final
  • or disable the corresponding check if you don't want to stick to that programming paradigm
michael667
  • 3,241
  • 24
  • 32