Import GNU Classpath (classpath-0_97_2-release).

libjava/

2008-06-28  Matthias Klose  <doko@ubuntu.com>

        Import GNU Classpath (classpath-0_97_2-release).

        * Regenerate class and header files.
        * Regenerate auto* files.
        * gcj/javaprims.h: Define jobjectRefType.
        * jni.cc (_Jv_JNI_GetObjectRefType): New (stub only).
        (_Jv_JNIFunctions): Initialize GetObjectRefType.
        * gnu/classpath/jdwp/VMVirtualMachine.java,
        java/security/VMSecureRandom.java: Merge from classpath.
        * HACKING: Fix typo.
        * ChangeLog-2007: New file.
        * configure.ac: Set JAVAC, pass --disable-regen-headers to classpath.

libjava/classpath/

2008-06-28  Matthias Klose  <doko@ubuntu.com>

        * m4/ac_prog_javac.m4: Disable check for JAVAC, when
        not configured with --enable-java-maintainer-mode.
        * aclocal.m4, configure: Regenerate.
        * native/jni/gstreamer-peer/Makefile.am: Do not link with
        libclasspathnative.
        * native/jni/gstreamer-peer/Makefile.in: Regenerate.
        * tools/Makefile.am, lib/Makefile.am: Use JAVAC for setting
        JCOMPILER, drop flags not understood by gcj.

From-SVN: r137223
This commit is contained in:
Matthias Klose
2008-06-28 13:29:13 +00:00
parent 15c151967d
commit e0441a5bfb
1429 changed files with 32837 additions and 18119 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
/* Class.java -- Representation of a Java class.
Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006
Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation
This file is part of GNU Classpath.
@@ -66,7 +66,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
/**
@@ -596,7 +596,7 @@ public final class Class<T>
*/
private Field[] internalGetFields()
{
HashSet<Field> set = new HashSet<Field>();
LinkedHashSet<Field> set = new LinkedHashSet<Field>();
set.addAll(Arrays.asList(getDeclaredFields(true)));
Class[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++)
@@ -1151,7 +1151,7 @@ public final class Class<T>
}
try
{
return constructor.newInstance(null);
return constructor.newInstance();
}
catch (InvocationTargetException e)
{
+23 -11
View File
@@ -518,7 +518,10 @@ public final class Double extends Number implements Comparable<Double>
*/
public static long doubleToLongBits(double value)
{
return VMDouble.doubleToLongBits(value);
if (isNaN(value))
return 0x7ff8000000000000L;
else
return VMDouble.doubleToRawLongBits(value);
}
/**
@@ -587,16 +590,25 @@ public final class Double extends Number implements Comparable<Double>
*/
public static int compare(double x, double y)
{
if (isNaN(x))
return isNaN(y) ? 0 : 1;
if (isNaN(y))
return -1;
// recall that 0.0 == -0.0, so we convert to infinites and try again
if (x == 0 && y == 0)
return (int) (1 / x - 1 / y);
if (x == y)
return 0;
// handle the easy cases:
if (x < y)
return -1;
if (x > y)
return 1;
return x > y ? 1 : -1;
// handle equality respecting that 0.0 != -0.0 (hence not using x == y):
long lx = doubleToRawLongBits(x);
long ly = doubleToRawLongBits(y);
if (lx == ly)
return 0;
// handle NaNs:
if (x != x)
return (y != y) ? 0 : 1;
else if (y != y)
return -1;
// handle +/- 0.0
return (lx < ly) ? -1 : 1;
}
}
+23 -11
View File
@@ -526,7 +526,10 @@ public final class Float extends Number implements Comparable<Float>
*/
public static int floatToIntBits(float value)
{
return VMFloat.floatToIntBits(value);
if (isNaN(value))
return 0x7fc00000;
else
return VMFloat.floatToRawIntBits(value);
}
/**
@@ -594,16 +597,25 @@ public final class Float extends Number implements Comparable<Float>
*/
public static int compare(float x, float y)
{
if (isNaN(x))
return isNaN(y) ? 0 : 1;
if (isNaN(y))
return -1;
// recall that 0.0 == -0.0, so we convert to infinities and try again
if (x == 0 && y == 0)
return (int) (1 / x - 1 / y);
if (x == y)
return 0;
// handle the easy cases:
if (x < y)
return -1;
if (x > y)
return 1;
return x > y ? 1 : -1;
// handle equality respecting that 0.0 != -0.0 (hence not using x == y):
int ix = floatToRawIntBits(x);
int iy = floatToRawIntBits(y);
if (ix == iy)
return 0;
// handle NaNs:
if (x != x)
return (y != y) ? 0 : 1;
else if (y != y)
return -1;
// handle +/- 0.0
return (ix < iy) ? -1 : 1;
}
}
+8 -5
View File
@@ -705,16 +705,19 @@ public final class Integer extends Number implements Comparable<Integer>
if (len == 0)
throw new NumberFormatException("string length is null");
int ch = str.charAt(index);
if (ch == '-' || ch == '+')
if (ch == '-')
{
if (len == 1)
if (ch == '-')
throw new NumberFormatException("pure '-'");
else if (ch == '+')
throw new NumberFormatException("pure '+'");
throw new NumberFormatException("pure '-'");
isNeg = true;
ch = str.charAt(++index);
}
else if (ch == '+')
{
if (len == 1)
throw new NumberFormatException("pure '+'");
ch = str.charAt(++index);
}
if (decode)
{
if (ch == '0')
+1 -1
View File
@@ -296,7 +296,7 @@ public final class Long extends Number implements Comparable<Long>
* @return the <code>Long</code>
* @since 1.5
*/
public static synchronized Long valueOf(long val)
public static Long valueOf(long val)
{
// We aren't required to cache here. We could, though perhaps we
// ought to consider that as an empirical question.
@@ -202,7 +202,7 @@ public final class StackTraceElement implements Serializable
*/
public String toString()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
if (declaringClass != null)
{
sb.append(declaringClass);
+165 -47
View File
@@ -1303,13 +1303,13 @@ public final class String
break;
if (i < 0)
return this;
char[] newStr = (char[]) value.clone();
newStr[x] = newChar;
char[] newStr = toCharArray();
newStr[x - offset] = newChar;
while (--i >= 0)
if (value[++x] == oldChar)
newStr[x] = newChar;
newStr[x - offset] = newChar;
// Package constructor avoids an array copy.
return new String(newStr, offset, count, true);
return new String(newStr, 0, count, true);
}
/**
@@ -1430,6 +1430,47 @@ public final class String
return Pattern.compile(regex).split(this, 0);
}
/**
* Convert string to lower case for a Turkish locale that requires special
* handling of '\u0049'
*/
private String toLowerCaseTurkish()
{
// First, see if the current string is already lower case.
int i = count;
int x = offset - 1;
while (--i >= 0)
{
char ch = value[++x];
if ((ch == '\u0049') || ch != Character.toLowerCase(ch))
break;
}
if (i < 0)
return this;
// Now we perform the conversion. Fortunately, there are no multi-character
// lowercase expansions in Unicode 3.0.0.
char[] newStr = new char[count];
VMSystem.arraycopy(value, offset, newStr, 0, x - offset);
do
{
char ch = value[x];
// Hardcoded special case.
if (ch != '\u0049')
{
newStr[x - offset] = Character.toLowerCase(ch);
}
else
{
newStr[x - offset] = '\u0131';
}
x++;
}
while (--i >= 0);
// Package constructor avoids an array copy.
return new String(newStr, 0, count, true);
}
/**
* Lowercases this String according to a particular locale. This uses
* Unicode's special case mappings, as applied to the given Locale, so the
@@ -1444,32 +1485,40 @@ public final class String
public String toLowerCase(Locale loc)
{
// First, see if the current string is already lower case.
boolean turkish = "tr".equals(loc.getLanguage());
int i = count;
int x = offset - 1;
while (--i >= 0)
{
char ch = value[++x];
if ((turkish && ch == '\u0049')
|| ch != Character.toLowerCase(ch))
break;
}
if (i < 0)
return this;
// Now we perform the conversion. Fortunately, there are no multi-character
// lowercase expansions in Unicode 3.0.0.
char[] newStr = (char[]) value.clone();
do
// Is loc turkish? String equality test is ok as Locale.language is interned
if ("tr" == loc.getLanguage())
{
char ch = value[x];
// Hardcoded special case.
newStr[x++] = (turkish && ch == '\u0049') ? '\u0131'
: Character.toLowerCase(ch);
return toLowerCaseTurkish();
}
while (--i >= 0);
// Package constructor avoids an array copy.
return new String(newStr, offset, count, true);
else
{
int i = count;
int x = offset - 1;
while (--i >= 0)
{
char ch = value[++x];
if (ch != Character.toLowerCase(ch))
break;
}
if (i < 0)
return this;
// Now we perform the conversion. Fortunately, there are no
// multi-character lowercase expansions in Unicode 3.0.0.
char[] newStr = new char[count];
VMSystem.arraycopy(value, offset, newStr, 0, x - offset);
do
{
char ch = value[x];
// Hardcoded special case.
newStr[x - offset] = Character.toLowerCase(ch);
x++;
}
while (--i >= 0);
// Package constructor avoids an array copy.
return new String(newStr, 0, count, true);
}
}
/**
@@ -1487,21 +1536,12 @@ public final class String
}
/**
* Uppercases this String according to a particular locale. This uses
* Unicode's special case mappings, as applied to the given Locale, so the
* resulting string may be a different length.
*
* @param loc locale to use
* @return new uppercased String, or this if no characters were uppercased
* @throws NullPointerException if loc is null
* @see #toLowerCase(Locale)
* @since 1.1
* Uppercase this string for a Turkish locale
*/
public String toUpperCase(Locale loc)
private String toUpperCaseTurkish()
{
// First, see how many characters we have to grow by, as well as if the
// current string is already upper case.
boolean turkish = "tr".equals(loc.getLanguage());
int expand = 0;
boolean unchanged = true;
int i = count;
@@ -1511,7 +1551,7 @@ public final class String
char ch = value[--x];
expand += upperCaseExpansion(ch);
unchanged = (unchanged && expand == 0
&& ! (turkish && ch == '\u0069')
&& ch != '\u0069'
&& ch == Character.toUpperCase(ch));
}
if (unchanged)
@@ -1521,16 +1561,24 @@ public final class String
i = count;
if (expand == 0)
{
char[] newStr = (char[]) value.clone();
char[] newStr = new char[count];
VMSystem.arraycopy(value, offset, newStr, 0, count - (x - offset));
while (--i >= 0)
{
char ch = value[x];
// Hardcoded special case.
newStr[x++] = (turkish && ch == '\u0069') ? '\u0130'
: Character.toUpperCase(ch);
if (ch != '\u0069')
{
newStr[x - offset] = Character.toUpperCase(ch);
}
else
{
newStr[x - offset] = '\u0130';
}
x++;
}
// Package constructor avoids an array copy.
return new String(newStr, offset, count, true);
return new String(newStr, 0, count, true);
}
// Expansion is necessary.
@@ -1540,7 +1588,7 @@ public final class String
{
char ch = value[x++];
// Hardcoded special case.
if (turkish && ch == '\u0069')
if (ch == '\u0069')
{
newStr[j++] = '\u0130';
continue;
@@ -1559,6 +1607,79 @@ public final class String
return new String(newStr, 0, newStr.length, true);
}
/**
* Uppercases this String according to a particular locale. This uses
* Unicode's special case mappings, as applied to the given Locale, so the
* resulting string may be a different length.
*
* @param loc locale to use
* @return new uppercased String, or this if no characters were uppercased
* @throws NullPointerException if loc is null
* @see #toLowerCase(Locale)
* @since 1.1
*/
public String toUpperCase(Locale loc)
{
// First, see how many characters we have to grow by, as well as if the
// current string is already upper case.
// Is loc turkish? String equality test is ok as Locale.language is interned
if ("tr" == loc.getLanguage())
{
return toUpperCaseTurkish();
}
else
{
int expand = 0;
boolean unchanged = true;
int i = count;
int x = i + offset;
while (--i >= 0)
{
char ch = value[--x];
expand += upperCaseExpansion(ch);
unchanged = (unchanged && expand == 0
&& ch == Character.toUpperCase(ch));
}
if (unchanged)
return this;
// Now we perform the conversion.
i = count;
if (expand == 0)
{
char[] newStr = new char[count];
VMSystem.arraycopy(value, offset, newStr, 0, count - (x - offset));
while (--i >= 0)
{
char ch = value[x];
newStr[x - offset] = Character.toUpperCase(ch);
x++;
}
// Package constructor avoids an array copy.
return new String(newStr, 0, count, true);
}
// Expansion is necessary.
char[] newStr = new char[count + expand];
int j = 0;
while (--i >= 0)
{
char ch = value[x++];
expand = upperCaseExpansion(ch);
if (expand > 0)
{
int index = upperCaseIndex(ch);
while (expand-- >= 0)
newStr[j++] = upperExpand[index++];
}
else
newStr[j++] = Character.toUpperCase(ch);
}
// Package constructor avoids an array copy.
return new String(newStr, 0, newStr.length, true);
}
}
/**
* Uppercases this String. This uses Unicode's special case mappings, as
* applied to the platform's default Locale, so the resulting string may
@@ -1617,9 +1738,6 @@ public final class String
*/
public char[] toCharArray()
{
if (count == value.length)
return (char[]) value.clone();
char[] copy = new char[count];
VMSystem.arraycopy(value, offset, copy, 0, count);
return copy;
+1 -1
View File
@@ -832,7 +832,7 @@ public final class System
* Blocks the retention of all elements in the specified
* collection from the collection.
*
* @param c the collection of elements to retain.
* @param coll the collection of elements to retain.
* @return true if the other elements were removed.
* @throws NullPointerException if the collection is null.
* @throws NullPointerException if any collection entry is null.
+2 -2
View File
@@ -411,7 +411,7 @@ public class Throwable implements Serializable
// different threads to get mixed up when written to the same PrintWriter.
private String stackTraceString()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
// Main stacktrace
StackTraceElement[] stack = getStackTrace();
@@ -455,7 +455,7 @@ public class Throwable implements Serializable
// Adds to the given StringBuffer a line containing the name and
// all stacktrace elements minus the last equal ones.
private static void stackTraceStringBuffer(StringBuffer sb, String name,
private static void stackTraceStringBuffer(StringBuilder sb, String name,
StackTraceElement[] stack, int equal)
{
String nl = StaticData.nl;
@@ -190,134 +190,6 @@ public class ThreadInfo
*/
private static CompositeType seType;
/**
* Constructs a new {@link ThreadInfo} corresponding
* to the thread specified.
*
* @param thread the thread on which the new instance
* will be based.
* @param blockedCount the number of times the thread
* has been blocked.
* @param blockedTime the accumulated number of milliseconds
* the specified thread has been blocked
* (only used with contention monitoring enabled)
* @param lock the monitor lock the thread is waiting for
* (only used if blocked)
* @param lockOwner the thread which owns the monitor lock, or
* <code>null</code> if it doesn't have an owner
* (only used if blocked)
* @param waitedCount the number of times the thread has been in a
* waiting state.
* @param waitedTime the accumulated number of milliseconds the
* specified thread has been waiting
* (only used with contention monitoring enabled)
* @param isInNative true if the thread is in a native method.
* @param isSuspended true if the thread is suspended.
* @param trace the stack trace of the thread to a pre-determined
* depth (see VMThreadMXBeanImpl)
*/
private ThreadInfo(Thread thread, long blockedCount, long blockedTime,
Object lock, Thread lockOwner, long waitedCount,
long waitedTime, boolean isInNative, boolean isSuspended,
StackTraceElement[] trace)
{
this(thread, blockedCount, blockedTime, lock, lockOwner, waitedCount,
waitedTime, isInNative, isSuspended, trace, new MonitorInfo[]{},
new LockInfo[]{});
}
/**
* Constructs a new {@link ThreadInfo} corresponding
* to the thread specified.
*
* @param thread the thread on which the new instance
* will be based.
* @param blockedCount the number of times the thread
* has been blocked.
* @param blockedTime the accumulated number of milliseconds
* the specified thread has been blocked
* (only used with contention monitoring enabled)
* @param lock the monitor lock the thread is waiting for
* (only used if blocked)
* @param lockOwner the thread which owns the monitor lock, or
* <code>null</code> if it doesn't have an owner
* (only used if blocked)
* @param waitedCount the number of times the thread has been in a
* waiting state.
* @param waitedTime the accumulated number of milliseconds the
* specified thread has been waiting
* (only used with contention monitoring enabled)
* @param isInNative true if the thread is in a native method.
* @param isSuspended true if the thread is suspended.
* @param trace the stack trace of the thread to a pre-determined
* depth (see VMThreadMXBeanImpl)
* @param lockedMonitors an array of {@link MonitorInfo} objects
* representing locks held on object monitors
* by the thread.
* @param lockedSynchronizers an array of {@link LockInfo} objects
* representing locks held on ownable
* synchronizers by the thread.
* @since 1.6
*/
private ThreadInfo(Thread thread, long blockedCount, long blockedTime,
Object lock, Thread lockOwner, long waitedCount,
long waitedTime, boolean isInNative, boolean isSuspended,
StackTraceElement[] trace, MonitorInfo[] lockedMonitors,
LockInfo[] lockedSynchronizers)
{
this(thread.getId(), thread.getName(), thread.getState(), blockedCount, blockedTime,
lock == null ? null : lock.getClass().getName() + "@" +
Integer.toHexString(System.identityHashCode(lock)),
lockOwner == null ? -1 : lockOwner.getId(),
lockOwner == null ? null : lockOwner.getName(),
waitedCount, waitedTime, isInNative, isSuspended,
trace, lockedMonitors, lockedSynchronizers);
}
/**
* Constructs a new {@link ThreadInfo} corresponding
* to the thread details specified.
*
* @param threadId the id of the thread on which this
* new instance will be based.
* @param threadName the name of the thread on which
* this new instance will be based.
* @param threadState the state of the thread on which
* this new instance will be based.
* @param blockedCount the number of times the thread
* has been blocked.
* @param blockedTime the accumulated number of milliseconds
* the specified thread has been blocked
* (only used with contention monitoring enabled)
* @param lockName the name of the monitor lock the thread is waiting for
* (only used if blocked)
* @param lockOwnerId the id of the thread which owns the monitor
* lock, or <code>-1</code> if it doesn't have an owner
* (only used if blocked)
* @param lockOwnerName the name of the thread which owns the monitor
* lock, or <code>null</code> if it doesn't have an
* owner (only used if blocked)
* @param waitedCount the number of times the thread has been in a
* waiting state.
* @param waitedTime the accumulated number of milliseconds the
* specified thread has been waiting
* (only used with contention monitoring enabled)
* @param isInNative true if the thread is in a native method.
* @param isSuspended true if the thread is suspended.
* @param trace the stack trace of the thread to a pre-determined
* depth (see VMThreadMXBeanImpl)
*/
private ThreadInfo(long threadId, String threadName, Thread.State threadState,
long blockedCount, long blockedTime, String lockName,
long lockOwnerId, String lockOwnerName, long waitedCount,
long waitedTime, boolean isInNative, boolean isSuspended,
StackTraceElement[] trace)
{
this(threadId, threadName, threadState, blockedCount, blockedTime,
lockName, lockOwnerId, lockOwnerName, waitedCount, waitedTime,
isInNative, isSuspended, trace, new MonitorInfo[]{}, new LockInfo[]{});
}
/**
* Constructs a new {@link ThreadInfo} corresponding
* to the thread details specified.
@@ -209,19 +209,19 @@ public final class Array
if (array instanceof boolean[])
return ((boolean[]) array)[index] ? Boolean.TRUE : Boolean.FALSE;
if (array instanceof byte[])
return new Byte(((byte[]) array)[index]);
return Byte.valueOf(((byte[]) array)[index]);
if (array instanceof char[])
return new Character(((char[]) array)[index]);
return Character.valueOf(((char[]) array)[index]);
if (array instanceof short[])
return new Short(((short[]) array)[index]);
return Short.valueOf(((short[]) array)[index]);
if (array instanceof int[])
return new Integer(((int[]) array)[index]);
return Integer.valueOf(((int[]) array)[index]);
if (array instanceof long[])
return new Long(((long[]) array)[index]);
return Long.valueOf(((long[]) array)[index]);
if (array instanceof float[])
return new Float(((float[]) array)[index]);
return Float.valueOf(((float[]) array)[index]);
if (array instanceof double[])
return new Double(((double[]) array)[index]);
return Double.valueOf(((double[]) array)[index]);
if (array == null)
throw new NullPointerException();
throw new IllegalArgumentException();
@@ -471,9 +471,9 @@ public class Proxy implements Serializable
.getMethod("equals",
new Class[] {Object.class}));
coreMethods.put(sig, sig);
sig = new ProxySignature(Object.class.getMethod("hashCode", null));
sig = new ProxySignature(Object.class.getMethod("hashCode"));
coreMethods.put(sig, sig);
sig = new ProxySignature(Object.class.getMethod("toString", null));
sig = new ProxySignature(Object.class.getMethod("toString"));
coreMethods.put(sig, sig);
}
catch (Exception e)
@@ -1033,7 +1033,7 @@ public class Proxy implements Serializable
code_length += 9; // new, dup_x1, swap, invokespecial, athrow
}
int handler_pc = code_length - 1;
StringBuffer signature = new StringBuffer("(");
StringBuilder signature = new StringBuilder("(");
for (int j = 0; j < paramtypes.length; j++)
signature.append(TypeSignature.getEncodingOfClass(paramtypes[j]));
signature.append(")").append(TypeSignature.getEncodingOfClass(ret_type));
@@ -1261,8 +1261,8 @@ public class Proxy implements Serializable
// we're in the same package.
m.flag = true;
Object[] args = {loader, qualName, bytecode, new Integer(0),
new Integer(bytecode.length),
Object[] args = {loader, qualName, bytecode, Integer.valueOf(0),
Integer.valueOf(bytecode.length),
Object.class.getProtectionDomain() };
Class clazz = (Class) m.invoke(null, args);
@@ -1492,7 +1492,7 @@ public class Proxy implements Serializable
if (i == len)
return str;
final StringBuffer sb = new StringBuffer(str);
final StringBuilder sb = new StringBuilder(str);
sb.setLength(i);
for ( ; i < len; i++)
{
@@ -1533,7 +1533,7 @@ public class Proxy implements Serializable
int size = poolEntries.size() + 1;
if (size >= 65535)
throw new IllegalArgumentException("exceeds VM limitations");
i = new Integer(size);
i = Integer.valueOf(size);
poolEntries.put(sequence, i);
pool.append(sequence);
}