Hello,

Another pretty simple one. VirtualMachineCommandSet.executeIDsizes was really jumping through hoops because JdwpID.size was abstract. Fooey. This patch makes size() a static method and includes all the necessary changes in other files.

Keith
2006-02-16  Keith Seitz  <[EMAIL PROTECTED]>

        * gnu/classpath/jdwp/id/JdwpId.java (size): Make static. Return
        default size of eight bytes.
        * gnu/classpath/jdwp/id/ObjectId.java (size): Remove.
        * gnu/classpath/jdwp/id/ReferenceTypeId.java (size): Remove.
        * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
        (executeIDsizes): Use new static methods.
        * vm/reference/gnu/classpath/jdwp/VMFrame.java (size): New static
        method.
Index: gnu/classpath/jdwp/id/JdwpId.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/id/JdwpId.java,v
retrieving revision 1.3
diff -u -p -r1.3 JdwpId.java
--- gnu/classpath/jdwp/id/JdwpId.java	20 Aug 2005 19:10:20 -0000	1.3
+++ gnu/classpath/jdwp/id/JdwpId.java	16 Feb 2006 21:56:11 -0000
@@ -1,5 +1,5 @@
 /* JdwpId.java -- base class for all object ID types
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -122,9 +122,13 @@ public abstract class JdwpId
   }
 
   /**
-   * Returns size of this type (used by IDSizes)
+   * Returns size of this type (used by IDSizes). Default sizes
+   * for all IDs are 8 bytes (long).
    */
-  public abstract int size ();
+  public static int size ()
+  {
+    return 8;
+  }
 
   /**
    * Writes the contents of this type to the <code>DataOutputStream</code>
Index: gnu/classpath/jdwp/id/ObjectId.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/id/ObjectId.java,v
retrieving revision 1.3
diff -u -p -r1.3 ObjectId.java
--- gnu/classpath/jdwp/id/ObjectId.java	20 Aug 2005 19:10:20 -0000	1.3
+++ gnu/classpath/jdwp/id/ObjectId.java	16 Feb 2006 21:56:11 -0000
@@ -1,5 +1,5 @@
 /* ObjectId.java -- object IDs
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -83,14 +83,6 @@ public class ObjectId
   }
 
   /**
-   * Returns the size of this id type
-   */
-  public int size ()
-  {
-    return 8;
-  }
-
-  /**
    * Returns the object referred to by this ID
    *
    * @returns the object
Index: gnu/classpath/jdwp/id/ReferenceTypeId.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java,v
retrieving revision 1.3
diff -u -p -r1.3 ReferenceTypeId.java
--- gnu/classpath/jdwp/id/ReferenceTypeId.java	20 Aug 2005 19:10:20 -0000	1.3
+++ gnu/classpath/jdwp/id/ReferenceTypeId.java	16 Feb 2006 21:56:11 -0000
@@ -1,5 +1,5 @@
 /* ReferenceTypeId.java -- a base class for all reference type IDs
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -62,14 +62,6 @@ public class ReferenceTypeId
   }
 
   /**
-   * Returns the size of this ID type
-   */
-  public int size ()
-  {
-    return 8;
-  }
-
-  /**
    * Gets the class associated with this ID
    *
    * @returns the class
Index: gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java,v
retrieving revision 1.6
diff -u -p -r1.6 VirtualMachineCommandSet.java
--- gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java	8 Sep 2005 18:00:26 -0000	1.6
+++ gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java	16 Feb 2006 21:56:11 -0000
@@ -1,6 +1,6 @@
 /* VirtualMachineCommandSet.java -- class to implement the VirtualMachine
    Command Set
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
  
 This file is part of GNU Classpath.
 
@@ -40,6 +40,9 @@ exception statement from your version. *
 package gnu.classpath.jdwp.processor;
 
 import gnu.classpath.jdwp.JdwpConstants;
+//import gnu.classpath.jdwp.VMField;
+import gnu.classpath.jdwp.VMFrame;
+//import gnu.classpath.jdwp.VMMethod;
 import gnu.classpath.jdwp.VMVirtualMachine;
 import gnu.classpath.jdwp.exception.JdwpException;
 import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
@@ -298,12 +301,11 @@ public class VirtualMachineCommandSet
   private void executeIDsizes(ByteBuffer bb, DataOutputStream os)
     throws JdwpException, IOException
   {
-    ObjectId oid = new ObjectId();
-    os.writeInt(oid.size()); // fieldId
-    os.writeInt(oid.size()); // methodId
-    os.writeInt(oid.size()); // objectId
-    os.writeInt(new ReferenceTypeId((byte) 0x00).size()); // referenceTypeId
-    os.writeInt(oid.size()); // frameId
+    os.writeInt(ObjectId.size ()); // fieldId FIXME
+    os.writeInt(ObjectId.size ()); // methodId FIXME
+    os.writeInt(ObjectId.size ()); // objectId
+    os.writeInt(ReferenceTypeId.size ()); // referenceTypeId
+    os.writeInt(VMFrame.size ()); // frameId
   }
 
   private void executeSuspend(ByteBuffer bb, DataOutputStream os)
Index: vm/reference/gnu/classpath/jdwp/VMFrame.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMFrame.java,v
retrieving revision 1.3
diff -u -p -r1.3 VMFrame.java
--- vm/reference/gnu/classpath/jdwp/VMFrame.java	25 Aug 2005 00:47:49 -0000	1.3
+++ vm/reference/gnu/classpath/jdwp/VMFrame.java	16 Feb 2006 21:56:11 -0000
@@ -1,5 +1,5 @@
 /* VMFrame.java -- Reference implementation of VM hooks for JDWP Frame access.
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -49,6 +49,14 @@ import gnu.classpath.jdwp.util.Location;
 
 public class VMFrame
 {
+  /**
+   * Returns the size of a frame ID over JDWP
+   */
+  public static int size ()
+  {
+    return 8;
+  }
+
   // The object this frame resides in
   private Object obj;
   

Reply via email to