commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r790843 - in /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime: ByReferencePointer32.java ByReferencePointer64.java DirectBuffer32.java DirectBuffer64.java Memory.java NativePointer.java Pointer32.java Pointer64.java
Date Fri, 03 Jul 2009 10:08:44 GMT
Author: mturk
Date: Fri Jul  3 10:08:44 2009
New Revision: 790843

URL: http://svn.apache.org/viewvc?rev=790843&view=rev
Log:
Tighten the scopes

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer32.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer64.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NativePointer.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer32.java?rev=790843&r1=790842&r2=790843&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer32.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer32.java
Fri Jul  3 10:08:44 2009
@@ -25,11 +25,12 @@
  * @since Runtime 1.0
  */
 @ByReference
-class ByReferencePointer32 extends Pointer32 implements ByReferencePointer
+final class ByReferencePointer32 extends Pointer32 implements ByReferencePointer
 {
 
-    protected ByReferencePointer32()
+    private ByReferencePointer32()
     {
+        // No instance
     }
 
     /*

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer64.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer64.java?rev=790843&r1=790842&r2=790843&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer64.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ByReferencePointer64.java
Fri Jul  3 10:08:44 2009
@@ -25,11 +25,12 @@
  * @since Runtime 1.0
  */
 @ByReference
-class ByReferencePointer64 extends Pointer64 implements ByReferencePointer
+final class ByReferencePointer64 extends Pointer64 implements ByReferencePointer
 {
 
     protected ByReferencePointer64()
     {
+        // No instance
     }
 
     /*

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java?rev=790843&r1=790842&r2=790843&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java
Fri Jul  3 10:08:44 2009
@@ -24,10 +24,12 @@
  * </p>
  * @since Runtime 1.0
  */
-class DirectBuffer32 extends Pointer32 implements DirectBuffer {
+final class DirectBuffer32 extends Pointer32 implements DirectBuffer
+{
 
-    protected DirectBuffer32()
+    private DirectBuffer32()
     {
+        // No instance
     }
 
     /*

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java?rev=790843&r1=790842&r2=790843&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java
Fri Jul  3 10:08:44 2009
@@ -24,10 +24,12 @@
  * </p>
  * @since Runtime 1.0
  */
-class DirectBuffer64 extends Pointer64 implements DirectBuffer {
+final class DirectBuffer64 extends Pointer64 implements DirectBuffer
+{
 
-    protected DirectBuffer64()
+    private DirectBuffer64()
     {
+        // No instance
     }
 
     /*

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java?rev=790843&r1=790842&r2=790843&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java Fri
Jul  3 10:08:44 2009
@@ -71,7 +71,6 @@
     }
 
     private static native Pointer nullp0();
-
     /**
      * Create a new {@code null Pointer}.
      *

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NativePointer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NativePointer.java?rev=790843&r1=790842&r2=790843&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NativePointer.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NativePointer.java
Fri Jul  3 10:08:44 2009
@@ -26,20 +26,24 @@
 {
 
     /**
-     * Create new {@code null} {@link Pointer} instance.
+     * Create new {@code null} Pointer instance.
      * <p>
      * Depending on the platform the created {@code Pointer}
      * object is either {@code Pointer32} for 32-bit machines
      * or {@code 64-bit} for 64-bit machines.
      * </p>
-     *
+     * <p>
+     * This method is convinience for {@link Memory#malloc() Memory.malloc()}
+     * method.
+     * </p>
+     * @return new {@code null} Pointer.
+     * @throws OutOfMemoryError if memory cannot be allocated.
+     * @see Memory#malloc()
      */
     public static final Pointer createInstance()
+    	throws OutOfMemoryError
     {
-        if (Platform.SIZEOF_POINTER == 8)
-            return new Pointer32();
-        else
-            return new Pointer64();
+        return Memory.malloc();
     }
 
     /*
@@ -102,7 +106,7 @@
     public abstract boolean isNull();
 
     /**
-     * Check if the pointer is to be used by reference
+     * Check if the pointer is to be used by reference.
      * @return true if the pointer has {@code ByReference} annotation.
      * @see ByReference
      */

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java?rev=790843&r1=790842&r2=790843&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
Fri Jul  3 10:08:44 2009
@@ -33,9 +33,6 @@
 
     protected Pointer32()
     {
-        POINTER = 0;
-        CLEANUP = 0;
-        PLENGTH = 0;
     }
 
     /*

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java?rev=790843&r1=790842&r2=790843&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java
Fri Jul  3 10:08:44 2009
@@ -32,10 +32,8 @@
 
     protected Pointer64()
     {
-        POINTER = 0L;
-        CLEANUP = 0L;
-        PLENGTH = 0L;
     }
+
     /*
      * Only created from JNI code.
      */



Mime
View raw message