summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/vm/reference/java/lang
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/vm/reference/java/lang')
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMClass.java29
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMClassLoader.java8
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMCompiler.java12
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMDouble.java19
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMFloat.java4
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMMath.java53
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMObject.java5
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMString.java4
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMSystem.java21
-rw-r--r--libjava/classpath/vm/reference/java/lang/management/VMManagementFactory.java4
-rw-r--r--libjava/classpath/vm/reference/java/lang/reflect/VMArray.java7
-rw-r--r--libjava/classpath/vm/reference/java/lang/reflect/VMProxy.java4
12 files changed, 92 insertions, 78 deletions
diff --git a/libjava/classpath/vm/reference/java/lang/VMClass.java b/libjava/classpath/vm/reference/java/lang/VMClass.java
index a0091c073c5..d80eecdfd9a 100644
--- a/libjava/classpath/vm/reference/java/lang/VMClass.java
+++ b/libjava/classpath/vm/reference/java/lang/VMClass.java
@@ -303,20 +303,21 @@ final class VMClass
return getComponentType(klass).getSimpleName() + "[]";
}
String fullName = getName(klass);
- 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);
+ Class enclosingClass = getEnclosingClass(klass);
+ if (enclosingClass == null)
+ // It's a top level class.
+ return fullName.substring(fullName.lastIndexOf(".") + 1);
+
+ fullName = fullName.substring(enclosingClass.getName().length());
+
+ // We've carved off the enclosing class name; now we must have '$'
+ // followed optionally by digits, followed by the class name.
+ int pos = 1;
+ while (Character.isDigit(fullName.charAt(pos)))
+ ++pos;
+ fullName = fullName.substring(pos);
+
+ return fullName;
}
/**
diff --git a/libjava/classpath/vm/reference/java/lang/VMClassLoader.java b/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
index c1d4625883c..bab7c23cc67 100644
--- a/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
+++ b/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
@@ -1,6 +1,7 @@
/* VMClassLoader.java -- Reference implementation of native interface
required by ClassLoader
- Copyright (C) 1998, 2001, 2002, 2004, 2005, 2006 Free Software Foundation
+ Copyright (C) 1998, 2001, 2002, 2004, 2005, 2006, 2010
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,7 +72,6 @@ import java.util.zip.ZipFile;
final class VMClassLoader
{
-
/** packages loaded by the bootstrap class loader */
static final HashMap definedPackages = new HashMap();
@@ -116,6 +116,7 @@ final class VMClassLoader
}
}
+ private VMClassLoader() {} // Prohibits instantiation.
/**
* Helper to define a class using a string of bytes. This assumes that
@@ -172,6 +173,7 @@ final class VMClassLoader
return (URL)e.nextElement();
return null;
}
+
/**
* Helper to get a list of resources from the bootstrap class loader.
*
@@ -239,7 +241,6 @@ final class VMClassLoader
return v.elements();
}
-
/**
* Returns a String[] of native package names. The default
* implementation tries to load a list of package from
@@ -284,7 +285,6 @@ final class VMClassLoader
return new String[0];
}
-
/**
* Helper to get a package from the bootstrap class loader.
*
diff --git a/libjava/classpath/vm/reference/java/lang/VMCompiler.java b/libjava/classpath/vm/reference/java/lang/VMCompiler.java
index fe740075671..9a7d83facee 100644
--- a/libjava/classpath/vm/reference/java/lang/VMCompiler.java
+++ b/libjava/classpath/vm/reference/java/lang/VMCompiler.java
@@ -1,5 +1,5 @@
/* VMClassLoader.java -- Reference implementation of compiler interface
- Copyright (C) 2004 Free Software Foundation
+ Copyright (C) 2004, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,7 +58,7 @@ final class VMCompiler
* compilation failed, <code>true</code> if compilation succeeded
* @throws NullPointerException if oneClass is null
*/
- public static boolean compileClass(Class oneClass)
+ static boolean compileClass(Class oneClass)
{
// Never succeed.
return false;
@@ -72,7 +72,7 @@ final class VMCompiler
* compilation failed, <code>true</code> if compilation succeeded
* @throws NullPointerException if classNames is null
*/
- public static boolean compileClasses(String classNames)
+ static boolean compileClasses(String classNames)
{
// Note the incredibly lame interface. Always fail.
return false;
@@ -87,7 +87,7 @@ final class VMCompiler
* @return a compiler-specific value, including null
* @throws NullPointerException if the compiler doesn't like a null arg
*/
- public static Object command(Object arg)
+ static Object command(Object arg)
{
// Our implementation defines this to a no-op.
return null;
@@ -98,7 +98,7 @@ final class VMCompiler
* to resume operation if it was previously disabled; provided that a
* compiler even exists.
*/
- public static void enable()
+ static void enable()
{
}
@@ -106,7 +106,7 @@ final class VMCompiler
* Calling <code>Compiler.disable()</code> will cause the compiler
* to be suspended; provided that a compiler even exists.
*/
- public static void disable()
+ static void disable()
{
}
}
diff --git a/libjava/classpath/vm/reference/java/lang/VMDouble.java b/libjava/classpath/vm/reference/java/lang/VMDouble.java
index 8e523cd2e85..edfa723a052 100644
--- a/libjava/classpath/vm/reference/java/lang/VMDouble.java
+++ b/libjava/classpath/vm/reference/java/lang/VMDouble.java
@@ -1,5 +1,5 @@
/* VMDouble.java -- VM Specific Double methods
- Copyright (C) 2003, 2005 Free Software Foundation
+ Copyright (C) 2003, 2005, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,6 +65,8 @@ final class VMDouble
initIDs();
}
+ private VMDouble() {} // Prohibits instantiation.
+
/**
* 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
@@ -79,7 +81,7 @@ final class VMDouble
* @return the bits of the <code>double</code>
* @see #longBitsToDouble(long)
*/
- public static native long doubleToRawLongBits(double value);
+ static native long doubleToRawLongBits(double value);
/**
* Convert the argument in IEEE 754 floating-point "double format" bit
@@ -94,7 +96,7 @@ final class VMDouble
* @see #doubleToLongBits(double)
* @see #doubleToRawLongBits(double)
*/
- public static native double longBitsToDouble(long bits);
+ static native double longBitsToDouble(long bits);
/**
* Helper method to convert to string.
@@ -103,13 +105,18 @@ final class VMDouble
* @param isFloat true if the conversion is requested by Float (results in
* fewer digits)
*/
- public static native String toString(double d, boolean isFloat);
+ static native String toString(double d, boolean isFloat);
/**
* Initialize JNI cache. This method is called only by the
* static initializer when using JNI.
*/
- public static native void initIDs();
+ private static native void initIDs();
- public static native double parseDouble(String str);
+ /**
+ * Parse the specified String as a double.
+ * @throws NumberFormatException if str cannot be parsed
+ * @throws NullPointerException if str is null
+ */
+ static native double parseDouble(String str);
}
diff --git a/libjava/classpath/vm/reference/java/lang/VMFloat.java b/libjava/classpath/vm/reference/java/lang/VMFloat.java
index ba523d6973e..e6e784f3392 100644
--- a/libjava/classpath/vm/reference/java/lang/VMFloat.java
+++ b/libjava/classpath/vm/reference/java/lang/VMFloat.java
@@ -1,5 +1,5 @@
/* VMFloat.java -- VM Specific Float methods
- Copyright (C) 2003 Free Software Foundation
+ Copyright (C) 2003, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,6 +63,8 @@ final class VMFloat
}
}
+ private VMFloat() {} // Prohibits instantiation.
+
/**
* 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
diff --git a/libjava/classpath/vm/reference/java/lang/VMMath.java b/libjava/classpath/vm/reference/java/lang/VMMath.java
index dc5fd420708..35c3f645e42 100644
--- a/libjava/classpath/vm/reference/java/lang/VMMath.java
+++ b/libjava/classpath/vm/reference/java/lang/VMMath.java
@@ -1,5 +1,5 @@
/* VMMath.java -- Common mathematical functions.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,7 @@ package java.lang;
import gnu.classpath.Configuration;
-class VMMath
+final class VMMath
{
static
@@ -51,6 +51,8 @@ class VMMath
}
}
+ private VMMath() {} // Prohibits instantiation.
+
/**
* The trigonometric function <em>sin</em>. The sine of NaN or infinity is
* NaN, and the sine of 0 retains its sign. This is accurate within 1 ulp,
@@ -59,7 +61,7 @@ class VMMath
* @param a the angle (in radians)
* @return sin(a)
*/
- public static native double sin(double a);
+ static native double sin(double a);
/**
* The trigonometric function <em>cos</em>. The cosine of NaN or infinity is
@@ -68,7 +70,7 @@ class VMMath
* @param a the angle (in radians)
* @return cos(a)
*/
- public static native double cos(double a);
+ static native double cos(double a);
/**
* The trigonometric function <em>tan</em>. The tangent of NaN or infinity
@@ -78,7 +80,7 @@ class VMMath
* @param a the angle (in radians)
* @return tan(a)
*/
- public static native double tan(double a);
+ static native double tan(double a);
/**
* The trigonometric function <em>arcsin</em>. The range of angles returned
@@ -89,7 +91,7 @@ class VMMath
* @param a the sin to turn back into an angle
* @return arcsin(a)
*/
- public static native double asin(double a);
+ static native double asin(double a);
/**
* The trigonometric function <em>arccos</em>. The range of angles returned
@@ -100,7 +102,7 @@ class VMMath
* @param a the cos to turn back into an angle
* @return arccos(a)
*/
- public static native double acos(double a);
+ static native double acos(double a);
/**
* The trigonometric function <em>arcsin</em>. The range of angles returned
@@ -112,7 +114,7 @@ class VMMath
* @return arcsin(a)
* @see #atan2(double, double)
*/
- public static native double atan(double a);
+ static native double atan(double a);
/**
* A special version of the trigonometric function <em>arctan</em>, for
@@ -161,7 +163,7 @@ class VMMath
* @return <em>theta</em> in the conversion of (x, y) to (r, theta)
* @see #atan(double)
*/
- public static native double atan2(double y, double x);
+ static native double atan2(double y, double x);
/**
* Take <em>e</em><sup>a</sup>. The opposite of <code>log()</code>. If the
@@ -175,7 +177,7 @@ class VMMath
* @see #log(double)
* @see #pow(double, double)
*/
- public static native double exp(double a);
+ static native double exp(double a);
/**
* Take ln(a) (the natural log). The opposite of <code>exp()</code>. If the
@@ -191,7 +193,7 @@ class VMMath
* @return the natural log of <code>a</code>
* @see #exp(double)
*/
- public static native double log(double a);
+ static native double log(double a);
/**
* Take a square root. If the argument is NaN or negative, the result is
@@ -205,7 +207,7 @@ class VMMath
* @return the square root of the argument
* @see #pow(double, double)
*/
- public static native double sqrt(double a);
+ static native double sqrt(double a);
/**
* Raise a number to a power. Special cases:<ul>
@@ -275,7 +277,7 @@ class VMMath
* @param b the power to raise it to
* @return a<sup>b</sup>
*/
- public static native double pow(double a, double b);
+ static native double pow(double a, double b);
/**
* Get the IEEE 754 floating point remainder on two numbers. This is the
@@ -291,7 +293,7 @@ class VMMath
* @return the IEEE 754-defined floating point remainder of x/y
* @see #rint(double)
*/
- public static native double IEEEremainder(double x, double y);
+ static native double IEEEremainder(double x, double y);
/**
* Take the nearest integer that is that is greater than or equal to the
@@ -302,7 +304,7 @@ class VMMath
* @param a the value to act upon
* @return the nearest integer &gt;= <code>a</code>
*/
- public static native double ceil(double a);
+ static native double ceil(double a);
/**
* Take the nearest integer that is that is less than or equal to the
@@ -312,7 +314,7 @@ class VMMath
* @param a the value to act upon
* @return the nearest integer &lt;= <code>a</code>
*/
- public static native double floor(double a);
+ static native double floor(double a);
/**
* Take the nearest integer to the argument. If it is exactly between
@@ -322,7 +324,7 @@ class VMMath
* @param a the value to act upon
* @return the nearest integer to <code>a</code>
*/
- public static native double rint(double a);
+ static native double rint(double a);
/**
* <p>
@@ -342,7 +344,7 @@ class VMMath
* @see #sqrt(double)
* @see #pow(double, double)
*/
- public static native double cbrt(double a);
+ static native double cbrt(double a);
/**
* <p>
@@ -362,7 +364,7 @@ class VMMath
* @return the hyperbolic cosine of <code>a</code>.
* @since 1.5
*/
- public static native double cosh(double a);
+ static native double cosh(double a);
/**
* <p>
@@ -382,7 +384,7 @@ class VMMath
* @return <code>e<sup>a</sup> - 1</code>
* @since 1.5
*/
- public static native double expm1(double a);
+ static native double expm1(double a);
/**
* <p>
@@ -402,7 +404,7 @@ class VMMath
* @return the hypotenuse matching the supplied parameters.
* @since 1.5
*/
- public static native double hypot(double a, double b);
+ static native double hypot(double a, double b);
/**
* <p>
@@ -422,7 +424,7 @@ class VMMath
* @return the base 10 logarithm of <code>a</code>.
* @since 1.5
*/
- public static native double log10(double a);
+ static native double log10(double a);
/**
* <p>
@@ -444,7 +446,7 @@ class VMMath
* @return the natural logarithm of <code>a</code> + 1.
* @since 1.5
*/
- public static native double log1p(double a);
+ static native double log1p(double a);
/**
* <p>
@@ -463,7 +465,7 @@ class VMMath
* @return the hyperbolic sine of <code>a</code>.
* @since 1.5
*/
- public static native double sinh(double a);
+ static native double sinh(double a);
/**
* <p>
@@ -488,6 +490,5 @@ class VMMath
* @return the hyperbolic tangent of <code>a</code>.
* @since 1.5
*/
- public static native double tanh(double a);
-
+ static native double tanh(double a);
}
diff --git a/libjava/classpath/vm/reference/java/lang/VMObject.java b/libjava/classpath/vm/reference/java/lang/VMObject.java
index 279f250c089..6a0785330bd 100644
--- a/libjava/classpath/vm/reference/java/lang/VMObject.java
+++ b/libjava/classpath/vm/reference/java/lang/VMObject.java
@@ -1,5 +1,5 @@
/* VMObject.java -- Reference implementation for VM hooks used by Object
- Copyright (C) 1998, 2002, 2005 Free Software Foundation
+ Copyright (C) 1998, 2002, 2005, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,6 +46,9 @@ package java.lang;
*/
final class VMObject
{
+
+ private VMObject() {} // Prohibits instantiation.
+
/**
* Returns the runtime {@link Class} of a given Object.
*
diff --git a/libjava/classpath/vm/reference/java/lang/VMString.java b/libjava/classpath/vm/reference/java/lang/VMString.java
index e1fbf839023..181e08543f5 100644
--- a/libjava/classpath/vm/reference/java/lang/VMString.java
+++ b/libjava/classpath/vm/reference/java/lang/VMString.java
@@ -1,5 +1,5 @@
/* VMString.java -- VM Specific String methods
- Copyright (C) 2003 Free Software Foundation
+ Copyright (C) 2003, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,6 +60,8 @@ final class VMString
*/
private static final WeakHashMap internTable = new WeakHashMap();
+ private VMString() {} // Prohibits instantiation.
+
/**
* Fetches this String from the intern hashtable. If two Strings are
* considered equal, by the equals() method, then intern() will return the
diff --git a/libjava/classpath/vm/reference/java/lang/VMSystem.java b/libjava/classpath/vm/reference/java/lang/VMSystem.java
index 52a3c1c9f66..0b3d6920055 100644
--- a/libjava/classpath/vm/reference/java/lang/VMSystem.java
+++ b/libjava/classpath/vm/reference/java/lang/VMSystem.java
@@ -1,5 +1,5 @@
/* VMSystem.java -- helper for java.lang.system
- Copyright (C) 1998, 2002, 2004 Free Software Foundation
+ Copyright (C) 1998, 2002, 2004, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,6 +56,9 @@ import java.io.PrintStream;
*/
final class VMSystem
{
+
+ private VMSystem() {} // Prohibits instantiation.
+
/**
* Copy one array onto another from <code>src[srcStart]</code> ...
* <code>src[srcStart+len-1]</code> to <code>dest[destStart]</code> ...
@@ -95,15 +98,6 @@ final class VMSystem
static native int identityHashCode(Object o);
/**
- * Convert a library name to its platform-specific variant.
- *
- * @param libname the library name, as used in <code>loadLibrary</code>
- * @return the platform-specific mangling of the name
- * @XXX Add this method
- static native String mapLibraryName(String libname);
- */
-
- /**
* Set {@link System#in} to a new InputStream.
*
* @param in the new InputStream
@@ -135,10 +129,7 @@ final class VMSystem
* @return the current time
* @see java.util.Date
*/
- public static long currentTimeMillis()
- {
- return nanoTime() / 1000000L;
- }
+ static native long currentTimeMillis();
/**
* <p>
@@ -165,7 +156,7 @@ final class VMSystem
* @return the time of a system timer in nanoseconds.
* @since 1.5
*/
- public static native long nanoTime();
+ static native long nanoTime();
/**
* Returns a list of 'name=value' pairs representing the current environment
diff --git a/libjava/classpath/vm/reference/java/lang/management/VMManagementFactory.java b/libjava/classpath/vm/reference/java/lang/management/VMManagementFactory.java
index f10497014b4..253311cdf2c 100644
--- a/libjava/classpath/vm/reference/java/lang/management/VMManagementFactory.java
+++ b/libjava/classpath/vm/reference/java/lang/management/VMManagementFactory.java
@@ -1,5 +1,5 @@
/* VMManagementFactory.java - VM interface for obtaining system beans.
- Copyright (C) 2006 Free Software Foundation
+ Copyright (C) 2006, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,6 +48,8 @@ package java.lang.management;
final class VMManagementFactory
{
+ private VMManagementFactory() {} // Prohibits instantiation.
+
/**
* Return a list of the names of the currently available
* memory pools within the virtual machine.
diff --git a/libjava/classpath/vm/reference/java/lang/reflect/VMArray.java b/libjava/classpath/vm/reference/java/lang/reflect/VMArray.java
index d6277aebdbd..2055c170eca 100644
--- a/libjava/classpath/vm/reference/java/lang/reflect/VMArray.java
+++ b/libjava/classpath/vm/reference/java/lang/reflect/VMArray.java
@@ -1,5 +1,6 @@
/* java.lang.reflect.VMArray - VM class for array manipulation by reflection.
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005, 2010
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +41,7 @@ package java.lang.reflect;
import gnu.classpath.Configuration;
-class VMArray
+final class VMArray
{
static
@@ -51,6 +52,8 @@ class VMArray
}
}
+ private VMArray() {} // Prohibits instantiation.
+
/**
* Dynamically create an array of objects.
*
diff --git a/libjava/classpath/vm/reference/java/lang/reflect/VMProxy.java b/libjava/classpath/vm/reference/java/lang/reflect/VMProxy.java
index 8c7b67a7202..a9d6093ebab 100644
--- a/libjava/classpath/vm/reference/java/lang/reflect/VMProxy.java
+++ b/libjava/classpath/vm/reference/java/lang/reflect/VMProxy.java
@@ -1,5 +1,5 @@
/* VMProxy.java -- VM interface for proxy class
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,6 +67,8 @@ final class VMProxy
*/
static boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
+ private VMProxy() {} // Prohibits instantiation.
+
/**
* Optional native method to replace (and speed up) the pure Java
* implementation of getProxyClass. Only needed if
OpenPOWER on IntegriCloud