8076154: com/sun/jdi/InstanceFilter.java failing due to missing MethodEntryRequest calls
authorfarvidsson
Mon, 30 Mar 2015 10:10:19 +0200
changeset 30333 e8999e87feae
parent 30332 cdecfa325d0c
child 30334 22a5f09f4da9
8076154: com/sun/jdi/InstanceFilter.java failing due to missing MethodEntryRequest calls Summary: Some jdi tests are failing due to missing MethodEntryRequest events during the test execution. Reviewed-by: sla, jbachorik
jdk/test/com/sun/jdi/InstanceFilter.java
--- a/jdk/test/com/sun/jdi/InstanceFilter.java	Sun Mar 29 09:21:15 2015 -0400
+++ b/jdk/test/com/sun/jdi/InstanceFilter.java	Mon Mar 30 10:10:19 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,10 @@
             return;
         }
         if (theThis == null) {
-            // This happens when the thread has exited.
+            // This happens when the thread has exited or when a
+            // static method is called. Setting an instance
+            // filter does not prevent this event from being
+            // emitted with a this that is null.
             methodEntryRequest.disable();
             return;
         }
@@ -138,6 +141,10 @@
         EventRequestManager mgr = vm().eventRequestManager();
         methodEntryRequest = mgr.createMethodEntryRequest();
         methodEntryRequest.addInstanceFilter(theInstance);
+        // Thread filter is needed to prevent MethodEntry events
+        // to be emitted by the debugee when a static method
+        // is called on any thread.
+        methodEntryRequest.addThreadFilter(bpe.thread());
         methodEntryRequest.enable();
 
         listenUntilVMDisconnect();