checkstyle messages

Javier Corral

Greenhorn

Posts: 24

posted 8 years ago

Hi,

I'm reviewing my code with checkstyle and it shows me a lot of messages which I understand but I'm not sure if it's needed to trouble for them.

- A parameter hides a field. It means a name of parameter is equal to a name of a field in the class. Would I decrease my mark if I don't avoid it?. - Are needed javadoc comments for inherited methods as ActionPerformed(), or for private fields, or when declaring static final Strings which are used as text labels?. - import ".*" should be avoided? - Method is not designed to be extended needs to be abstract, final or void.?

Many thanks for advance.

Alex Belisle Turcot

Ranch Hand

Posts: 516

posted 8 years ago

Hi,

I'll give you my opinions (I got 100% in documentation and used checkstyle..).

- A parameter hides a field. It means a name of parameter is equal to a name of a field in the class. Would I decrease my mark if I don't avoid it?.

I disabled that, I don't agree with checkstyle. once you come up with a good name for variable, why change it.. "this.name = name;" is good to me.

- Are needed javadoc comments for inherited methods as ActionPerformed(), or for private fields, or when declaring static final Strings which are used as text labels?.

- I left undocumented inherited methods from my own code (only documented once). I however documented methods inherited from the API (such as ActionPerformed). - I did not document private fields (except 2-3 fields with normal java comments). - All my static final fields were also private, so I did not javadoced them.

- import ".*" should be avoided?

I agree with checkstyle here, no wildcard in imports. You want to know exactly on which classes you are depending. In eclipse, right click on your project -> source -> reorganise imports. I believe it will do the trick.

Might as well do "source->Format".

- Method is not designed to be extended needs to be abstract, final or void.?

According to checkstyle (my understanding), any class which is not meant to be sub-classed should be final (not sure what they check for that). I disabled that.