classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: redundant field initializers


From: Dalibor Topic
Subject: Re: redundant field initializers
Date: Mon, 20 Sep 2004 11:56:29 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

Jeroen Frijters wrote:
Hi Jeroen,

-  private static InitialContextFactoryBuilder icfb = null;
+  private static InitialContextFactoryBuilder icfb;
Making this change removes the need for the compiler to create a static
initializer.

Does everyone agree that this is a good idea? If so, how far should we
take this? How about this change:

Looks good and useful to me.

Index: java/awt/EventDispatchThread.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/java/awt/EventDispatchThread.java,v
retrieving revision 1.4
diff -u -r1.4 EventDispatchThread.java
--- java/awt/EventDispatchThread.java   31 May 2004 21:11:46 -0000
1.4
+++ java/awt/EventDispatchThread.java   19 Sep 2004 09:52:47 -0000
@@ -42,14 +42,14 @@
class EventDispatchThread extends Thread
 {
-  private static int dispatchThreadNum = 1;
+  private static int dispatchThreadNum;
private EventQueue queue; EventDispatchThread(EventQueue queue)
   {
     super();
-    setName("AWT-EventQueue-" + dispatchThreadNum++);
+    setName("AWT-EventQueue-" + ++dispatchThreadNum);
     this.queue = queue;
     setPriority(NORM_PRIORITY + 1);
     start();

I like the idea. I think that's OK for private fields, that are not used in inner classes. But Tom's patch should make them explicitely non-privat, so that's the only temporal caveat I can think of.

cheers,
dalibor topic




reply via email to

[Prev in Thread] Current Thread [Next in Thread]