diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-07-08 22:20:55 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-07-08 22:20:55 +0000 |
commit | 59c406834e89496fe126a7b43e6ce41a6dc10b6e (patch) | |
tree | 29372c66fb56af812642a560f56a40a0967f0fc2 /vm | |
parent | e4756346237f272db431173cc701944f800052b1 (diff) | |
download | classpath-59c406834e89496fe126a7b43e6ce41a6dc10b6e.tar.gz |
Tidy up VM reference implementation, making all classes final and all methods and constructors package-private.
2010-04-12 Ivan Maidanski <ivmai@mail.ru>
* vm/reference/gnu/classpath/VMStackWalker.java: Make the default
constructor private.
* vm/reference/gnu/classpath/VMSystemProperties.java: Likewise and make class final.
* vm/reference/gnu/java/lang/VMCPStringBuilder.java: Likewise.
* vm/reference/gnu/java/lang/VMInstrumentationImpl.java: Likewise.
* vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/lang/management/VMRuntimeMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java:
Likewise.
* vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java: Likewise.
Make class non-public and add missing full stop in comment.
* vm/reference/gnu/java/nio/VMPipe.java: Make the default constructor private.
* vm/reference/gnu/java/nio/VMSelector.java: Likewise and make class non-public.
* vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java:
Make the default constructor private.
(Spinner.stop()): Make package-private to ease access from enclosing class.
* vm/reference/java/io/VMFile.java: Make the default constructor private.
Fix punctuation in documentation.
(getTotalSpace(String)): Make package-private.
(getFreeSpace(String)): Likewise.
(getUsableSpace(String)): Likewise.
(setReadable(String,boolean,boolean)): Likewise.
(setExecutable(String,boolean,boolean)): Likewise.
(toCanonicalForm(String)): Likewise.
* vm/reference/java/io/VMObjectInputStream.java: Make default constructor private.
* vm/reference/java/io/VMObjectStreamClass.java: Likewise.
* vm/reference/java/lang/VMClassLoader.java: Likewise.
* vm/reference/java/lang/VMCompiler.java:
(compileClass(Class)): Make package-private.
(compileClasses(String)): Likewise.
(command(String)): Likewise.
(enable()): Likewise.
(disable()): Likewise.
* vm/reference/java/lang/VMDouble.java: Make constructor package-private.
(doubleToRawLongBits(double)): Make package-private.
(longBitsToDouble(long)): Likewise.
(toString(double, boolean)): Likewise.
(initIDs()): Make private.
(parseDouble(String)): Make package-private.
* vm/reference/java/lang/VMFloat.java: Make constructor package-private.
* vm/reference/java/lang/VMMath.java: Likewise and make class final.
(sin(double)): Make package-private.
(cos(double)): Likewise.
(tan(double)): Likewise.
(asin(double)): Likewise.
(acos(double)): Likewise.
(atan(double)): Likewise.
(atan2(double, double)): Likewise.
(exp(double)): Likewise.
(log(double)): Likewise.
(sqrt(double)): Likewise.
(pow(double)): Likewise.
(IEEEremainder(double, double)): Likewise.
(ceil(double)): Likewise.
(floor(double)): Likewise.
(rint(double)): Likewise.
(cbrt(double)): Likewise.
(cosh(double)): Likewise.
(expm1(double)): Likewise.
(hypot(double)): Likewise.
(log10(double)): Likewise.
(log1p(double)): Likewise.
(sinh(double)): Likewise.
(tanh(double)): Likewise.
* vm/reference/java/lang/VMObject.java: Make constructor package-private.
* vm/reference/java/lang/VMString.java: Likewise.
* vm/reference/java/lang/VMSystem.java: Likewise.
(mapLibraryName(String)): Remove the commented out function (since
exists in VMRuntime).
(currentTimeMillis()): Make package-private.
(nanoTime()): Likewise.
* vm/reference/java/lang/management/VMManagementFactory.java:
Make constructor package-private.
* vm/reference/java/lang/reflect/VMArray.java: Make constructor
package-private and class final.
* vm/reference/java/lang/reflect/VMProxy.java: Make constructor
package-private.
* vm/reference/java/net/VMInetAddress.java: Make constructor package-private
and class final..
(getLocalHostname()): Make package-private.
(lookupInaddrAny()): Likewise.
(getHostByAddr(byte[])): Likewise.
(getHostByName(String)): Likewise.
(aton(String)): Likewise.
* vm/reference/java/net/VMURLConnection.java: Make constructor package-private.
(LENGTH): Likewise.
* vm/reference/java/nio/VMDirectByteBuffer.java: Make constructor package-private.
Fix indenting.
* vm/reference/java/security/VMSecureRandom.java: Make constructor package-private.
Make the default constructor private.
(Spinner.stop()): Make package-private to ease access from enclosing class.
* vm/reference/java/util/VMTimeZone.java: Make constructor package-private.
* vm/reference/sun/misc/Unsafe.java: Make class final.
(unsafe): Make final.
Diffstat (limited to 'vm')
37 files changed, 243 insertions, 148 deletions
diff --git a/vm/reference/gnu/classpath/VMStackWalker.java b/vm/reference/gnu/classpath/VMStackWalker.java index 2214e7571..26c405356 100644 --- a/vm/reference/gnu/classpath/VMStackWalker.java +++ b/vm/reference/gnu/classpath/VMStackWalker.java @@ -1,5 +1,5 @@ /* VMStackWalker.java -- Reference implementation of VM hooks for stack access - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,9 @@ package gnu.classpath; */ public final class VMStackWalker { + + private VMStackWalker() {} // Prohibits instantiation. + /** * Get a list of all the classes currently executing methods on the * Java stack. <code>getClassContext()[0]</code> is the class associated diff --git a/vm/reference/gnu/classpath/VMSystemProperties.java b/vm/reference/gnu/classpath/VMSystemProperties.java index 1e0dd4e26..d1ce7751c 100644 --- a/vm/reference/gnu/classpath/VMSystemProperties.java +++ b/vm/reference/gnu/classpath/VMSystemProperties.java @@ -1,5 +1,5 @@ /* VMSystemProperties.java -- Allow the VM to set System properties. - Copyright (C) 2004 Free Software Foundation + Copyright (C) 2004, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -39,8 +39,11 @@ package gnu.classpath; import java.util.Properties; -class VMSystemProperties +final class VMSystemProperties { + + private VMSystemProperties() {} // Prohibits instantiation. + /** * Get the system properties. This is done here, instead of in System, * because of the bootstrap sequence. Note that the native code should diff --git a/vm/reference/gnu/java/lang/VMCPStringBuilder.java b/vm/reference/gnu/java/lang/VMCPStringBuilder.java index c3a3784f3..391f7af95 100644 --- a/vm/reference/gnu/java/lang/VMCPStringBuilder.java +++ b/vm/reference/gnu/java/lang/VMCPStringBuilder.java @@ -1,5 +1,5 @@ /* VMCPStringBuilder.java -- Growable strings without locking or copying - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -72,6 +72,8 @@ final class VMCPStringBuilder } } + private VMCPStringBuilder() {} // Prohibits instantiation. + /** * Convert this <code>StringBuilder</code> to a <code>String</code>. The * String is composed of the characters currently in this StringBuilder. Note diff --git a/vm/reference/gnu/java/lang/VMInstrumentationImpl.java b/vm/reference/gnu/java/lang/VMInstrumentationImpl.java index 5501f0f7f..d9583ac8c 100644 --- a/vm/reference/gnu/java/lang/VMInstrumentationImpl.java +++ b/vm/reference/gnu/java/lang/VMInstrumentationImpl.java @@ -1,6 +1,6 @@ /* VMInstrumentationImpl.java -- interface for the GNU implementation of InstrumentationImpl - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,6 +49,8 @@ import java.lang.instrument.Instrumentation; final class VMInstrumentationImpl { + private VMInstrumentationImpl() {} // Prohibits instantiation. + /** * Returns if the current JVM supports class redefinition * diff --git a/vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java index ea4989741..7b94020a4 100644 --- a/vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java @@ -1,5 +1,5 @@ /* VMClassLoadingMXBeanImpl.java - VM impl. of a class loading bean - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,6 +49,8 @@ package gnu.java.lang.management; final class VMClassLoadingMXBeanImpl { + private VMClassLoadingMXBeanImpl() {} // Prohibits instantiation. + /** * Returns the number of classes currently loaded by * the virtual machine. diff --git a/vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java index 019af0ca4..f421a8aa4 100644 --- a/vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMCompilationMXBeanImpl.java @@ -1,5 +1,5 @@ /* VMCompilationMXBeanImpl.java - VM implementation of a compilation bean - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,8 @@ package gnu.java.lang.management; final class VMCompilationMXBeanImpl { + private VMCompilationMXBeanImpl() {} // Prohibits instantiation. + /** * Returns the number of milliseconds the JIT * compiler has spent compiling Java bytecode diff --git a/vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java index 00861bc21..99450b410 100644 --- a/vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java @@ -1,5 +1,5 @@ /* VMGarbageCollectorMXBeanImpl.java - VM interface for a GC bean - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -52,6 +52,8 @@ package gnu.java.lang.management; final class VMGarbageCollectorMXBeanImpl { + private VMGarbageCollectorMXBeanImpl() {} // Prohibits instantiation. + /** * Returns the number of collections the garbage collector * represented by this bean has made. -1 is returned if the diff --git a/vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java index 7f69bdfb7..12aa88618 100644 --- a/vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMMemoryMXBeanImpl.java @@ -1,5 +1,5 @@ /* VMMemoryMXBeanImpl.java - VM impl. of a memory bean - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -57,6 +57,8 @@ import java.util.List; final class VMMemoryMXBeanImpl { + private VMMemoryMXBeanImpl() {} // Prohibits instantiation. + /** * Returns an instance of {@link java.lang.management.MemoryUsage} * with appropriate initial, used, committed and maximum values diff --git a/vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java index 477329f0a..81a8c0d21 100644 --- a/vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java @@ -1,5 +1,5 @@ /* VMMemoryManagerMXBeanImpl.java - VM interface for a memory manager bean - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -56,6 +56,8 @@ import java.util.List; final class VMMemoryManagerMXBeanImpl { + private VMMemoryManagerMXBeanImpl() {} // Prohibits instantiation. + /** * Returns an array containing the names of the memory pools * this memory manager manages. diff --git a/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java index 36cd2586a..39775c4ed 100644 --- a/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java @@ -1,5 +1,5 @@ /* MemoryPoolMXBeanImpl.java - VM interface for memory pool beans - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,6 +49,8 @@ import java.lang.management.MemoryUsage; final class VMMemoryPoolMXBeanImpl { + private VMMemoryPoolMXBeanImpl() {} // Prohibits instantiation. + /** * Returns memory usage statistics for the specified pool * just after a best-effort attempt to free memory. This diff --git a/vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java index 20b3f9ed2..5530007ae 100644 --- a/vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java @@ -1,5 +1,5 @@ /* VMOperatingSystemMXBeanImpl.java - VM implementation of an OS bean - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -56,6 +56,8 @@ final class VMOperatingSystemMXBeanImpl } } + private VMOperatingSystemMXBeanImpl() {} // Prohibits instantiation. + /** * Returns the system load average from the last * minute. diff --git a/vm/reference/gnu/java/lang/management/VMRuntimeMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMRuntimeMXBeanImpl.java index 32a866046..1bffa75c5 100644 --- a/vm/reference/gnu/java/lang/management/VMRuntimeMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMRuntimeMXBeanImpl.java @@ -1,5 +1,5 @@ /* VMRuntimeMXBeanImpl.java - VM implementation of an runtime bean - 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 @@ import gnu.classpath.SystemProperties; final class VMRuntimeMXBeanImpl { + private VMRuntimeMXBeanImpl() {} // Prohibits instantiation. + /** * Returns the command-line arguments supplied * to the virtual machine, excluding those supplied diff --git a/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java b/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java index 33448d9d5..8fd0d90a2 100644 --- a/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java +++ b/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java @@ -1,5 +1,5 @@ /* VMThreadMXBeanImpl.java - VM impl. of a thread bean - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -58,6 +58,8 @@ final class VMThreadMXBeanImpl */ private static int filled; + private VMThreadMXBeanImpl() {} // Prohibits instantiation. + /** * Returns the ids of cycles of deadlocked threads, occurring * due to monitor ownership or ownable synchronizer ownership. diff --git a/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java b/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java index da0f893cf..399470036 100644 --- a/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java +++ b/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java @@ -1,5 +1,5 @@ /* PlainDatagramSocketImpl.java -- VM interface for DatagramSocket impl - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -53,7 +53,7 @@ import java.net.SocketException; * @author Ingo Proetel (proetel@aicas.com) * @author Roman Kennke (kennke@aicas.com) */ -public final class VMPlainDatagramSocketImpl +final class VMPlainDatagramSocketImpl { /** * Option id for the IP_TTL (time to live) value. @@ -70,8 +70,10 @@ public final class VMPlainDatagramSocketImpl } } + private VMPlainDatagramSocketImpl() {} // Prohibits instantiation. + /** - * Binds this socket to a particular port and interface + * Binds this socket to a particular port and interface. * * @param socket the socket object * @param port the port to bind to diff --git a/vm/reference/gnu/java/nio/VMPipe.java b/vm/reference/gnu/java/nio/VMPipe.java index a36970452..9a0753425 100644 --- a/vm/reference/gnu/java/nio/VMPipe.java +++ b/vm/reference/gnu/java/nio/VMPipe.java @@ -1,5 +1,5 @@ /* VMPipe.java -- Reference implementation for VM hooks used by PipeImpl - Copyright (C) 2004 Free Software Foundation + Copyright (C) 2004, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -58,6 +58,8 @@ final class VMPipe } } + private VMPipe() {} // Prohibits instantiation. + /** * Create a pipe, consisting of a readable VMChannel and a writable * VMChannel. The readable channel is returned is the first element diff --git a/vm/reference/gnu/java/nio/VMSelector.java b/vm/reference/gnu/java/nio/VMSelector.java index 4d37c2c1c..18fad5c8a 100644 --- a/vm/reference/gnu/java/nio/VMSelector.java +++ b/vm/reference/gnu/java/nio/VMSelector.java @@ -1,5 +1,5 @@ /* VMSelector.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,8 +40,9 @@ package gnu.java.nio; import gnu.classpath.Configuration; import java.io.IOException; -public final class VMSelector +final class VMSelector { + static { // load the shared library needed for native methods. @@ -51,6 +52,8 @@ public final class VMSelector } } + private VMSelector() {} // Prohibits instantiation. + // A timeout value of 0 means block forever. static native int select (int[] read, int[] write, int[] except, long timeout) diff --git a/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java b/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java index 86faa097c..fef92d845 100644 --- a/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java +++ b/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java @@ -1,5 +1,5 @@ /* VMSecureRandom.java -- random seed generator. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -55,6 +55,8 @@ package gnu.java.security.jce.prng; final class VMSecureRandom { + private VMSecureRandom() {} // Prohibits instantiation. + /** * Generate a random seed. Implementations are free to generate * fewer random bytes than are requested, and leave the remaining @@ -104,7 +106,8 @@ final class VMSecureRandom return length; } - static class Spinner implements Runnable + static class Spinner + implements Runnable { volatile byte value; volatile boolean running; @@ -121,7 +124,7 @@ final class VMSecureRandom value++; } - private void stop() + void stop() { running = false; } diff --git a/vm/reference/java/io/VMFile.java b/vm/reference/java/io/VMFile.java index 2af1e95c8..f2ac5c38c 100644 --- a/vm/reference/java/io/VMFile.java +++ b/vm/reference/java/io/VMFile.java @@ -1,5 +1,5 @@ /* VMFile.java -- Class for methods natively accessing files - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ import gnu.java.io.PlatformHelper; */ final class VMFile { + // FIXME: We support only case sensitive filesystems currently. static final boolean IS_CASE_SENSITIVE = true; static final boolean IS_DOS_8_3 = false; @@ -62,105 +63,113 @@ final class VMFile } } - /* + private VMFile() {} // Prohibits instantiation. + + /** * This native method does the actual work of getting the last file * modification time. It also does the existence check to avoid the - * overhead of a call to exists() + * overhead of a call to exists(). */ static native long lastModified(String path); - /* + /** * This native method sets the permissions to make the file read only. + * + * @return true if file exists and the operation completed successfully */ static native boolean setReadOnly(String path); /** - * This method is used to create a temporary file + * This method is used to create a temporary file. */ static native boolean create(String path) throws IOException; - /* + /** * This native function actually produces the list of files in this - * directory + * directory. + * + * @return null if dirpath does not exist or is not a directory; + * null or empty array if the directory is unreadable; an array of + * file names in the directory otherwise. */ static native synchronized String[] list(String dirpath); - /* + /** * This native method actually performs the rename. */ static native boolean renameTo(String targetpath, String destpath); - /* + /** * This native method actually determines the length of the file and - * handles the existence check + * handles the existence check. */ static native long length(String path); - /* + /** * This native method does the actual checking of file existence. */ static native boolean exists(String path); - /* - * This native method handles the actual deleting of the file + /** + * This native method handles the actual deleting of the file. */ static native boolean delete(String path); - /* + /** * This method does the actual setting of the modification time. */ static native boolean setLastModified(String path, long time); - /* - * This native method actually creates the directory + /** + * This native method actually creates the directory. */ static native boolean mkdir(String dirpath); /** * Gets the total bytes of the filesystem named by path. */ - public static native long getTotalSpace(String path); + static native long getTotalSpace(String path); /** * Gets the total free bytes of the filesystem named by path. */ - public static native long getFreeSpace(String path); + static native long getFreeSpace(String path); /** * Gets the available bytes of the filesystem named by path. */ - public static native long getUsableSpace(String path); + static native long getUsableSpace(String path); /** * Set the read permission of the file. */ - public static synchronized native boolean setReadable(String path, - boolean readable, - boolean ownerOnly); + static synchronized native boolean setReadable(String path, + boolean readable, + boolean ownerOnly); /** * Set the write permission of the file. */ - public static synchronized native boolean setWritable(String path, - boolean writable, - boolean ownerOnly); + static synchronized native boolean setWritable(String path, + boolean writable, + boolean ownerOnly); /** * Set the execute permission of the file. */ - public static synchronized native boolean setExecutable(String path, - boolean executable, - boolean ownerOnly); + static synchronized native boolean setExecutable(String path, + boolean executable, + boolean ownerOnly); - /* + /** * This native method does the actual check of whether or not a file * is a plain file or not. It also handles the existence check to - * eliminate the overhead of a call to exists() + * eliminate the overhead of a call to exists(). */ static native boolean isFile(String path); /** - * This native method checks file permissions for writing + * This native method checks file permissions for writing. */ static synchronized native boolean canWrite(String path); @@ -170,19 +179,23 @@ final class VMFile static native boolean canWriteDirectory(String path); /** - * This native method checks file permissions for reading + * This native method checks file permissions for reading. + * It also handles the existence check to eliminate the overhead of + * a call to exists(). */ static synchronized native boolean canRead(String path); /** - * This native method checks file permissions for execution + * This native method checks file permissions for execution. + * It also handles the existence check to eliminate the overhead of + * a call to exists(). */ static synchronized native boolean canExecute(String path); - /* + /** * This method does the actual check of whether or not a file is a - * directory or not. It also handle the existence check to eliminate - * the overhead of a call to exists() + * directory or not. It also handles the existence check to eliminate + * the overhead of a call to exists(). */ static native boolean isDirectory(String dirpath); @@ -359,9 +372,9 @@ final class VMFile * <p> * Note that this method, unlike the other methods which return path * names, can throw an IOException. This is because native method - * might be required in order to resolve the canonical path + * might be required in order to resolve the canonical path. * * @exception IOException If an error occurs */ - public static native String toCanonicalForm(String path) throws IOException; + static native String toCanonicalForm(String path) throws IOException; } diff --git a/vm/reference/java/io/VMObjectInputStream.java b/vm/reference/java/io/VMObjectInputStream.java index 10e1f34cb..a29115bbe 100644 --- a/vm/reference/java/io/VMObjectInputStream.java +++ b/vm/reference/java/io/VMObjectInputStream.java @@ -1,5 +1,5 @@ /* ObjectInputStream.java -- Class used to read serialized objects - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,6 +44,7 @@ import java.lang.reflect.Constructor; final class VMObjectInputStream { + static { if (Configuration.INIT_LOAD_LIBRARY) @@ -52,6 +53,8 @@ final class VMObjectInputStream } } + private VMObjectInputStream() {} // Prohibits instantiation. + /** * Allocates a new Object of type clazz but without running the * default constructor on it. It then calls the given constructor on diff --git a/vm/reference/java/io/VMObjectStreamClass.java b/vm/reference/java/io/VMObjectStreamClass.java index fbaf7d6c8..6a78d8ec8 100644 --- a/vm/reference/java/io/VMObjectStreamClass.java +++ b/vm/reference/java/io/VMObjectStreamClass.java @@ -1,5 +1,5 @@ /* VMObjectStreamClass.java -- VM helper functions for ObjectStreamClass - Copyright (C) 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -43,6 +43,7 @@ import java.lang.reflect.Field; final class VMObjectStreamClass { + static { if (Configuration.INIT_LOAD_LIBRARY) @@ -51,6 +52,8 @@ final class VMObjectStreamClass } } + private VMObjectStreamClass() {} // Prohibits instantiation. + /** * Returns true if CLAZZ has a static class initializer * (a.k.a. <clinit>). diff --git a/vm/reference/java/lang/VMClassLoader.java b/vm/reference/java/lang/VMClassLoader.java index c1d462588..c2817d349 100644 --- a/vm/reference/java/lang/VMClassLoader.java +++ b/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,14 +72,12 @@ import java.util.zip.ZipFile; final class VMClassLoader { - /** packages loaded by the bootstrap class loader */ static final HashMap definedPackages = new HashMap(); /** jars from property java.boot.class.path */ static final HashMap bootjars = new HashMap(); - /** * Converts the array string of native package names to * Packages. The packages are then put into the @@ -116,6 +115,7 @@ final class VMClassLoader } } + private VMClassLoader() {} // Prohibits instantiation. /** * Helper to define a class using a string of bytes. This assumes that @@ -172,6 +172,7 @@ final class VMClassLoader return (URL)e.nextElement(); return null; } + /** * Helper to get a list of resources from the bootstrap class loader. * @@ -239,7 +240,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 +284,6 @@ final class VMClassLoader return new String[0]; } - /** * Helper to get a package from the bootstrap class loader. * diff --git a/vm/reference/java/lang/VMCompiler.java b/vm/reference/java/lang/VMCompiler.java index fe7400756..9a7d83fac 100644 --- a/vm/reference/java/lang/VMCompiler.java +++ b/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/vm/reference/java/lang/VMDouble.java b/vm/reference/java/lang/VMDouble.java index 8e523cd2e..edfa723a0 100644 --- a/vm/reference/java/lang/VMDouble.java +++ b/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/vm/reference/java/lang/VMFloat.java b/vm/reference/java/lang/VMFloat.java index ba523d697..e6e784f33 100644 --- a/vm/reference/java/lang/VMFloat.java +++ b/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/vm/reference/java/lang/VMMath.java b/vm/reference/java/lang/VMMath.java index dc5fd4207..35c3f645e 100644 --- a/vm/reference/java/lang/VMMath.java +++ b/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 >= <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 <= <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/vm/reference/java/lang/VMObject.java b/vm/reference/java/lang/VMObject.java index 279f250c0..6a0785330 100644 --- a/vm/reference/java/lang/VMObject.java +++ b/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/vm/reference/java/lang/VMString.java b/vm/reference/java/lang/VMString.java index e1fbf8390..181e08543 100644 --- a/vm/reference/java/lang/VMString.java +++ b/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/vm/reference/java/lang/VMSystem.java b/vm/reference/java/lang/VMSystem.java index 52a3c1c9f..a19466328 100644 --- a/vm/reference/java/lang/VMSystem.java +++ b/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,7 +129,7 @@ final class VMSystem * @return the current time * @see java.util.Date */ - public static long currentTimeMillis() + static long currentTimeMillis() { return nanoTime() / 1000000L; } @@ -165,7 +159,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/vm/reference/java/lang/management/VMManagementFactory.java b/vm/reference/java/lang/management/VMManagementFactory.java index f10497014..253311cdf 100644 --- a/vm/reference/java/lang/management/VMManagementFactory.java +++ b/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/vm/reference/java/lang/reflect/VMArray.java b/vm/reference/java/lang/reflect/VMArray.java index d6277aebd..2055c170e 100644 --- a/vm/reference/java/lang/reflect/VMArray.java +++ b/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/vm/reference/java/lang/reflect/VMProxy.java b/vm/reference/java/lang/reflect/VMProxy.java index 8c7b67a72..a9d6093eb 100644 --- a/vm/reference/java/lang/reflect/VMProxy.java +++ b/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 diff --git a/vm/reference/java/net/VMInetAddress.java b/vm/reference/java/net/VMInetAddress.java index a99c216b9..97ae09a74 100644 --- a/vm/reference/java/net/VMInetAddress.java +++ b/vm/reference/java/net/VMInetAddress.java @@ -1,5 +1,5 @@ /* VMInetAddress.java -- Class to model an Internet address - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,16 +40,17 @@ package java.net; import gnu.classpath.Configuration; -import java.io.Serializable; - -class VMInetAddress implements Serializable +final class VMInetAddress { + static { if (Configuration.INIT_LOAD_LIBRARY) System.loadLibrary("javanet"); } + private VMInetAddress() {} // Prohibits instantiation. + /** * This method looks up the hostname of the local machine * we are on. If the actual hostname cannot be determined, then the @@ -58,12 +59,12 @@ class VMInetAddress implements Serializable * * @return The local hostname. */ - public static native String getLocalHostname(); + static native String getLocalHostname(); /** * Returns the value of the special address INADDR_ANY */ - public static native byte[] lookupInaddrAny() throws UnknownHostException; + static native byte[] lookupInaddrAny() throws UnknownHostException; /** * This method returns the hostname for a given IP address. It will @@ -75,14 +76,14 @@ class VMInetAddress implements Serializable * * @exception UnknownHostException If the reverse lookup fails */ - public static native String getHostByAddr(byte[] ip) + static native String getHostByAddr(byte[] ip) throws UnknownHostException; /** * Returns a list of all IP addresses for a given hostname. Will throw * an UnknownHostException if the hostname cannot be resolved. */ - public static native byte[][] getHostByName(String hostname) + static native byte[][] getHostByName(String hostname) throws UnknownHostException; /** @@ -93,5 +94,5 @@ class VMInetAddress implements Serializable * * @return The IP address as a byte array */ - public static native byte[] aton(String address); + static native byte[] aton(String address); } diff --git a/vm/reference/java/net/VMURLConnection.java b/vm/reference/java/net/VMURLConnection.java index 19bf5814e..ae04bdb6a 100644 --- a/vm/reference/java/net/VMURLConnection.java +++ b/vm/reference/java/net/VMURLConnection.java @@ -1,5 +1,5 @@ /* VMURLConnection - VM code for URLConnection - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,7 +45,8 @@ import java.io.InputStream; final class VMURLConnection { - public static final int LENGTH = 1024; + + static final int LENGTH = 1024; static { @@ -54,6 +55,8 @@ final class VMURLConnection init(); } + private VMURLConnection() {} // Prohibits instantiation. + private static native void init(); private static native String guessContentTypeFromBuffer(byte[] b, int valid); diff --git a/vm/reference/java/nio/VMDirectByteBuffer.java b/vm/reference/java/nio/VMDirectByteBuffer.java index 93a83883a..41d44d8eb 100644 --- a/vm/reference/java/nio/VMDirectByteBuffer.java +++ b/vm/reference/java/nio/VMDirectByteBuffer.java @@ -1,5 +1,5 @@ /* VMDirectByteBuffer.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -43,6 +43,7 @@ import gnu.classpath.Pointer; final class VMDirectByteBuffer { + static { // load the shared library needed for native methods. @@ -52,12 +53,24 @@ final class VMDirectByteBuffer } } - static native Pointer allocate (int capacity); + private VMDirectByteBuffer() {} // Prohibits instantiation. + + static native Pointer allocate(int capacity); + static native void free(Pointer address); + static native byte get(Pointer address, int index); - static native void get(Pointer address, int index, byte[] dst, int offset, int length); + + static native void get(Pointer address, int index, byte[] dst, int offset, + int length); + static native void put(Pointer address, int index, byte value); - static native void put(Pointer address, int index, byte[] src, int offset, int length); + + static native void put(Pointer address, int index, byte[] src, int offset, + int length); + static native Pointer adjustAddress(Pointer address, int offset); - static native void shiftDown(Pointer address, int dst_offset, int src_offset, int count); + + static native void shiftDown(Pointer address, int dst_offset, + int src_offset, int count); } diff --git a/vm/reference/java/security/VMSecureRandom.java b/vm/reference/java/security/VMSecureRandom.java index bea154977..0a4384557 100644 --- a/vm/reference/java/security/VMSecureRandom.java +++ b/vm/reference/java/security/VMSecureRandom.java @@ -1,5 +1,5 @@ /* VMSecureRandom.java -- random seed generator. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -55,6 +55,8 @@ package java.security; final class VMSecureRandom { + private VMSecureRandom() {} // Prohibits instantiation. + /** * Generate a random seed. Implementations are free to generate * fewer random bytes than are requested, and leave the remaining @@ -104,7 +106,8 @@ final class VMSecureRandom return length; } - static class Spinner implements Runnable + static class Spinner + implements Runnable { volatile byte value; volatile boolean running; @@ -121,7 +124,7 @@ final class VMSecureRandom value++; } - private void stop() + void stop() { running = false; } diff --git a/vm/reference/java/util/VMTimeZone.java b/vm/reference/java/util/VMTimeZone.java index 11061aa32..5724180d7 100644 --- a/vm/reference/java/util/VMTimeZone.java +++ b/vm/reference/java/util/VMTimeZone.java @@ -1,5 +1,5 @@ /* java.util.VMTimeZone - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ import java.io.*; */ final class VMTimeZone { + static { if (Configuration.INIT_LOAD_LIBRARY) @@ -59,6 +60,8 @@ final class VMTimeZone } } + private VMTimeZone() {} // Prohibits instantiation. + /** * This method returns a time zone id string which is in the form * (standard zone name) or (standard zone name)(GMT offset) or diff --git a/vm/reference/sun/misc/Unsafe.java b/vm/reference/sun/misc/Unsafe.java index e316bdb8d..6fad6e4e3 100644 --- a/vm/reference/sun/misc/Unsafe.java +++ b/vm/reference/sun/misc/Unsafe.java @@ -1,5 +1,5 @@ /* Unsafe.java - Unsafe operations needed for concurrency - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -48,10 +48,10 @@ import java.lang.reflect.Field; * @author Tom Tromey (tromey@redhat.com) * @author Andrew John Hughes (gnu_andrew@member.fsf.org) */ -public class Unsafe +public final class Unsafe { // Singleton class. - private static Unsafe unsafe = new Unsafe(); + private static final Unsafe unsafe = new Unsafe(); /** * Private default constructor to prevent creation of an arbitrary |