Hi Keith,

On Fri, 2005-09-02 at 17:18 -0700, Keith Seitz wrote:
> While these are the last of the outstanding files, rest assured that 
> both Jdwp.java and VMVirtualMachine.java are exceptionally likely to 
> change (perhaps quite dramatically) in the coming weeks, as I begin 
> checking in a gcj-specific implementation to utilize all this code.
> 
> With this, classpath should now also build with jdwp code. At the 
> maintainer's discretion, vm/reference/standard.omit and 
> lib/standard.omit may both be changed to permit the inclusion of this code.

Great, thanks a lot.
One reason to enable the code is so people will use alternative
compilers which might pick up errors/warnings that the (ehe, liberal)
gcj might miss. jikes shocked on two errors in the code for which my
proposed fixes are as follows:

2005-09-04  Mark Wielaard  <[EMAIL PROTECTED]>

  * gnu/classpath/jdwp/event/filters/ClassMatchFilter.java
  (matches): Remove InvalidClassException since it is never thrown.
  * vm/reference/gnu/classpath/jdwp/VMIdManager.java
  (newReferenceTypeId): Only return null when SoftReference is cleared,
  don't catch InstantiationException or IllegalAccessException since
  they are never thrown.

(Both cvs diff -w and normal cvs diff -u output attached)
What do you think?

That makes everything compile with jikes for me.

That said I think I keep it disabled for the snapshot release (0.18)
that I hope we will push out tomorrow (Monday). (You will be in good
company with the qt4 peers and new stax implementation.) And add a note
to the NEWS file that these technologies are not out-of-the-box ready,
but that people who are really interested should try them out and join
the mailinglist to follow the progress in CVS. As soon as we have
released 0.18 I want to enable the compilation of this code in CVS so
everybody can share and enjoy in the bug fixing.

Cheers,

Mark
Index: gnu/classpath/jdwp/event/filters/ClassMatchFilter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java,v
retrieving revision 1.1
diff -u -w -r1.1 ClassMatchFilter.java
--- gnu/classpath/jdwp/event/filters/ClassMatchFilter.java	26 Aug 2005 21:52:28 -0000	1.1
+++ gnu/classpath/jdwp/event/filters/ClassMatchFilter.java	4 Sep 2005 18:40:44 -0000
@@ -95,8 +95,6 @@
     Object type = event.getParameter (ReferenceTypeId.class);
     if (type != null)
       {
-	try
-	  {
 	    Class eventClass = (Class) type;
 	    String name = eventClass.getName ();
 
@@ -109,12 +107,6 @@
 	      }
 	    else
 	      return name.matches (_pattern);
-	  }
-	catch (InvalidClassException ice)
-	  {
-	    // the class is no longer valid
-	    return false;
-	  }
       }
 
     return false;
Index: vm/reference/gnu/classpath/jdwp/VMIdManager.java
===================================================================
RCS file: /cvsroot/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java,v
retrieving revision 1.2
diff -u -w -r1.2 VMIdManager.java
--- vm/reference/gnu/classpath/jdwp/VMIdManager.java	25 Aug 2005 00:47:49 -0000	1.2
+++ vm/reference/gnu/classpath/jdwp/VMIdManager.java	4 Sep 2005 18:40:44 -0000
@@ -170,15 +170,16 @@
      * Returns a new reference type id for the given class
      *
      * @param clazz  the <code>Class</code> for which an id is desired
-     * @returns a suitable reference type id or <code>null</code>
+     * @returns a suitable reference type id or null when the
+     * reference is cleared.
      */
     public static ReferenceTypeId newReferenceTypeId (SoftReference ref)
     {
-      ReferenceTypeId id = null;
+      ReferenceTypeId id;
       Class clazz = (Class) ref.get ();
+      if (clazz == null)
+	return null;
 
-      try
-	{
 	  if (clazz.isArray ())
 	    id = new ArrayReferenceTypeId ();
 	  else if (clazz.isInterface ())
@@ -190,15 +191,6 @@
 	      id.setId (++_lastRid);
 	    }
 	  return id;
-	}
-      catch (InstantiationException ie)
-	{
-	  return null;
-	}
-      catch (IllegalAccessException iae)
-	{
-	  return null;
-	}
     }
   }
 
Index: gnu/classpath/jdwp/event/filters/ClassMatchFilter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java,v
retrieving revision 1.1
diff -u -r1.1 ClassMatchFilter.java
--- gnu/classpath/jdwp/event/filters/ClassMatchFilter.java	26 Aug 2005 21:52:28 -0000	1.1
+++ gnu/classpath/jdwp/event/filters/ClassMatchFilter.java	4 Sep 2005 18:40:56 -0000
@@ -95,26 +95,18 @@
     Object type = event.getParameter (ReferenceTypeId.class);
     if (type != null)
       {
-	try
+	Class eventClass = (Class) type;
+	String name = eventClass.getName ();
+	
+	if (_pattern.startsWith ("*"))
+	  return name.endsWith (_pattern.substring (1));
+	else if (_pattern.endsWith ("*"))
 	  {
-	    Class eventClass = (Class) type;
-	    String name = eventClass.getName ();
-
-	    if (_pattern.startsWith ("*"))
-	      return name.endsWith (_pattern.substring (1));
-	    else if (_pattern.endsWith ("*"))
-	      {
-		int end = _pattern.length () - 1;
-		return name.startsWith (_pattern.substring (0, end));
-	      }
-	    else
-	      return name.matches (_pattern);
-	  }
-	catch (InvalidClassException ice)
-	  {
-	    // the class is no longer valid
-	    return false;
+	    int end = _pattern.length () - 1;
+	    return name.startsWith (_pattern.substring (0, end));
 	  }
+	else
+	  return name.matches (_pattern);
       }
 
     return false;
Index: vm/reference/gnu/classpath/jdwp/VMIdManager.java
===================================================================
RCS file: /cvsroot/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java,v
retrieving revision 1.2
diff -u -r1.2 VMIdManager.java
--- vm/reference/gnu/classpath/jdwp/VMIdManager.java	25 Aug 2005 00:47:49 -0000	1.2
+++ vm/reference/gnu/classpath/jdwp/VMIdManager.java	4 Sep 2005 18:40:56 -0000
@@ -170,35 +170,27 @@
      * Returns a new reference type id for the given class
      *
      * @param clazz  the <code>Class</code> for which an id is desired
-     * @returns a suitable reference type id or <code>null</code>
+     * @returns a suitable reference type id or null when the
+     * reference is cleared.
      */
     public static ReferenceTypeId newReferenceTypeId (SoftReference ref)
     {
-      ReferenceTypeId id = null;
+      ReferenceTypeId id;
       Class clazz = (Class) ref.get ();
+      if (clazz == null)
+	return null;
 
-      try
+      if (clazz.isArray ())
+	id = new ArrayReferenceTypeId ();
+      else if (clazz.isInterface ())
+	id = new InterfaceReferenceTypeId ();
+      else
+	id = new ClassReferenceTypeId ();
+      synchronized (_ridLock)
 	{
-	  if (clazz.isArray ())
-	    id = new ArrayReferenceTypeId ();
-	  else if (clazz.isInterface ())
-	    id = new InterfaceReferenceTypeId ();
-	  else
-	    id = new ClassReferenceTypeId ();
-	  synchronized (_ridLock)
-	    {
-	      id.setId (++_lastRid);
-	    }
-	  return id;
-	}
-      catch (InstantiationException ie)
-	{
-	  return null;
-	}
-      catch (IllegalAccessException iae)
-	{
-	  return null;
+	  id.setId (++_lastRid);
 	}
+      return id;
     }
   }
 

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to