Some questions about this...

Kyle Galloway wrote:

+  /**
+   * Constructs a new <code>ClassUnloadEvent</code>
+ * + * @param clazz class which was prepared
+   */
+  public ClassUnloadEvent(Class clazz)
+  {
+    super(JdwpConstants.EventKind.CLASS_UNLOAD);
+    _class = clazz;
+  }

Do you intend for this event to be generated just before the class is unloaded or just after? If after, the class's Class object will be gone, and this constructor cannot be used. If the constructor is going to take a Class argument, it should be documented that you expect this notification to happen just before the type is unloaded. [more on this later]

+  /**
+   * Writes the event to the given stream
+ * + * @param outStream the output stream to write the event to
+   */
+ protected void _writeData(DataOutputStream outStream) + throws IOException
+  {
+    VMIdManager idm = VMIdManager.getDefault();
+    ReferenceTypeId rid = idm.getReferenceTypeId(_class);
+
+    rid.writeTagged(outStream);
+    JdwpString.writeString(outStream, Signature.computeClassSignature(_class));
+  }
+
+}

I don't think we output the reference type id -- just the type's signature.

Back to the notification before/after the "unload" issue: I think we're probably safest just getting the type signature (as a String) from the VM instead of the Class object. That way, it won't matter whether the class has actually been unloaded or whether it is about to be.

Keith

Reply via email to