< prev index next >
test/com/sun/jdi/InstanceFilter.java
Print this page
rev 11659 : 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: duke
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -102,11 +102,14 @@
} catch (IncompatibleThreadStateException ee) {
failure("FAILED: Exception occured in methodEntered: " + ee);
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;
}
if (!theThis.equals(theInstance)) {
@@ -136,10 +139,14 @@
theInstance = (ObjectReference)(targetClass.getValue(field));
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();
if (!testFailed && methodCount < expectedMethods.length) {
< prev index next >