#52 "public" in interface methods

release_2.2
closed
None
5
2012-10-10
2002-03-30
Anonymous
No

I have just learnt today that the "public" keyword
should not be specified for methods defined in
interfaces.

Maybe checkstyle could check this ?
Thanks
-Vincent

Discussion

  • Oliver Burn

    Oliver Burn - 2002-04-04

    Logged In: YES
    user_id=218824

    I agree that the "public" keyword is redundant for a method
    in an interface. Personally I avoid using it. Curious, do
    you have a reference that says not to specify it??

    Agree, that Checkstyle could check for it. Not sure whether
    the check should be on by default. Depends on what Sun
    suggests I guess.

     
  • Vincent Massol

    Vincent Massol - 2002-04-11

    Logged In: YES
    user_id=22169

    No, I have no clue whether or not it is mentioned (or
    where) in the Sun coding conventions. I was told about
    this on the Avalon mailing list by Paul Hammant.

    Thanks
    -Vincent

     
  • Lars Kühne

    Lars Kühne - 2002-04-12

    Logged In: YES
    user_id=401384

    Chapter 9.4 of the JLS,
    http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html#78651

    --snip
    It is permitted, but strongly discouraged as a matter of
    style, to redundantly specify the public modifier for
    interface methods.
    --snip

    Now that's what I call a vague hint how to set the default ;-)

     
  • Lars Kühne

    Lars Kühne - 2002-04-21

    Logged In: YES
    user_id=401384

    This is now implemented in CVS and will be available in the
    next release

     
  • Oliver Burn

    Oliver Burn - 2002-04-22

    Logged In: YES
    user_id=218824

    nice one

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks