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:
@@ -48,7 +48,6 @@ import gnu.classpath.jdwp.util.MethodResult;
|
||||
import gnu.classpath.jdwp.util.MonitorInfo;
|
||||
import gnu.classpath.jdwp.value.Value;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@@ -37,8 +37,14 @@ exception statement from your version. */
|
||||
|
||||
package gnu.java.lang.management;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.MemoryPoolMXBean;
|
||||
import java.lang.management.MemoryType;
|
||||
import java.lang.management.MemoryUsage;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Provides access to information about the memory
|
||||
* management of the current invocation of the virtual
|
||||
@@ -62,10 +68,7 @@ final class VMMemoryMXBeanImpl
|
||||
*/
|
||||
static MemoryUsage getHeapMemoryUsage()
|
||||
{
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
long totalMem = runtime.totalMemory();
|
||||
return new MemoryUsage(-1, totalMem - runtime.freeMemory(),
|
||||
totalMem, runtime.maxMemory());
|
||||
return getUsage(MemoryType.HEAP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +79,10 @@ final class VMMemoryMXBeanImpl
|
||||
* @return an {@link java.lang.management.MemoryUsage} instance
|
||||
* for non-heap memory.
|
||||
*/
|
||||
static native MemoryUsage getNonHeapMemoryUsage();
|
||||
static MemoryUsage getNonHeapMemoryUsage()
|
||||
{
|
||||
return getUsage(MemoryType.NON_HEAP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of objects ready to be garbage collected.
|
||||
@@ -106,4 +112,45 @@ final class VMMemoryMXBeanImpl
|
||||
*/
|
||||
static native void setVerbose(boolean verbose);
|
||||
|
||||
/**
|
||||
* Totals the memory usage from all the pools that match
|
||||
* the given type.
|
||||
*
|
||||
* @param type the type of memory pools to accumulate
|
||||
* (heap or non-heap).
|
||||
* @return the memory usage overall.
|
||||
*/
|
||||
private static MemoryUsage getUsage(MemoryType type) {
|
||||
long init = 0, committed = 0, used = 0, max = 0;
|
||||
Iterator pools =
|
||||
ManagementFactory.getMemoryPoolMXBeans().iterator();
|
||||
while (pools.hasNext())
|
||||
{
|
||||
MemoryPoolMXBean pool = (MemoryPoolMXBean) pools.next();
|
||||
if (pool.getType() == type)
|
||||
{
|
||||
MemoryUsage usage = pool.getUsage();
|
||||
if (init != -1)
|
||||
{
|
||||
long poolInit = usage.getInit();
|
||||
if (poolInit == -1)
|
||||
init = -1;
|
||||
else
|
||||
init += poolInit;
|
||||
}
|
||||
committed += usage.getCommitted();
|
||||
used += usage.getUsed();
|
||||
if (max != -1)
|
||||
{
|
||||
long poolMax = usage.getMax();
|
||||
if (poolMax == -1)
|
||||
max = -1;
|
||||
else
|
||||
max += poolMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new MemoryUsage(init, used, committed, max);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -256,7 +256,6 @@ public final class VMChannel
|
||||
* Assumes the that buffer list constains DirectBuffers. Will perform
|
||||
* as gathering write.
|
||||
*
|
||||
* @param fd
|
||||
* @param srcs
|
||||
* @param offset
|
||||
* @param length
|
||||
|
||||
@@ -80,10 +80,10 @@ final class VMFile
|
||||
static native boolean create(String path) throws IOException;
|
||||
|
||||
/*
|
||||
* This native function actually produces the list of file in this
|
||||
* This native function actually produces the list of files in this
|
||||
* directory
|
||||
*/
|
||||
static native String[] list(String dirpath);
|
||||
static native synchronized String[] list(String dirpath);
|
||||
|
||||
/*
|
||||
* This native method actually performs the rename.
|
||||
@@ -116,6 +116,21 @@ final class VMFile
|
||||
*/
|
||||
static native boolean mkdir(String dirpath);
|
||||
|
||||
/**
|
||||
* Gets the total bytes of the filesystem named by path.
|
||||
*/
|
||||
public static native long getTotalSpace(String path);
|
||||
|
||||
/**
|
||||
* Gets the total free bytes of the filesystem named by path.
|
||||
*/
|
||||
public static native long getFreeSpace(String path);
|
||||
|
||||
/**
|
||||
* Gets the available bytes of the filesystem named by path.
|
||||
*/
|
||||
public static native long getUsableSpace(String path);
|
||||
|
||||
/**
|
||||
* Set the read permission of the file.
|
||||
*/
|
||||
|
||||
@@ -43,8 +43,6 @@ import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Type;
|
||||
import java.lang.reflect.TypeVariable;
|
||||
|
||||
/*
|
||||
* This class is a reference version, mainly for compiling a class library
|
||||
@@ -298,12 +296,27 @@ final class VMClass
|
||||
*/
|
||||
static String getSimpleName(Class klass)
|
||||
{
|
||||
if (isAnonymousClass(klass))
|
||||
return "";
|
||||
if (isArray(klass))
|
||||
{
|
||||
return getComponentType(klass).getSimpleName() + "[]";
|
||||
}
|
||||
String fullName = getName(klass);
|
||||
return fullName.substring(fullName.lastIndexOf(".") + 1);
|
||||
int pos = fullName.lastIndexOf("$");
|
||||
if (pos == -1)
|
||||
pos = 0;
|
||||
else
|
||||
{
|
||||
++pos;
|
||||
while (Character.isDigit(fullName.charAt(pos)))
|
||||
++pos;
|
||||
}
|
||||
int packagePos = fullName.lastIndexOf(".", pos);
|
||||
if (packagePos == -1)
|
||||
return fullName.substring(pos);
|
||||
else
|
||||
return fullName.substring(packagePos + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,6 +370,8 @@ final class VMClass
|
||||
*/
|
||||
static String getCanonicalName(Class klass)
|
||||
{
|
||||
if (isLocalClass(klass) || isAnonymousClass(klass))
|
||||
return null;
|
||||
if (isArray(klass))
|
||||
{
|
||||
String componentName = getComponentType(klass).getCanonicalName();
|
||||
@@ -368,9 +383,9 @@ final class VMClass
|
||||
String memberName = getDeclaringClass(klass).getCanonicalName();
|
||||
if (memberName != null)
|
||||
return memberName + "." + getSimpleName(klass);
|
||||
else
|
||||
return memberName;
|
||||
}
|
||||
if (isLocalClass(klass) || isAnonymousClass(klass))
|
||||
return null;
|
||||
return getName(klass);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,22 +65,6 @@ final class VMDouble
|
||||
initIDs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the double to the IEEE 754 floating-point "double format" bit
|
||||
* layout. Bit 63 (the most significant) is the sign bit, bits 62-52
|
||||
* (masked by 0x7ff0000000000000L) represent the exponent, and bits 51-0
|
||||
* (masked by 0x000fffffffffffffL) are the mantissa. This function
|
||||
* collapses all versions of NaN to 0x7ff8000000000000L. The result of this
|
||||
* function can be used as the argument to
|
||||
* <code>Double.longBitsToDouble(long)</code> to obtain the original
|
||||
* <code>double</code> value.
|
||||
*
|
||||
* @param value the <code>double</code> to convert
|
||||
* @return the bits of the <code>double</code>
|
||||
* @see #longBitsToDouble(long)
|
||||
*/
|
||||
public static native long doubleToLongBits(double value);
|
||||
|
||||
/**
|
||||
* Convert the double to the IEEE 754 floating-point "double format" bit
|
||||
* layout. Bit 63 (the most significant) is the sign bit, bits 62-52
|
||||
|
||||
@@ -63,21 +63,6 @@ final class VMFloat
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the float to the IEEE 754 floating-point "single format" bit
|
||||
* layout. Bit 31 (the most significant) is the sign bit, bits 30-23
|
||||
* (masked by 0x7f800000) represent the exponent, and bits 22-0
|
||||
* (masked by 0x007fffff) are the mantissa. This function collapses all
|
||||
* versions of NaN to 0x7fc00000. The result of this function can be used
|
||||
* as the argument to <code>Float.intBitsToFloat(int)</code> to obtain the
|
||||
* original <code>float</code> value.
|
||||
*
|
||||
* @param value the <code>float</code> to convert
|
||||
* @return the bits of the <code>float</code>
|
||||
* @see #intBitsToFloat(int)
|
||||
*/
|
||||
static native int floatToIntBits(float value);
|
||||
|
||||
/**
|
||||
* Convert the float to the IEEE 754 floating-point "single format" bit
|
||||
* layout. Bit 31 (the most significant) is the sign bit, bits 30-23
|
||||
|
||||
@@ -42,6 +42,7 @@ import gnu.java.lang.ClassHelper;
|
||||
|
||||
import gnu.java.lang.reflect.MethodSignatureParser;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
@@ -393,4 +394,27 @@ public final class Constructor<T>
|
||||
MethodSignatureParser p = new MethodSignatureParser(this, sig);
|
||||
return p.getGenericParameterTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Return an array of arrays representing the annotations on each
|
||||
* of the constructor's parameters. The outer array is aligned against
|
||||
* the parameters of the constructors and is thus equal in length to
|
||||
* the number of parameters (thus having a length zero if there are none).
|
||||
* Each array element in the outer array contains an inner array which
|
||||
* holds the annotations. This array has a length of zero if the parameter
|
||||
* has no annotations.
|
||||
* </p>
|
||||
* <p>
|
||||
* The returned annotations are serialized. Changing the annotations has
|
||||
* no affect on the return value of future calls to this method.
|
||||
* </p>
|
||||
*
|
||||
* @return an array of arrays which represents the annotations used on the
|
||||
* parameters of this constructor. The order of the array elements
|
||||
* matches the declaration order of the parameters.
|
||||
* @since 1.5
|
||||
*/
|
||||
public native Annotation[][] getParameterAnnotations();
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import gnu.java.lang.ClassHelper;
|
||||
|
||||
import gnu.java.lang.reflect.MethodSignatureParser;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
@@ -462,4 +463,27 @@ extends AccessibleObject implements Member, GenericDeclaration
|
||||
* @since 1.5
|
||||
*/
|
||||
public native Object getDefaultValue();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Return an array of arrays representing the annotations on each
|
||||
* of the method's parameters. The outer array is aligned against
|
||||
* the parameters of the method and is thus equal in length to
|
||||
* the number of parameters (thus having a length zero if there are none).
|
||||
* Each array element in the outer array contains an inner array which
|
||||
* holds the annotations. This array has a length of zero if the parameter
|
||||
* has no annotations.
|
||||
* </p>
|
||||
* <p>
|
||||
* The returned annotations are serialized. Changing the annotations has
|
||||
* no affect on the return value of future calls to this method.
|
||||
* </p>
|
||||
*
|
||||
* @return an array of arrays which represents the annotations used on the
|
||||
* parameters of this method. The order of the array elements
|
||||
* matches the declaration order of the parameters.
|
||||
* @since 1.5
|
||||
*/
|
||||
public native Annotation[][] getParameterAnnotations();
|
||||
|
||||
}
|
||||
|
||||
@@ -38,11 +38,6 @@ exception statement from your version. */
|
||||
|
||||
package java.security;
|
||||
|
||||
import gnu.classpath.SystemProperties;
|
||||
import gnu.java.security.action.GetSecurityPropertyAction;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* VM-specific methods for generating real (or almost real) random
|
||||
* seeds. VM implementors should write a version of this class that
|
||||
|
||||
Reference in New Issue
Block a user