From eecde5f24ceb60ba3f303bc8d12955808c4f8a21 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Mon, 30 Mar 2015 10:10:19 +0200 Subject: [PATCH] 8076154: com/sun/jdi/InstanceFilter.java failing due to missing MethodEntryRequest calls 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 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jdk/test/com/sun/jdi/InstanceFilter.java b/jdk/test/com/sun/jdi/InstanceFilter.java index a8d7da33ab9..0c9dc322cf5 100644 --- a/jdk/test/com/sun/jdi/InstanceFilter.java +++ b/jdk/test/com/sun/jdi/InstanceFilter.java @@ -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 @@ public class InstanceFilter extends TestScaffold { 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 @@ public class InstanceFilter extends TestScaffold { 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();