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:
@@ -120,10 +120,10 @@ public class Collections
|
||||
* @return an empty parameterized set.
|
||||
* @since 1.5
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final <T> Set<T> emptySet()
|
||||
{
|
||||
/* FIXME: Could this be optimized? */
|
||||
return new EmptySet<T>();
|
||||
return (Set<T>) EMPTY_SET;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,6 +161,7 @@ public class Collections
|
||||
* @return A non-iterating iterator.
|
||||
*/
|
||||
// This is really cheating! I think it's perfectly valid, though.
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<T> iterator()
|
||||
{
|
||||
return (Iterator<T>) EMPTY_LIST.iterator();
|
||||
@@ -196,7 +197,7 @@ public class Collections
|
||||
*/
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return o instanceof Set && ((Set) o).isEmpty();
|
||||
return o instanceof Set<?> && ((Set<?>) o).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,10 +289,10 @@ public class Collections
|
||||
* @return an empty parameterized list.
|
||||
* @since 1.5
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final <T> List<T> emptyList()
|
||||
{
|
||||
/* FIXME: Could this be optimized? */
|
||||
return new EmptyList<T>();
|
||||
return (List<T>) EMPTY_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -369,7 +370,7 @@ public class Collections
|
||||
*/
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return o instanceof List && ((List) o).isEmpty();
|
||||
return o instanceof List<?> && ((List<?>) o).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,10 +481,10 @@ public class Collections
|
||||
* @return an empty parameterized map.
|
||||
* @since 1.5
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final <K,V> Map<K,V> emptyMap()
|
||||
{
|
||||
/* FIXME: Could this be optimized? */
|
||||
return new EmptyMap<K,V>();
|
||||
return (Map<K,V>) EMPTY_MAP;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -511,9 +512,10 @@ public class Collections
|
||||
* There are no entries.
|
||||
* @return The empty set.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<Map.Entry<K, V>> entrySet()
|
||||
{
|
||||
return EMPTY_SET;
|
||||
return (Set<Map.Entry<K, V>>) EMPTY_SET;
|
||||
}
|
||||
|
||||
// The remaining methods are optional, but provide a performance
|
||||
@@ -546,7 +548,7 @@ public class Collections
|
||||
*/
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return o instanceof Map && ((Map) o).isEmpty();
|
||||
return o instanceof Map<?,?> && ((Map<?,?>) o).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -572,9 +574,10 @@ public class Collections
|
||||
* No entries.
|
||||
* @return The empty set.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<K> keySet()
|
||||
{
|
||||
return EMPTY_SET;
|
||||
return (Set<K>) EMPTY_SET;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,9 +604,10 @@ public class Collections
|
||||
* Collection, will work. Besides, that's what the JDK uses!
|
||||
* @return The empty set.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<V> values()
|
||||
{
|
||||
return EMPTY_SET;
|
||||
return (Collection<V>) EMPTY_SET;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1854,7 +1858,7 @@ public class Collections
|
||||
public List<T> subList(int from, int to)
|
||||
{
|
||||
if (from == to && (to == 0 || to == 1))
|
||||
return EMPTY_LIST;
|
||||
return emptyList();
|
||||
if (from == 0 && to == 1)
|
||||
return this;
|
||||
if (from > to)
|
||||
@@ -2480,7 +2484,7 @@ public class Collections
|
||||
* @throws ArrayStoreException if the type of any element of the
|
||||
* collection is not a subtype of the element type of a.
|
||||
*/
|
||||
public <T> T[] toArray(T[] a)
|
||||
public <E> E[] toArray(E[] a)
|
||||
{
|
||||
synchronized (mutex)
|
||||
{
|
||||
|
||||
@@ -678,6 +678,12 @@ public final class Formatter
|
||||
conversion);
|
||||
noPrecision(precision);
|
||||
|
||||
if (arg == null)
|
||||
{
|
||||
genericFormat("null", flags, width, precision);
|
||||
return;
|
||||
}
|
||||
|
||||
int theChar;
|
||||
if (arg instanceof Character)
|
||||
theChar = ((Character) arg).charValue();
|
||||
@@ -748,6 +754,12 @@ public final class Formatter
|
||||
int radix, char conversion)
|
||||
{
|
||||
assert radix == 8 || radix == 10 || radix == 16;
|
||||
|
||||
if (arg == null)
|
||||
{
|
||||
return new CPStringBuilder("null");
|
||||
}
|
||||
|
||||
noPrecision(precision);
|
||||
|
||||
// Some error checking.
|
||||
@@ -1353,9 +1365,12 @@ public final class Formatter
|
||||
argumentIndex = previousArgumentIndex;
|
||||
// Argument indices start at 1 but array indices at 0.
|
||||
--argumentIndex;
|
||||
if (argumentIndex < 0 || argumentIndex >= args.length)
|
||||
throw new MissingFormatArgumentException(format.substring(start, index));
|
||||
argument = args[argumentIndex];
|
||||
if (args != null)
|
||||
{
|
||||
if (argumentIndex < 0 || argumentIndex >= args.length)
|
||||
throw new MissingFormatArgumentException(format.substring(start, index));
|
||||
argument = args[argumentIndex];
|
||||
}
|
||||
}
|
||||
|
||||
switch (conversion)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* java.util.TimeZone
|
||||
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.
|
||||
@@ -102,10 +102,10 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
/* Look up default timezone */
|
||||
if (defaultZone0 == null)
|
||||
{
|
||||
defaultZone0 = (TimeZone) AccessController.doPrivileged
|
||||
(new PrivilegedAction()
|
||||
defaultZone0 = AccessController.doPrivileged
|
||||
(new PrivilegedAction<TimeZone>()
|
||||
{
|
||||
public Object run()
|
||||
public TimeZone run()
|
||||
{
|
||||
TimeZone zone = null;
|
||||
|
||||
@@ -146,21 +146,21 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
/**
|
||||
* JDK 1.1.x compatibility aliases.
|
||||
*/
|
||||
private static HashMap aliases0;
|
||||
private static HashMap<String,String> aliases0;
|
||||
|
||||
/**
|
||||
* HashMap for timezones by ID.
|
||||
*/
|
||||
private static HashMap timezones0;
|
||||
private static HashMap<String,TimeZone> timezones0;
|
||||
/* initialize this static field lazily to overhead if
|
||||
* it is not needed:
|
||||
*/
|
||||
// Package-private to avoid a trampoline.
|
||||
static HashMap timezones()
|
||||
static HashMap<String,TimeZone> timezones()
|
||||
{
|
||||
if (timezones0 == null)
|
||||
{
|
||||
HashMap timezones = new HashMap();
|
||||
HashMap<String,TimeZone> timezones = new HashMap<String,TimeZone>();
|
||||
timezones0 = timezones;
|
||||
|
||||
zoneinfo_dir = SystemProperties.getProperty("gnu.java.util.zoneinfo.dir");
|
||||
@@ -169,7 +169,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
|
||||
if (zoneinfo_dir != null)
|
||||
{
|
||||
aliases0 = new HashMap();
|
||||
aliases0 = new HashMap<String,String>();
|
||||
|
||||
// These deprecated aliases for JDK 1.1.x compatibility
|
||||
// should take precedence over data files read from
|
||||
@@ -1469,7 +1469,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
{
|
||||
synchronized (TimeZone.class)
|
||||
{
|
||||
tz = (TimeZone) timezones().get(ID);
|
||||
tz = timezones().get(ID);
|
||||
if (tz != null)
|
||||
{
|
||||
if (!tz.getID().equals(ID))
|
||||
@@ -1497,7 +1497,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
|
||||
// aliases0 is never changing after first timezones(), so should
|
||||
// be safe without synchronization.
|
||||
String zonename = (String) aliases0.get(ID);
|
||||
String zonename = aliases0.get(ID);
|
||||
if (zonename == null)
|
||||
zonename = ID;
|
||||
|
||||
@@ -1605,17 +1605,17 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
{
|
||||
synchronized (TimeZone.class)
|
||||
{
|
||||
HashMap h = timezones();
|
||||
HashMap<String,TimeZone> h = timezones();
|
||||
int count = 0;
|
||||
if (zoneinfo_dir == null)
|
||||
{
|
||||
Iterator iter = h.entrySet().iterator();
|
||||
Iterator<Map.Entry<String,TimeZone>> iter = h.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
// Don't iterate the values, since we want to count
|
||||
// doubled values (aliases)
|
||||
Map.Entry entry = (Map.Entry) iter.next();
|
||||
if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
|
||||
Map.Entry<String,TimeZone> entry = iter.next();
|
||||
if (entry.getValue().getRawOffset() == rawOffset)
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -1624,8 +1624,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
iter = h.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Map.Entry entry = (Map.Entry) iter.next();
|
||||
if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
|
||||
Map.Entry<String,TimeZone> entry = iter.next();
|
||||
if (entry.getValue().getRawOffset() == rawOffset)
|
||||
ids[count++] = (String) entry.getKey();
|
||||
}
|
||||
return ids;
|
||||
@@ -1651,7 +1651,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
return ids;
|
||||
}
|
||||
|
||||
private static int getAvailableIDs(File d, String prefix, ArrayList list)
|
||||
private static int getAvailableIDs(File d, String prefix, ArrayList<String[]> list)
|
||||
{
|
||||
String[] files = d.list();
|
||||
int count = files.length;
|
||||
@@ -1691,9 +1691,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
{
|
||||
synchronized (TimeZone.class)
|
||||
{
|
||||
HashMap h = timezones();
|
||||
HashMap<String,TimeZone> h = timezones();
|
||||
if (zoneinfo_dir == null)
|
||||
return (String[]) h.keySet().toArray(new String[h.size()]);
|
||||
return h.keySet().toArray(new String[h.size()]);
|
||||
|
||||
if (availableIDs != null)
|
||||
{
|
||||
@@ -1704,7 +1704,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
}
|
||||
|
||||
File d = new File(zoneinfo_dir);
|
||||
ArrayList list = new ArrayList(30);
|
||||
ArrayList<String[]> list = new ArrayList<String[]>(30);
|
||||
int count = getAvailableIDs(d, "", list) + aliases0.size();
|
||||
availableIDs = new String[count];
|
||||
String[] ids = new String[count];
|
||||
@@ -1712,7 +1712,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
count = 0;
|
||||
for (int i = 0; i < list.size(); i++)
|
||||
{
|
||||
String[] s = (String[]) list.get(i);
|
||||
String[] s = list.get(i);
|
||||
for (int j = 0; j < s.length; j++)
|
||||
if (s[j] != null)
|
||||
{
|
||||
@@ -1721,12 +1721,12 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
}
|
||||
}
|
||||
|
||||
Iterator iter = aliases0.entrySet().iterator();
|
||||
Iterator<Map.Entry<String,String>> iter = aliases0.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Map.Entry entry = (Map.Entry) iter.next();
|
||||
availableIDs[count] = (String) entry.getKey();
|
||||
ids[count++] = (String) entry.getKey();
|
||||
Map.Entry<String,String> entry = iter.next();
|
||||
availableIDs[count] = entry.getKey();
|
||||
ids[count++] = entry.getKey();
|
||||
}
|
||||
|
||||
return ids;
|
||||
|
||||
@@ -102,6 +102,28 @@ public final class Matcher implements MatchResult
|
||||
anchoringBounds = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the pattern used by the {@link Matcher} to
|
||||
* the one specified. Existing match information is lost,
|
||||
* but the input and the matcher's position within it is
|
||||
* retained.
|
||||
*
|
||||
* @param newPattern the new pattern to use.
|
||||
* @return this matcher.
|
||||
* @throws IllegalArgumentException if {@code newPattern} is
|
||||
* {@code null}.
|
||||
* @since 1.5
|
||||
*/
|
||||
public Matcher usePattern(Pattern newPattern)
|
||||
{
|
||||
if (newPattern == null)
|
||||
throw new IllegalArgumentException("The new pattern was null.");
|
||||
pattern = newPattern;
|
||||
match = null;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sb The target string buffer
|
||||
* @param replacement The replacement string
|
||||
@@ -620,7 +642,7 @@ public final class Matcher implements MatchResult
|
||||
*
|
||||
* @param s the string to literalize.
|
||||
* @return the literalized string.
|
||||
* @since 1.5
|
||||
* @since 1.5
|
||||
*/
|
||||
public static String quoteReplacement(String s)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user