This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Implement LocationOnlyFilter.matches


Hi,

This is a patch that I have already committed to Classpath. It implements LocationOnlyFilter.matches, which despite earlier thoughts, does need to be properly implemented.

Ok?

Keith

classpath/ChangeLog
2007-04-27  Keith Seitz  <keiths@redhat.com>

        * gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java
        (matches): Use Location.equals to determine equality.
        * gnu/classpath/jdwp/VMMethod.java (equals):
        New method.
        * gnu/classpath/jdwp/util/Location.java (equals):
        New method.

ChangeLog
2007-04-27  Keith Seitz  <keiths@redhat.com>

        * classpath/lib/gnu/classpath/jdwp/event/filters/
        LocationOnlyFilter.class: Regenerated;
        * classpath/lib/gnu/classpath/jdwp/util/Location.class:
        Regenerated.
        * gnu/classpath/jdwp/VMMethod.java
        * classpath/lib/gnu/classpath/jdwp/VMMethod.class:
        Regenerated.
        * gnu/classpath/jdwp/VMMethod.h: Regenerated.
        * gnu/classpath/jdwp/util/Location.h: Regenerated.
Index: classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java
===================================================================
--- classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java	(revision 124158)
+++ classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java	(working copy)
@@ -1,5 +1,5 @@
 /* LocationOnlyFilter.java -- filter on location
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -49,13 +49,6 @@
  * May be used with breakpoint, field access, field modification, step,
  * and exception event kinds.
  *
- * This "filter" is not really a filter. It is simply a way to communicate
- * location information for supported events in a generic way to ease 
- * the burden of special casing several things in
- * EventReqeustCommandSet.executeSet.
- * 
- * Consequently, this "filter" always matches any event.
- * 
  * @author Keith Seitz  (keiths@redhat.com)
  */
 public class LocationOnlyFilter
@@ -90,9 +83,12 @@
    *
    * @param event  the <code>Event</code> to scrutinize
    */
-  public boolean matches (Event event)
+  public boolean matches(Event event)
   {
-    // This filter always matches. See comments in class javadoc.
-    return true;
+    Location loc = (Location) event.getParameter(Event.EVENT_LOCATION);
+    if (loc != null)
+      return (getLocation().equals(loc));
+
+    return false;
   }
 }
Index: gnu/classpath/jdwp/VMMethod.java
===================================================================
--- gnu/classpath/jdwp/VMMethod.java	(revision 124158)
+++ gnu/classpath/jdwp/VMMethod.java	(working copy)
@@ -1,5 +1,5 @@
 /* VMMethod.java -- a method in a virtual machine
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -175,4 +175,15 @@
   {
     return VMVirtualMachine.getClassMethod(klass, bb.getLong());
   }
+
+  public boolean equals(Object obj)
+  {
+    if (obj instanceof VMMethod)
+      {
+	VMMethod m = (VMMethod) obj;
+	return (getId() == m.getId());
+      }
+
+    return false;
+  }
 }
Index: classpath/gnu/classpath/jdwp/util/Location.java
===================================================================
--- classpath/gnu/classpath/jdwp/util/Location.java	(revision 124158)
+++ classpath/gnu/classpath/jdwp/util/Location.java	(working copy)
@@ -1,5 +1,5 @@
 /* Location.java -- class to read/write JDWP locations
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -153,4 +153,16 @@
   {
     return method.toString () + "." + index;
   }
+
+  public boolean equals(Object obj)
+  {
+    if (obj instanceof Location)
+      {
+	Location l = (Location) obj;
+	return (getMethod().equals(l.getMethod())
+		&& getIndex() == l.getIndex());
+      }
+
+    return false;
+  }
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]