[cp-patches] [RFC/PATCH 1/6] Fix java/lang/reflect/Member.getDeclaringClass() return type
Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/reflect/Member.java |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/java/lang/reflect/Member.java b/java/lang/reflect/Member.java index fed962c..945fbf6 100644 --- a/java/lang/reflect/Member.java +++ b/java/lang/reflect/Member.java @@ -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 -- 1.7.6.5
[cp-patches] [RFC/PATCH 5/6] Add missing Java 1.7 ReflectiveOperationException class
Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/ClassNotFoundException.java|6 +- java/lang/IllegalAccessException.java|6 +- java/lang/InstantiationException.java|6 +- java/lang/NoSuchFieldException.java |6 +- java/lang/NoSuchMethodException.java |6 +- java/lang/ReflectiveOperationException.java | 88 ++ java/lang/reflect/InvocationTargetException.java |6 +- 7 files changed, 106 insertions(+), 18 deletions(-) create mode 100644 java/lang/ReflectiveOperationException.java diff --git a/java/lang/ClassNotFoundException.java b/java/lang/ClassNotFoundException.java index 142bc5d..fe1424d 100644 --- a/java/lang/ClassNotFoundException.java +++ b/java/lang/ClassNotFoundException.java @@ -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+. diff --git a/java/lang/IllegalAccessException.java b/java/lang/IllegalAccessException.java index a352c8b..2574f66 100644 --- a/java/lang/IllegalAccessException.java +++ b/java/lang/IllegalAccessException.java @@ -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+. diff --git a/java/lang/InstantiationException.java b/java/lang/InstantiationException.java index 367b14b..cb2cad1 100644 --- a/java/lang/InstantiationException.java +++ b/java/lang/InstantiationException.java @@ -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 (warr...@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+. diff --git a/java/lang/NoSuchFieldException.java b/java/lang/NoSuchFieldException.java index 74d52d1..b43b532 100644 --- a/java/lang/NoSuchFieldException.java +++ b/java/lang/NoSuchFieldException.java @@ -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 (warr...@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+. diff --git a/java/lang/NoSuchMethodException.java b/java/lang/NoSuchMethodException.java index e423efb..1162382 100644 --- a/java/lang/NoSuchMethodException.java +++ b/java/lang/NoSuchMethodException.java @@ -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 (warr...@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+. diff --git
[cp-patches] [RFC/PATCH 6/6] Add missing Java 1.7 java/lang/reflect/Modifier methods
Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/reflect/Modifier.java | 42 ++- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/java/lang/reflect/Modifier.java b/java/lang/reflect/Modifier.java index 15bad05..c75f7b8 100644 --- a/java/lang/reflect/Modifier.java +++ b/java/lang/reflect/Modifier.java @@ -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. @@ -300,6 +300,46 @@ public class Modifier } /** + * @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: * codelt;public|protected|privategt; abstract static final transient -- 1.7.6.5
[cp-patches] [RFC/PATCH 4/6] Add missing Java 1.7 constructors to java/lang classes
Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/AssertionError.java | 14 +- java/lang/LinkageError.java | 17 +++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/java/lang/AssertionError.java b/java/lang/AssertionError.java index 778eb58..cf953f4 100644 --- a/java/lang/AssertionError.java +++ b/java/lang/AssertionError.java @@ -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); + } } diff --git a/java/lang/LinkageError.java b/java/lang/LinkageError.java index 0287020..34b0725 100644 --- a/java/lang/LinkageError.java +++ b/java/lang/LinkageError.java @@ -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 (tro...@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); + } + } -- 1.7.6.5
[cp-patches] [RFC/PATCH 3/6] Add missing Java 1.7 compare() API methods to java/lang classes
Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/Boolean.java | 15 +++ java/lang/Byte.java | 17 + java/lang/Character.java | 17 + java/lang/Integer.java | 17 + java/lang/Long.java | 17 + java/lang/Short.java | 17 + 6 files changed, 100 insertions(+), 0 deletions(-) diff --git a/java/lang/Boolean.java b/java/lang/Boolean.java index f2eaf41..0e4afa8 100644 --- a/java/lang/Boolean.java +++ b/java/lang/Boolean.java @@ -237,6 +237,21 @@ public final class Boolean implements Serializable, ComparableBoolean } /** + * 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. * diff --git a/java/lang/Byte.java b/java/lang/Byte.java index a1536e1..01e0e03 100644 --- a/java/lang/Byte.java +++ b/java/lang/Byte.java @@ -370,4 +370,21 @@ public final class Byte extends Number implements ComparableByte 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)); + } + } diff --git a/java/lang/Character.java b/java/lang/Character.java index 05e641c..f87cde6 100644 --- a/java/lang/Character.java +++ b/java/lang/Character.java @@ -4200,6 +4200,23 @@ public final class Character implements Serializable, ComparableCharacter } /** + * 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 codeCharacter/code object wrapping the value. * In contrast to the codeCharacter/code constructor, this method * will cache some values. It is used by boxing conversion. diff --git a/java/lang/Integer.java b/java/lang/Integer.java index f379795..25eb5d5 100644 --- a/java/lang/Integer.java +++ b/java/lang/Integer.java @@ -586,6 +586,23 @@ public final class Integer extends Number implements ComparableInteger } /** + * 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 * @since 1.5 diff --git a/java/lang/Long.java b/java/lang/Long.java index e7579d8..6f31dfa 100644 --- a/java/lang/Long.java +++ b/java/lang/Long.java @@ -585,6 +585,23 @@ public final class Long extends Number implements ComparableLong } /** + * 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 * @since 1.5 diff --git a/java/lang/Short.java b/java/lang/Short.java index ec87f93..fae9fe7 100644 --- a/java/lang/Short.java +++ b/java/lang/Short.java @@ -373,6 +373,23 @@ public final class Short extends Number implements ComparableShort } /** + *
[cp-patches] [RFC/PATCH 2/6] Add missing java/lang/System.lineSeparator() method
Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/System.java | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/java/lang/System.java b/java/lang/System.java index 51b3259..9d86991 100644 --- a/java/lang/System.java +++ b/java/lang/System.java @@ -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 @@ -713,6 +715,16 @@ public final class System } /** + * Returns the system-dependent line separator. + * + * @return the system-dependent line separator. + */ + public static String lineSeparator() + { +return LINE_SEPARATOR; + } + + /** * This is a specialised codeCollection/code, providing * the necessary provisions for the collections used by the * environment variable map. Namely, it prevents -- 1.7.6.5
Re: [cp-patches] [RFC/PATCH 1/6] Fix java/lang/reflect/Member.getDeclaringClass() return type
- Original Message - Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/reflect/Member.java |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/java/lang/reflect/Member.java b/java/lang/reflect/Member.java index fed962c..945fbf6 100644 --- a/java/lang/reflect/Member.java +++ b/java/lang/reflect/Member.java @@ -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 -- 1.7.6.5 Fine. This one's trivial. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07
Re: [cp-patches] [RFC/PATCH 4/6] Add missing Java 1.7 constructors to java/lang classes
- Original Message - Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/AssertionError.java | 14 +- java/lang/LinkageError.java | 17 +++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/java/lang/AssertionError.java b/java/lang/AssertionError.java index 778eb58..cf953f4 100644 --- a/java/lang/AssertionError.java +++ b/java/lang/AssertionError.java @@ -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); + } } diff --git a/java/lang/LinkageError.java b/java/lang/LinkageError.java index 0287020..34b0725 100644 --- a/java/lang/LinkageError.java +++ b/java/lang/LinkageError.java @@ -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 (tro...@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); + } + } -- 1.7.6.5 Fine. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07
Re: [cp-patches] [RFC/PATCH 5/6] Add missing Java 1.7 ReflectiveOperationException class
- Original Message - Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/ClassNotFoundException.java|6 +- java/lang/IllegalAccessException.java|6 +- java/lang/InstantiationException.java|6 +- java/lang/NoSuchFieldException.java |6 +- java/lang/NoSuchMethodException.java |6 +- java/lang/ReflectiveOperationException.java | 88 ++ java/lang/reflect/InvocationTargetException.java |6 +- 7 files changed, 106 insertions(+), 18 deletions(-) create mode 100644 java/lang/ReflectiveOperationException.java diff --git a/java/lang/ClassNotFoundException.java b/java/lang/ClassNotFoundException.java index 142bc5d..fe1424d 100644 --- a/java/lang/ClassNotFoundException.java +++ b/java/lang/ClassNotFoundException.java @@ -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+. diff --git a/java/lang/IllegalAccessException.java b/java/lang/IllegalAccessException.java index a352c8b..2574f66 100644 --- a/java/lang/IllegalAccessException.java +++ b/java/lang/IllegalAccessException.java @@ -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+. diff --git a/java/lang/InstantiationException.java b/java/lang/InstantiationException.java index 367b14b..cb2cad1 100644 --- a/java/lang/InstantiationException.java +++ b/java/lang/InstantiationException.java @@ -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 (warr...@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+. diff --git a/java/lang/NoSuchFieldException.java b/java/lang/NoSuchFieldException.java index 74d52d1..b43b532 100644 --- a/java/lang/NoSuchFieldException.java +++ b/java/lang/NoSuchFieldException.java @@ -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 (warr...@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+. diff --git a/java/lang/NoSuchMethodException.java b/java/lang/NoSuchMethodException.java index e423efb..1162382 100644 --- a/java/lang/NoSuchMethodException.java +++ b/java/lang/NoSuchMethodException.java @@ -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 (warr...@cygnus.com) - * @status updated to 1.4 + * @status updated to 1.7 */ -public
Re: [cp-patches] [RFC/PATCH 2/6] Add missing java/lang/System.lineSeparator() method
- Original Message - Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/System.java | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/java/lang/System.java b/java/lang/System.java index 51b3259..9d86991 100644 --- a/java/lang/System.java +++ b/java/lang/System.java @@ -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 @@ -713,6 +715,16 @@ public final class System } /** + * Returns the system-dependent line separator. + * + * @return the system-dependent line separator. + */ + public static String lineSeparator() + { +return LINE_SEPARATOR; + } + + /** * This is a specialised codeCollection/code, providing * the necessary provisions for the collections used by the * environment variable map. Namely, it prevents -- 1.7.6.5 Fine. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07
Re: [cp-patches] [RFC/PATCH 3/6] Add missing Java 1.7 compare() API methods to java/lang classes
- Original Message - Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/Boolean.java | 15 +++ java/lang/Byte.java | 17 + java/lang/Character.java | 17 + java/lang/Integer.java | 17 + java/lang/Long.java | 17 + java/lang/Short.java | 17 + 6 files changed, 100 insertions(+), 0 deletions(-) diff --git a/java/lang/Boolean.java b/java/lang/Boolean.java index f2eaf41..0e4afa8 100644 --- a/java/lang/Boolean.java +++ b/java/lang/Boolean.java @@ -237,6 +237,21 @@ public final class Boolean implements Serializable, ComparableBoolean } /** + * 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. * diff --git a/java/lang/Byte.java b/java/lang/Byte.java index a1536e1..01e0e03 100644 --- a/java/lang/Byte.java +++ b/java/lang/Byte.java @@ -370,4 +370,21 @@ public final class Byte extends Number implements ComparableByte 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)); + } + } diff --git a/java/lang/Character.java b/java/lang/Character.java index 05e641c..f87cde6 100644 --- a/java/lang/Character.java +++ b/java/lang/Character.java @@ -4200,6 +4200,23 @@ public final class Character implements Serializable, ComparableCharacter } /** + * 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 codeCharacter/code object wrapping the value. * In contrast to the codeCharacter/code constructor, this method * will cache some values. It is used by boxing conversion. diff --git a/java/lang/Integer.java b/java/lang/Integer.java index f379795..25eb5d5 100644 --- a/java/lang/Integer.java +++ b/java/lang/Integer.java @@ -586,6 +586,23 @@ public final class Integer extends Number implements ComparableInteger } /** + * 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 * @since 1.5 diff --git a/java/lang/Long.java b/java/lang/Long.java index e7579d8..6f31dfa 100644 --- a/java/lang/Long.java +++ b/java/lang/Long.java @@ -585,6 +585,23 @@ public final class Long extends Number implements ComparableLong } /** + * 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 * @since 1.5 diff --git a/java/lang/Short.java b/java/lang/Short.java index
Re: [cp-patches] [RFC/PATCH 6/6] Add missing Java 1.7 java/lang/reflect/Modifier methods
- Original Message - Signed-off-by: Pekka Enberg penb...@kernel.org --- java/lang/reflect/Modifier.java | 42 ++- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/java/lang/reflect/Modifier.java b/java/lang/reflect/Modifier.java index 15bad05..c75f7b8 100644 --- a/java/lang/reflect/Modifier.java +++ b/java/lang/reflect/Modifier.java @@ -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. @@ -300,6 +300,46 @@ public class Modifier } /** + * @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: * codelt;public|protected|privategt; abstract static final transient -- 1.7.6.5 Looks good. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07