This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Patch: java.net


Hi list,


I commited the attached obvious patch to remove some obj == null checks.
They are redundant because the instanceof operator checks this too.


Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2305
diff -u -b -B -r1.2305 ChangeLog
--- ChangeLog	29 Oct 2003 10:33:52 -0000	1.2305
+++ ChangeLog	29 Oct 2003 10:50:42 -0000
@@ -1,5 +1,15 @@
 2003-10-29  Michael Koch  <konqueror@gmx.de>
 
+	* java/net/InetAddress.java
+	(equals): Remove redundant obj == null check.
+	* java/net/SocketPermission.java
+	(equals): Likewise.
+	* java/net/URL.java
+	(equals): Likewise.
+	(getURLStreamHandler): Likewise.
+
+2003-10-29  Michael Koch  <konqueror@gmx.de>
+
 	* gnu/java/net/natPlainDatagramSocketImplPosix.cc
 	(setOption): Directly return if no error occured.
 	* gnu/java/net/natPlainSocketImplPosix.cc
Index: java/net/InetAddress.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/InetAddress.java,v
retrieving revision 1.23
diff -u -b -B -r1.23 InetAddress.java
--- java/net/InetAddress.java	2 Oct 2003 15:17:13 -0000	1.23
+++ java/net/InetAddress.java	29 Oct 2003 10:50:45 -0000
@@ -476,8 +476,7 @@
    */
   public boolean equals (Object obj)
   {
-    if (obj == null
-        || ! (obj instanceof InetAddress))
+    if (! (obj instanceof InetAddress))
       return false;
     
     // "The Java Class Libraries" 2nd edition says "If a machine has
Index: java/net/SocketPermission.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/SocketPermission.java,v
retrieving revision 1.9
diff -u -b -B -r1.9 SocketPermission.java
--- java/net/SocketPermission.java	26 May 2003 12:58:02 -0000	1.9
+++ java/net/SocketPermission.java	29 Oct 2003 10:50:45 -0000
@@ -147,9 +147,6 @@
    */
   public boolean equals(Object obj)
   {
-    if (obj == null)
-      return (false);
-
     if (!(obj instanceof SocketPermission))
       return (false);
 
Index: java/net/URL.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URL.java,v
retrieving revision 1.30
diff -u -b -B -r1.30 URL.java
--- java/net/URL.java	8 Oct 2003 16:28:30 -0000	1.30
+++ java/net/URL.java	29 Oct 2003 10:50:47 -0000
@@ -451,7 +451,7 @@
    */
   public boolean equals (Object obj)
   {
-    if (obj == null || ! (obj instanceof URL))
+    if (! (obj instanceof URL))
       return false;
 
     return ph.equals (this, (URL) obj);
@@ -829,8 +829,7 @@
                 // Can't instantiate; handler still null, go on to next element.
               }
           }
-	while ((ph == null ||
-		!(ph instanceof URLStreamHandler))
+	while ((! (ph instanceof URLStreamHandler))
                && pkgPrefix.hasMoreTokens());
       }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]