diff options
author | gandalf <gandalf@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-23 15:19:26 +0000 |
---|---|---|
committer | gandalf <gandalf@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-23 15:19:26 +0000 |
commit | 5c7411981584e487ac41794feb98a66df9fd6fcb (patch) | |
tree | febe3d4d4c0c994db223fee8e819bde6582494c9 /libjava/classpath/java/lang | |
parent | 112dfe9f689af01c2dd00e0f153fc25d69095b6c (diff) | |
download | ppe42-gcc-5c7411981584e487ac41794feb98a66df9fd6fcb.tar.gz ppe42-gcc-5c7411981584e487ac41794feb98a66df9fd6fcb.zip |
Merge GNU Classpath 0.99 into libjava.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185741 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/lang')
-rw-r--r-- | libjava/classpath/java/lang/Class.java | 12 | ||||
-rw-r--r-- | libjava/classpath/java/lang/System.java | 11 |
2 files changed, 22 insertions, 1 deletions
diff --git a/libjava/classpath/java/lang/Class.java b/libjava/classpath/java/lang/Class.java index 1caee014736..af0a0a2a060 100644 --- a/libjava/classpath/java/lang/Class.java +++ b/libjava/classpath/java/lang/Class.java @@ -440,11 +440,14 @@ public final class Class<T> * @return the field * @throws NoSuchFieldException if the field does not exist * @throws SecurityException if the security check fails + * @throws NullPointerException if <code>fieldName</code> is null * @see #getDeclaredFields() * @since 1.1 */ public Field getDeclaredField(String name) throws NoSuchFieldException { + if (name == null) + throw new NullPointerException(); memberAccessCheck(Member.DECLARED); Field[] fields = getDeclaredFields(false); for (int i = 0; i < fields.length; i++) @@ -496,12 +499,15 @@ public final class Class<T> * @return the method * @throws NoSuchMethodException if the method does not exist * @throws SecurityException if the security check fails + * @throws NullPointerException if <code>methodName</code> is null * @see #getDeclaredMethods() * @since 1.1 */ public Method getDeclaredMethod(String methodName, Class<?>... types) throws NoSuchMethodException { + if (methodName == null) + throw new NullPointerException(); memberAccessCheck(Member.DECLARED); Method match = matchMethod(getDeclaredMethods(false), methodName, types); if (match == null) @@ -560,12 +566,15 @@ public final class Class<T> * @return the field * @throws NoSuchFieldException if the field does not exist * @throws SecurityException if the security check fails + * @throws NullPointerException if <code>fieldName</code> is null * @see #getFields() * @since 1.1 */ public Field getField(String fieldName) throws NoSuchFieldException { + if (fieldName == null) + throw new NullPointerException(); memberAccessCheck(Member.PUBLIC); Field field = internalGetField(fieldName); if (field == null) @@ -700,12 +709,15 @@ public final class Class<T> * @return the method * @throws NoSuchMethodException if the method does not exist * @throws SecurityException if the security check fails + * @throws NullPointerException if <code>methodName</code> is null * @see #getMethods() * @since 1.1 */ public Method getMethod(String methodName, Class<?>... types) throws NoSuchMethodException { + if (methodName == null) + throw new NullPointerException(); memberAccessCheck(Member.PUBLIC); Method method = internalGetMethod(methodName, types); if (method == null) diff --git a/libjava/classpath/java/lang/System.java b/libjava/classpath/java/lang/System.java index 39d6da22907..51b3259fa8b 100644 --- a/libjava/classpath/java/lang/System.java +++ b/libjava/classpath/java/lang/System.java @@ -1,5 +1,5 @@ /* System.java -- useful methods to interface with the system - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,6 +45,7 @@ import gnu.classpath.VMStackWalker; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; +import java.io.Console; import java.nio.channels.Channel; import java.nio.channels.spi.SelectorProvider; import java.util.AbstractCollection; @@ -703,6 +704,14 @@ public final class System return SelectorProvider.provider().inheritedChannel(); } + /* + * @since 1.6 + */ + public static Console console() + { + return Console.console(); + } + /** * This is a specialised <code>Collection</code>, providing * the necessary provisions for the collections used by the |