aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/util
diff options
context:
space:
mode:
authorMatthias Klose <doko@gcc.gnu.org>2007-08-04 10:53:49 +0000
committerMatthias Klose <doko@gcc.gnu.org>2007-08-04 10:53:49 +0000
commitf06a83c0b2f7761510836194a6c9a8a72000937c (patch)
tree871b70a606d87369d5aa9d6f621baedc13b49eba /libjava/classpath/java/util
parent2c3de459b647a72fc35d66adeda274ba0f14347b (diff)
downloadgcc-f06a83c0b2f7761510836194a6c9a8a72000937c.zip
gcc-f06a83c0b2f7761510836194a6c9a8a72000937c.tar.gz
gcc-f06a83c0b2f7761510836194a6c9a8a72000937c.tar.bz2
Import GNU Classpath (libgcj-import-20070727).
libjava/ 2007-08-04 Matthias Klose <doko@ubuntu.com> Import GNU Classpath (libgcj-import-20070727). * Regenerate class and header files. * Regenerate auto* files. * include/jvm.h: * jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type. * jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise. * jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA, _Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA, _Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA, _Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify jvalue parameter. * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise. * java/lang/VMFloat.java (toString, parseFloat): New. * gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported, isModalExclusionTypeSupported): New (stub only). * gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise. * gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages, updateFocusableWindowState, setModalBlocked, getBoundsPrivate, setAlwaysOnTop): Likewise. * gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature. * scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer, ignore javax.sound.sampled.spi.MixerProvider, ignore .in files. * HACKING: Mention --enable-gstreamer-peer, removal of generated files. libjava/classpath/ 2007-08-04 Matthias Klose <doko@ubuntu.com> * java/util/EnumMap.java (clone): Add cast. From-SVN: r127204
Diffstat (limited to 'libjava/classpath/java/util')
-rw-r--r--libjava/classpath/java/util/Arrays.java3
-rw-r--r--libjava/classpath/java/util/Currency.java5
-rw-r--r--libjava/classpath/java/util/EnumMap.java19
3 files changed, 22 insertions, 5 deletions
diff --git a/libjava/classpath/java/util/Arrays.java b/libjava/classpath/java/util/Arrays.java
index 9443ced..e5f7727 100644
--- a/libjava/classpath/java/util/Arrays.java
+++ b/libjava/classpath/java/util/Arrays.java
@@ -3941,7 +3941,8 @@ public class Arrays
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
"the final index.");
- T[] newArray = (T[]) new Object[to - from];
+ Class elemType = original.getClass().getComponentType();
+ T[] newArray = (T[]) Array.newInstance(elemType, to - from);
if (to > original.length)
{
System.arraycopy(original, from, newArray, 0,
diff --git a/libjava/classpath/java/util/Currency.java b/libjava/classpath/java/util/Currency.java
index a0933ec..b5da13c 100644
--- a/libjava/classpath/java/util/Currency.java
+++ b/libjava/classpath/java/util/Currency.java
@@ -273,6 +273,11 @@ public final class Currency
throw new
NullPointerException("The locale or its country is null.");
}
+
+ /* Check that country of locale given is valid. */
+ if (country.length() != 2)
+ throw new IllegalArgumentException();
+
/* Attempt to get the currency from the cache */
String code = (String) countryMap.get(country);
if (code == null)
diff --git a/libjava/classpath/java/util/EnumMap.java b/libjava/classpath/java/util/EnumMap.java
index 477dff8..b7187b9 100644
--- a/libjava/classpath/java/util/EnumMap.java
+++ b/libjava/classpath/java/util/EnumMap.java
@@ -1,5 +1,5 @@
/* EnumMap.java - Map where keys are enum constants
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -140,7 +140,8 @@ public class EnumMap<K extends Enum<K>, V>
Enum<K> e = (Enum<K>) key;
if (e.getDeclaringClass() != enumClass)
return null;
- return store[e.ordinal()];
+ V o = store[e.ordinal()];
+ return o == emptySlot ? null : o;
}
public V put(K key, V value)
@@ -387,8 +388,18 @@ public class EnumMap<K extends Enum<K>, V>
public EnumMap<K, V> clone()
{
- /* This constructor provides this functionality */
- return new EnumMap(this);
+ EnumMap<K, V> result;
+ try
+ {
+ result = (EnumMap<K, V>) super.clone();
+ }
+ catch (CloneNotSupportedException ignore)
+ {
+ // Can't happen.
+ result = null;
+ }
+ result.store = (V[]) store.clone();
+ return result;
}
}