1 /*
2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 
25 /*
26  * @test
27  *
28  * @summary converted from VM Testbase nsk/jdi/Event/hashCode/hashcode001.
29  * VM Testbase keywords: [quick, jpda, jdi]
30  * VM Testbase readme:
31  * DESCRIPTION:
32  *  The test for public hashCode() method of an implementing class of
33  *  com.sun.jdi.event.Event interface.
34  *  The test checks an assertion cited from spec for hashCode() method of
35  *  java.lang.Object class:
36  *  The general contract of hashCode is:
37  *    - Whenever it is invoked on the same object more than once during
38  *      an execution of a Java application, the hashCode method must
39  *      consistently return the same integer, provided no information used
40  *      in equals comparisons on the object is modified.
41  *      ...
42  * COMMENTS:
43  *  The test is aimed to increase jdi source code coverage and checks
44  *  the code which was not yet covered by previous tests for Event
45  *  interface. The coverage analysis was done for jdk1.4.0-b92 build.
46  *     Test updated to prevent possible VMDisconnectedException on VMDeathEvent:
47  *     - resume for these events is skipped in event handling loop
48  *     - method Debugee.endDebugee() is used instead of Debugee.waitFor()
49  *     Test fixed according to test bug:
50  *     4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation
51  *     - using standard Debugee.setBreakpoint() method
52  *     - adjusting source line numbers used for setting breakpoint
53  *     Test fixed according to test bug:
54  *     4783196 TEST_BUG: hashcode001 incorrectly handles VMDisconnectEvent
55  *     - eliminating printing VMDeathEvent and VMDisconnectEvent
56  *     - ignoring VMDisconnectedException if thrown for these events
57  *       while testinging hashcode() method
58  *     Test fixed according to test bug:
59  *     4854711 TEST_BUG: race condition in threads synchronization
60  *
61  * @library /vmTestbase
62  *          /test/lib
63  * @run driver jdk.test.lib.FileInstaller . .
64  * @build nsk.jdi.Event.hashCode.hashcode001
65  *        nsk.jdi.Event.hashCode.hashcode001a
66  * @run main/othervm PropertyResolvingWrapper
67  *      nsk.jdi.Event.hashCode.hashcode001
68  *      -verbose
69  *      -arch=${os.family}-${os.simpleArch}
70  *      -waittime=5
71  *      -debugee.vmkind=java
72  *      -transport.address=dynamic
73  *      "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
74  */
75 
76