I concur that it's much better to fix the code than to suppress the warning messages.
Joined: Sep 15, 2004
For this method, I am getting method getLocation is not designed for extension - needs to be abstract, final or empty
for this contructor code see below, I am getting several messages like -location hides a field -location should be final similar messages for status, recNo, name
Alex Belisle Turcot
Joined: Apr 26, 2005
Originally posted by Harish Yerneni:
I think it looks at the variables received as parameters: (Contractor(final int status, final int recNo, final String name, final String location, final String specialties, final String size, final String rate, final String owner).
I don't know if that's the best/preferred style however. For the other method, I don't know, but try playing around with similar cause.
More specifically, it enforces a programming style where superclasses provide empty "hooks" that can be implemented by subclasses.
The exact rule is that nonprivate, nonstatic methods in nonfinal classes (or classes that do not only have private constructors) must either be
abstract or final or have an empty implementation
This protects superclasses against beeing broken by subclasses. The downside is that subclasses are limited in their flexibility, in particular they cannot prevent execution of code in the superclass, but that also means that subclasses can't forget to call their super method.