InheritAgent1011.java revision 2362
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * This code is free software; you can redistribute it and/or modify it
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * under the terms of the GNU General Public License version 2 only, as
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * published by the Free Software Foundation.
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * This code is distributed in the hope that it will be useful, but WITHOUT
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * version 2 for more details (a copy is included in the LICENSE file that
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * accompanied this code).
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * You should have received a copy of the GNU General Public License version
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * 2 along with this work; if not, write to the Free Software Foundation,
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * or visit www.oracle.com if you need additional information or have any
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * @bug 6289149
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * @summary test config (1,0,1,1): inherited 2-arg, declared 2-arg and declared 1-arg in agent class
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * @author Daniel D. Daugherty, Sun Microsystems
656361374a9c4c7614c61b28c86f087773dc35dcGustavo Lopes * @run shell ../MakeJAR3.sh InheritAgent1011
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil * @run main/othervm -javaagent:InheritAgent1011.jar DummyMain
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladilclass InheritAgent1011 extends InheritAgent1011Super {
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil // This agent has a single argument premain() method which
656361374a9c4c7614c61b28c86f087773dc35dcGustavo Lopes // is NOT the one that should be called.
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil public static void premain (String agentArgs) {
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil System.out.println("Hello from Single-Arg InheritAgent1011!");
5c22aad0392c68f935e17cd0a1b14bd855a8080bMiroslav Osladil throw new Error("ERROR: THIS AGENT SHOULD NOT HAVE BEEN CALLED.");
656361374a9c4c7614c61b28c86f087773dc35dcGustavo Lopes // This agent has a double argument premain() method which
656361374a9c4c7614c61b28c86f087773dc35dcGustavo Lopes // is the one that should be called.
a96cbe15da1b5e0a83e9ad03ac103734fc6ef64dGustavo Lopes public static void premain (String agentArgs, Instrumentation instArg) {
a96cbe15da1b5e0a83e9ad03ac103734fc6ef64dGustavo Lopes System.out.println("Hello from Double-Arg InheritAgent1011!");
a96cbe15da1b5e0a83e9ad03ac103734fc6ef64dGustavo Lopes // This agent does NOT have a single argument premain() method.
a96cbe15da1b5e0a83e9ad03ac103734fc6ef64dGustavo Lopes // This agent has a double argument premain() method which
a96cbe15da1b5e0a83e9ad03ac103734fc6ef64dGustavo Lopes // is NOT the one that should be called.
a96cbe15da1b5e0a83e9ad03ac103734fc6ef64dGustavo Lopes public static void premain (String agentArgs, Instrumentation instArg) {
a96cbe15da1b5e0a83e9ad03ac103734fc6ef64dGustavo Lopes System.out.println("Hello from Double-Arg InheritAgent1011Super!");
a96cbe15da1b5e0a83e9ad03ac103734fc6ef64dGustavo Lopes throw new Error("ERROR: THIS AGENT SHOULD NOT HAVE BEEN CALLED.");