patch for unnecessary code

"Ray Malanga" <[email protected]> Sat, 12 Mar 2005 14:18:03 -0500
Newsgroups gmane.comp.db.village.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C5270E.4E912E50
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

I just joined village today, and got the latest from CVS, so I don't know if
anyone else submitted this (sorry if its a duplicate).
 
I checked out the source from CVS and compiled on eclipse 3.0.1 and it had a
bunch of compiler warnings.  
These two are the only ones worthy of mention at this time (and addressed in
the attached patch).  
I figured the rest were due to changes in progress.
 
1)
file: /home/cvspublic/village/com/workingdogs/village/KeyDef.java, in method
public boolean containsAttrib (String name)
In the line: 

return (mySelf.indexOf ((Object) name) == -1) ? false : true;

It is unnecessary to cast a String as an Object, as String descends Object.
The attached patch just changes this line to:

return (mySelf.indexOf (name) == -1) ? false : true;


2)
file: /home/cvspublic/village/com/workingdogs/village/TestMySQL.java, in
method public static void debug(int type, String method, int value)
In the line:

debug (type, method, new String().valueOf(value));

valueOf is a static method of String.  Instance qualification is not
necessary (and places unnecessary instantiation / finalization overhead on
the JVM)
The patch changes this line to:

debug (type, method, String.valueOf(value));

The attached patch is in unified format, generated against current CVS, not
5 minutes ago :)

- Ray M

------=_NextPart_000_0000_01C5270E.4E912E50
Content-Type: application/octet-stream;
	name="village-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="village-patch"

Index: KeyDef.java
===================================================================
RCS file: /home/cvspublic/village/com/workingdogs/village/KeyDef.java,v
retrieving revision 1.5
diff -u -r1.5 KeyDef.java
--- KeyDef.java	10 Sep 2001 20:35:32 -0000	1.5
+++ KeyDef.java	12 Mar 2005 19:14:13 -0000
@@ -113,7 +113,7 @@
      */
     public boolean containsAttrib (String name)
     {
-        return (mySelf.indexOf ((Object) name) == -1) ? false : true;
+        return (mySelf.indexOf (name) == -1) ? false : true;
     }
 
     /**
Index: TestMySQL.java
===================================================================
RCS file: /home/cvspublic/village/com/workingdogs/village/TestMySQL.java,v
retrieving revision 1.10
diff -u -r1.10 TestMySQL.java
--- TestMySQL.java	30 Jul 2002 23:20:51 -0000	1.10
+++ TestMySQL.java	12 Mar 2005 19:14:13 -0000
@@ -521,7 +521,7 @@
 
     public static void debug(int type, String method, int value)
     {
-        debug (type, method, new String().valueOf(value));
+        debug (type, method, String.valueOf(value));
     }
 
     public static void test (int type, int test, int value)

------=_NextPart_000_0000_01C5270E.4E912E50
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Village-dev mailing list
[email protected]
http://share.whichever.com/mailman/listinfo/village-dev

------=_NextPart_000_0000_01C5270E.4E912E50--