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
Ranch Hand
Joined: Apr 26, 2005
Posts: 516
posted
0
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.
Check that method/constructor parameters are final. The user can set the token set to METHOD_DEF, CONSTRUCTOR_DEF, or both (default), to control the scope of this check.
Harish Yerneni
Ranch Hand
Joined: Sep 15, 2004
Posts: 94
posted
0
Thanks, Alex. The second problem with "hide" messages went away when I change the method parameter names to something different than class member variable names.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.