logo       


Re: Patch: FYI: more standards updates: msg#00119

Subject: Re: Patch: FYI: more standards updates
I'm checking in the appended.  This updates the hacking documentation
to take into account some things Eric pointed out.

Eric> Other ideas: Do we have a preferred order for declarations?  For
Eric> example, some classes list fields, constructors, methods, then nested
Eric> classes; and either sort alphabetically or follow the order they are
Eric> documented in Sun's API documentation.

I don't think we have an agreed-upon rule here.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@xxxxxxxxxx>

        * doc/hacking.texinfo (Programming Standards): Added more
        guidelines.

Index: doc/hacking.texinfo
===================================================================
RCS file: /cvsroot/classpath/classpath/doc/hacking.texinfo,v
retrieving revision 1.15
diff -u -r1.15 hacking.texinfo
--- doc/hacking.texinfo 9 Jan 2004 20:55:58 -0000 1.15
+++ doc/hacking.texinfo 30 Jan 2004 23:27:00 -0000
@@ -386,15 +386,35 @@
 @end example
 
 @item
-Don't use redundant modifiers.  For instance, all members of an
-interface are implicitly @code{public}, so there is no need to
-explicitly declare them as @code{public}.
+Don't use redundant modifiers.  Here is some sample code that shows
+redundant modifiers in comments:
+
+@example
+/*abstract*/ interface I {
+   /*public abstract*/ void m();
+   /*public static final*/ int i = 1;
+   /*public static*/ class Inner {}
+}
+final class C {
+   /*final*/ void m() {}
+}
+@end example
+
+Note that Jikes will generate warnings for these if you use
+@code{+Predundant-modifiers} on the command line.
+
+@item
+Modifiers should be listed in the standard order recommended by the
+JLS.  Jikes will warn for this when given @code{+Pmodifier-order}.
 
 @item
 Because the output of different compilers differs, we have
 standardized on explicitly specifying @code{serialVersionUID} in
 @code{Serializable} classes in Classpath.  This field should be
-declared as @code{private static final}.
+declared as @code{private static final}.  Note that a class may be
+@code{Serializable} without being explicitly marked as such, due to
+inheritance.  For instance, all subclasses of @code{Throwable} need to
+have @code{serialVersionUID} declared.
 @c fixme index
 @c fixme link to the discussion
 
@@ -402,6 +422,10 @@
 Don't declare unchecked exceptions in the @code{throws} clause of a
 method.  However, if throwing an unchecked exception is part of the
 method's API, you should mention it in the Javadoc.
+
+@item
+When overriding @code{Object.equals}, remember that @code{instanceof}
+filters out @code{null}, so an explicit check is not needed.
 
 @end itemize


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe