Import GNU Classpath (20121202).

2012-12-19  Matthias Klose  <doko@ubuntu.com>

        Import GNU Classpath (20121202).

        * Regenerate class and header files.
        * Regenerate auto* files.
        * sources.am, gcj/javaprims.h: Regenerate.
        * gnu/java/nio/FileLockImpl.java (close): New override.

From-SVN: r194618
This commit is contained in:
Matthias Klose 2012-12-19 17:03:15 +00:00
parent baeb2e1647
commit a1906e8bbf
454 changed files with 5224 additions and 2925 deletions

View file

@ -1,5 +1,5 @@
/* AssertionError.java -- indication of a failed assertion
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2005, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -145,4 +145,16 @@ public class AssertionError extends Error
{
super(Double.toString(msg));
}
/**
* Construct an AssertionError with detail message and cause.
*
* @param msg Detail message.
* @param cause The cause of this exception, may be null
* @since 1.7
*/
public AssertionError(String msg, Throwable cause)
{
super(msg, cause);
}
}

View file

@ -0,0 +1,50 @@
/* AutoCloseable.java -- Resource that must be closed after it is no longer
used.
Copyright (C) 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.lang;
/**
* Resource that must be closed after it is no longer used.
*
* @since 1.7
*/
public interface AutoCloseable
{
void close() throws Exception;
}

View file

@ -236,6 +236,21 @@ public final class Boolean implements Serializable, Comparable<Boolean>
return value == other.value ? 0 : (value ? 1 : -1);
}
/**
* Compares two unboxed boolean values.
*
* @param x First value to compare.
* @param y Second value to compare.
* @return 0 if both Booleans represent the same value, a positive number
* if this Boolean represents true and the other false, and a negative
* number otherwise.
* @since 1.7
*/
public static int compare(boolean x, boolean y)
{
return Boolean.valueOf(x).compareTo(Boolean.valueOf(y));
}
/**
* If the String argument is "true", ignoring case, return true.
* Otherwise, return false.

View file

@ -370,4 +370,21 @@ public final class Byte extends Number implements Comparable<Byte>
return value - b.value;
}
/**
* Compares two unboxed byte values.
* The result is positive if the first is greater, negative if the second
* is greater, and 0 if the two are equal.
*
* @param x First value to compare.
* @param y Second value to compare.
*
* @return positive int if the first value is greater, negative if the second
* is greater, and 0 if the two are equal.
* @since 1.7
*/
public static int compare(byte x, byte y)
{
return Byte.valueOf(x).compareTo(Byte.valueOf(y));
}
}

View file

@ -4199,6 +4199,23 @@ public final class Character implements Serializable, Comparable<Character>
return value - anotherCharacter.value;
}
/**
* Compares two unboxed char values.
* The result is positive if the first is greater, negative if the second
* is greater, and 0 if the two are equal.
*
* @param x First value to compare.
* @param y Second value to compare.
*
* @return positive int if the first value is greater, negative if the second
* is greater, and 0 if the two are equal.
* @since 1.7
*/
public static int compare(char x, char y)
{
return Character.valueOf(x).compareTo(Character.valueOf(y));
}
/**
* Returns an <code>Character</code> object wrapping the value.
* In contrast to the <code>Character</code> constructor, this method

View file

@ -1,5 +1,5 @@
/* ClassNotFoundException.java -- thrown when class definition cannot be found
Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 2002, 2005, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -47,9 +47,9 @@ package java.lang;
* @see Class#forName(String)
* @see ClassLoader#findSystemClass(String)
* @see ClassLoader#loadClass(String, boolean)
* @status updated to 1.4
* @status updated to 1.7
*/
public class ClassNotFoundException extends Exception
public class ClassNotFoundException extends ReflectiveOperationException
{
/**
* Compatible with JDK 1.0+.

View file

@ -1,6 +1,6 @@
/* IllegalAccessException.java -- thrown on attempt to reflect on
inaccessible data
Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -71,9 +71,9 @@ import java.lang.reflect.Method;
* @see Field#getDouble(Object)
* @see Method#invoke(Object, Object[])
* @see Constructor#newInstance(Object[])
* @status updated to 1.4
* @status updated to 1.7
*/
public class IllegalAccessException extends Exception
public class IllegalAccessException extends ReflectiveOperationException
{
/**
* Compatible with JDK 1.0+.

View file

@ -1,6 +1,6 @@
/* InstantiationException.java -- thrown when reflection cannot create an
instance
Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -46,9 +46,9 @@ package java.lang;
* @author Brian Jones
* @author Warren Levy (warrenl@cygnus.com)
* @see Class#newInstance()
* @status updated to 1.4
* @status updated to 1.7
*/
public class InstantiationException extends Exception
public class InstantiationException extends ReflectiveOperationException
{
/**
* Compatible with JDK 1.0+.

View file

@ -585,6 +585,23 @@ public final class Integer extends Number implements Comparable<Integer>
return value > i.value ? 1 : -1;
}
/**
* Compares two unboxed int values.
* The result is positive if the first is greater, negative if the second
* is greater, and 0 if the two are equal.
*
* @param x First value to compare.
* @param y Second value to compare.
*
* @return positive int if the first value is greater, negative if the second
* is greater, and 0 if the two are equal.
* @since 1.7
*/
public static int compare(int x, int y)
{
return Integer.valueOf(x).compareTo(Integer.valueOf(y));
}
/**
* Return the number of bits set in x.
* @param x value to examine

View file

@ -1,6 +1,6 @@
/* LinkageError.java -- thrown when classes valid at separate compile times
cannot be linked to each other
Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -46,7 +46,7 @@ package java.lang;
*
* @author Brian Jones
* @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
* @status updated to 1.7
*/
public class LinkageError extends Error
{
@ -71,4 +71,17 @@ public class LinkageError extends Error
{
super(s);
}
/**
* Construct an LinkageError with detail message and cause.
*
* @param msg Detail message.
* @param cause The cause of this exception, may be null
* @since 1.7
*/
public LinkageError(String msg, Throwable cause)
{
super(msg, cause);
}
}

View file

@ -584,6 +584,23 @@ public final class Long extends Number implements Comparable<Long>
return value > l.value ? 1 : -1;
}
/**
* Compares two unboxed long values.
* The result is positive if the first is greater, negative if the second
* is greater, and 0 if the two are equal.
*
* @param x First value to compare.
* @param y Second value to compare.
*
* @return positive int if the first value is greater, negative if the second
* is greater, and 0 if the two are equal.
* @since 1.7
*/
public static int compare(long x, long y)
{
return Long.valueOf(x).compareTo(Long.valueOf(y));
}
/**
* Return the number of bits set in x.
* @param x value to examine

View file

@ -1,5 +1,5 @@
/* NoSuchFieldException.java -- thrown when reflecting a non-existant field
Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -45,9 +45,9 @@ package java.lang;
* @author Brian Jones
* @author Warren Levy (warrenl@cygnus.com)
* @since 1.1
* @status updated to 1.4
* @status updated to 1.7
*/
public class NoSuchFieldException extends Exception
public class NoSuchFieldException extends ReflectiveOperationException
{
/**
* Compatible with JDK 1.1+.

View file

@ -1,5 +1,5 @@
/* NoSuchMethodException.java -- thrown when reflecting a non-existant method
Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -44,9 +44,9 @@ package java.lang;
*
* @author Brian Jones
* @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
* @status updated to 1.7
*/
public class NoSuchMethodException extends Exception
public class NoSuchMethodException extends ReflectiveOperationException
{
/**
* Compatible with JDK 1.0+.

View file

@ -0,0 +1,88 @@
/* ReflectiveOperationException.java -- thrown when reflective operation fails
Copyright (C) 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.lang;
/**
* This exception is thrown when reflective operations fail.
*
* @since 1.7
*/
public class ReflectiveOperationException extends Exception
{
private static final long serialVersionUID = 123456789L;
/**
* Create an exception without a message.
*/
public ReflectiveOperationException()
{
}
/**
* Create an exception with a message.
*
* @param s the message
*/
public ReflectiveOperationException(String s)
{
super(s);
}
/**
* Create an exception with a message and a cause.
*
* @param s the message
* @param cause the cause, may be null
*/
public ReflectiveOperationException(String message, Throwable cause)
{
super(message, cause);
}
/**
* Create an exception with a cause.
*
* @param cause the cause, may be null
*/
public ReflectiveOperationException(Throwable cause)
{
super(cause);
}
}

View file

@ -372,6 +372,23 @@ public final class Short extends Number implements Comparable<Short>
return value - s.value;
}
/**
* Compares two unboxed short values.
* The result is positive if the first is greater, negative if the second
* is greater, and 0 if the two are equal.
*
* @param x First value to compare.
* @param y Second value to compare.
*
* @return positive int if the first value is greater, negative if the second
* is greater, and 0 if the two are equal.
* @since 1.7
*/
public static int compare(short x, short y)
{
return Short.valueOf(x).compareTo(Short.valueOf(y));
}
/**
* Reverse the bytes in val.
* @since 1.5

View file

@ -705,6 +705,8 @@ public final class String
*/
public synchronized int codePointAt(int index)
{
if (index < 0 || index >= count)
throw new StringIndexOutOfBoundsException(index);
// Use the CharSequence overload as we get better range checking
// this way.
return Character.codePointAt(this, index);
@ -716,12 +718,14 @@ public final class String
* <code>index-2</code> to see if they form a supplementary code point.
* @param index the index just past the codepoint to get, starting at 0
* @return the codepoint at the specified index
* @throws IndexOutOfBoundsException if index is negative or &gt;= length()
* @throws IndexOutOfBoundsException if index is less than 1 or &gt; length()
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @since 1.5
*/
public synchronized int codePointBefore(int index)
{
if (index < 1 || index > count)
throw new StringIndexOutOfBoundsException(index);
// Use the CharSequence overload as we get better range checking
// this way.
return Character.codePointBefore(this, index);

View file

@ -97,6 +97,8 @@ public final class System
*/
public static final PrintStream out = VMSystem.makeStandardOutputStream();
private static final String LINE_SEPARATOR = SystemProperties.getProperty("line.separator");
/**
* The standard output PrintStream. This is assigned at startup and
* starts its life perfectly valid. Although it is marked final, you can
@ -712,6 +714,16 @@ public final class System
return Console.console();
}
/**
* Returns the system-dependent line separator.
*
* @return the system-dependent line separator.
*/
public static String lineSeparator()
{
return LINE_SEPARATOR;
}
/**
* This is a specialised <code>Collection</code>, providing
* the necessary provisions for the collections used by the

View file

@ -1,5 +1,5 @@
/* InvocationTargetException.java -- Wrapper exception for reflection
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -50,9 +50,9 @@ package java.lang.reflect;
* @see Method#invoke(Object,Object[])
* @see Constructor#newInstance(Object[])
* @since 1.1
* @status updated to 1.4
* @status updated to 1.7
*/
public class InvocationTargetException extends Exception
public class InvocationTargetException extends ReflectiveOperationException
{
/**
* Compatible with JDK 1.1+.

View file

@ -79,7 +79,7 @@ public interface Member
*
* @return the class that declared this member
*/
Class getDeclaringClass();
Class<?> getDeclaringClass();
/**
* Gets the simple name of this member. This will be a valid Java

View file

@ -1,5 +1,5 @@
/* java.lang.reflect.Modifier
Copyright (C) 1998, 1999, 2001, 2002, 2005, 2008 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002, 2005, 2008, 2012 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -299,6 +299,46 @@ public class Modifier
return (mod & VOLATILE) != 0;
}
/**
* @since 1.7
*/
public static int classModifiers()
{
return PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | FINAL | STRICT;
}
/**
* @since 1.7
*/
public static int interfaceModifiers()
{
return PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | STRICT;
}
/**
* @since 1.7
*/
public static int constructorModifiers()
{
return PUBLIC | PROTECTED | PRIVATE;
}
/**
* @since 1.7
*/
public static int methodModifiers()
{
return PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | FINAL | STRICT | SYNCHRONIZED | NATIVE;
}
/**
* @since 1.7
*/
public static int fieldModifiers()
{
return PUBLIC | PROTECTED | PRIVATE | STATIC | FINAL | TRANSIENT | VOLATILE;
}
/**
* Get a string representation of all the modifiers represented by the
* given int. The keywords are printed in this order: