diff options
author | Tom Tromey <tromey@redhat.com> | 2007-07-16 05:00:28 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-07-16 05:00:28 +0000 |
commit | 6e7b20ac6e8b1446e10418b911ea5c007d51d8ac (patch) | |
tree | 860fe78d86598e2fda61d7494de344ebdf51c77a /libjava | |
parent | 6f04e85d9cc4848ca37ccf0d9b669c91fc0b6e33 (diff) | |
download | gcc-6e7b20ac6e8b1446e10418b911ea5c007d51d8ac.tar.gz |
File.java: Implement Comparable<File>.
* java/io/File.java: Implement Comparable<File>.
(compareTo): Removed.
* java/io/File.h: Rebuilt.
* classpath/lib/java/io/File.class: Rebuilt.
From-SVN: r126670
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 7 | ||||
-rw-r--r-- | libjava/classpath/lib/java/io/File.class | bin | 14275 -> 14356 bytes | |||
-rw-r--r-- | libjava/java/io/File.h | 6 | ||||
-rw-r--r-- | libjava/java/io/File.java | 38 | ||||
-rw-r--r-- | libjava/prims.cc | 21 |
5 files changed, 30 insertions, 42 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 229832bd74d..510d5f71316 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2007-07-15 Tom Tromey <tromey@redhat.com> + + * java/io/File.java: Implement Comparable<File>. + (compareTo): Removed. + * java/io/File.h: Rebuilt. + * classpath/lib/java/io/File.class: Rebuilt. + 2007-07-14 Tom Tromey <tromey@redhat.com> * Rebuilt .class files. diff --git a/libjava/classpath/lib/java/io/File.class b/libjava/classpath/lib/java/io/File.class Binary files differindex d4cf93dbf97..746da883bc8 100644 --- a/libjava/classpath/lib/java/io/File.class +++ b/libjava/classpath/lib/java/io/File.class diff --git a/libjava/java/io/File.h b/libjava/java/io/File.h index 92cfbb7e1db..b53f6ab7d02 100644 --- a/libjava/java/io/File.h +++ b/libjava/java/io/File.h @@ -111,8 +111,7 @@ private: public: static JArray< ::java::io::File * > * listRoots(); static ::java::io::File * createTempFile(::java::lang::String *, ::java::lang::String *); - virtual jint compareTo(::java::io::File *); - virtual jint compareTo(::java::lang::Object *); + virtual jint File$compareTo(::java::io::File *); private: jboolean performRenameTo(::java::io::File *); public: @@ -130,6 +129,9 @@ public: private: void writeObject(::java::io::ObjectOutputStream *); void readObject(::java::io::ObjectInputStream *); +public: + virtual jint compareTo(::java::lang::Object *); +private: static const jlong serialVersionUID = 301077366599181567LL; static const jint READ = 0; static const jint WRITE = 1; diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java index 0026ffaeedf..67d1b96df6c 100644 --- a/libjava/java/io/File.java +++ b/libjava/java/io/File.java @@ -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 @@ import gnu.classpath.Configuration; * @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<File> { private static final long serialVersionUID = 301077366599181567L; @@ -103,7 +103,7 @@ public class File implements Serializable, Comparable /** * 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 <code>path.separator</code> system property. */ public static final String pathSeparator @@ -454,7 +454,8 @@ public class File implements Serializable, Comparable * This method initializes a new <code>File</code> object to represent * a file corresponding to the specified <code>file:</code> 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 @@ public class File implements Serializable, Comparable /** * This method returns a <code>String</code> the represents this file's * parent. <code>null</code> 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 @@ public class File implements Serializable, Comparable return path.compareToIgnoreCase (other.path); } - /** - * This method compares the specified <code>Object</code> to this one - * to test for equality. It does this by comparing the canonical path names - * of the files. This method is identical to <code>compareTo(File)</code> - * except that if the <code>Object</code> passed to it is not a - * <code>File</code>, it throws a <code>ClassCastException</code> - * <p> - * The canonical paths of the files are determined by calling the - * <code>getCanonicalPath</code> method on each object. - * <p> - * This method returns a 0 if the specified <code>Object</code> 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 <code>Object</code> is - * not a <code>File</code> - * - * @since 1.2 - */ - public int compareTo(Object obj) - { - return compareTo((File) obj); - } - /* * This native method actually performs the rename. */ diff --git a/libjava/prims.cc b/libjava/prims.cc index 706ab4b7a3e..5d3a260e9d0 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -1262,7 +1262,11 @@ parse_x_arg (char* option_string) { // FIXME: fail if impossible to share class data } - + else + { + // Unrecognized. + return -1; + } return 0; } @@ -1571,21 +1575,20 @@ parse_init_args (JvVMInitArgs* vm_args) JVMTI::enabled = true; continue; } - else if (vm_args->ignoreUnrecognized) + else { + int r = -1; if (option_string[0] == '_') - parse_x_arg (option_string + 1); - else if (! strncmp (option_string, "-X", 2)) - parse_x_arg (option_string + 2); - else + r = parse_x_arg (option_string + 1); + else if (! strncmp (option_string, "-X", 2)) + r = parse_x_arg (option_string + 2); + + if (r == -1 && ! vm_args->ignoreUnrecognized) { - unknown_option: fprintf (stderr, "libgcj: unknown option: %s\n", option_string); return -1; } } - else - goto unknown_option; } return 0; } |