From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13847 invoked by alias); 16 Jul 2007 04:59:31 -0000 Received: (qmail 13839 invoked by uid 22791); 16 Jul 2007 04:59:30 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 16 Jul 2007 04:59:27 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l6G4xPpo006829 for ; Mon, 16 Jul 2007 00:59:25 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l6G4xPVh019778 for ; Mon, 16 Jul 2007 00:59:25 -0400 Received: from opsy.redhat.com (ton.toronto.redhat.com [172.16.14.15]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l6G4xOBO011617; Mon, 16 Jul 2007 00:59:24 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 745ED508213; Sun, 15 Jul 2007 22:41:54 -0600 (MDT) To: GCJ-patches Subject: Patch: FYI: File -vs- Comparable From: Tom Tromey Reply-To: Tom Tromey X-Attribution: Tom Date: Mon, 16 Jul 2007 04:59:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2007-q3/txt/msg00076.txt.bz2 I'm checking this in. It came to my attention the other day that File should implement Comparable, not just Comparable. This is already the case in Classpath but the change was never merged. Tom 2007-07-15 Tom Tromey * java/io/File.java: Implement Comparable. (compareTo): Removed. * java/io/File.h: Rebuilt. * classpath/lib/java/io/File.class: Rebuilt. Index: java/io/File.java =================================================================== --- java/io/File.java (revision 126662) +++ java/io/File.java (working copy) @@ -1,5 +1,5 @@ /* File.java -- Class representing a file on disk - Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 + Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -59,7 +59,7 @@ * @author Aaron M. Renn (arenn@urbanophile.com) * @author Tom Tromey (tromey@cygnus.com) */ -public class File implements Serializable, Comparable +public class File implements Serializable, Comparable { private static final long serialVersionUID = 301077366599181567L; @@ -103,7 +103,7 @@ /** * This is the string that is used to separate the host name from the - * path name in paths than include the host name. It is the value of + * path name in paths that include the host name. It is the value of * the path.separator system property. */ public static final String pathSeparator @@ -454,7 +454,8 @@ * This method initializes a new File object to represent * a file corresponding to the specified file: protocol URI. * - * @param uri The uri. + * @param uri The URI + * @throws IllegalArgumentException if the URI is not hierarchical */ public File(URI uri) { @@ -605,7 +606,8 @@ /** * This method returns a String the represents this file's * parent. null is returned if the file has no parent. The - * parent is determined via a simple operation which removes the + * parent is determined via a simple operation which removes the name + * after the last file separator character, as determined by the platform. * * @return The parent directory of this file */ @@ -1445,32 +1447,6 @@ return path.compareToIgnoreCase (other.path); } - /** - * This method compares the specified Object to this one - * to test for equality. It does this by comparing the canonical path names - * of the files. This method is identical to compareTo(File) - * except that if the Object passed to it is not a - * File, it throws a ClassCastException - *

- * The canonical paths of the files are determined by calling the - * getCanonicalPath method on each object. - *

- * This method returns a 0 if the specified Object is equal - * to this one, a negative value if it is less than this one - * a positive value if it is greater than this one. - * - * @return An integer as described above - * - * @exception ClassCastException If the passed Object is - * not a File - * - * @since 1.2 - */ - public int compareTo(Object obj) - { - return compareTo((File) obj); - } - /* * This native method actually performs the rename. */