• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"public" modifier in DBMain interface methods

 
Ronald Wouters
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
when I run checkstyle on the DBMain interface, it reports the "public" modifier for the interface methods as being redundant.
Can I remove this modifier ?

Regards,
Ronald Wouters
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, remember the JLS ?


Every method declaration in the body of an interface is implicitly public.
.
.
.
It is permitted, but strongly discouraged as a matter of style, to redundantly specify the public modifier for interface methods.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the other hand, if the file is given by Sun, you could leave it as it is and document the fact it is a lousy example of programming practice. (At your own risk )
 
Ronald Wouters
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the reference in the JLS you were talking about:

9.4 Abstract Method Declarations

Thanks for your advise. I think I will leave it as is and put something "diplomatic" in my choices.txt.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic