8007420: add test for 6805864 to com/sun/jdi, add test for 7182152 to java/lang/instrument
authordcubed
Mon, 11 Feb 2013 10:07:01 -0800
changeset 15654 aa1e472aa6b9
parent 15653 ce470531e852
child 15655 d9ab4d9ee4f2
8007420: add test for 6805864 to com/sun/jdi, add test for 7182152 to java/lang/instrument Reviewed-by: coleenp, sspitsyn
jdk/test/com/sun/jdi/RedefineAbstractClass.sh
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesAgent.java
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesApp.java
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesImpl.java
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesImpl_1.java
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesIntf1.java
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesIntf2.java
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesRemote.java
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesTarget.java
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesTarget_1.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/RedefineAbstractClass.sh	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,153 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2009, 2013, 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.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 6805864
+# @summary Redefine an abstract class that is called via a concrete
+#   class and via two interface objects and verify that the right
+#   methods are called.
+# @author Daniel D. Daugherty
+#
+# @run shell RedefineAbstractClass.sh
+
+compileOptions=-g
+
+# Uncomment this to see the JDI trace
+#jdbOptions=-dbgtrace
+
+createJavaFile()
+{
+    cat <<EOF > $1.java.1
+
+public class $1 {
+  public static void main(String[] args) {
+    System.out.println("This is RedefineAbstractClass");
+
+    MyConcreteClass foo = new MyConcreteClass();
+    // do the work once before redefine
+    foo.doWork();
+
+    System.out.println("stop here for redefine");  // @1 breakpoint
+
+    // do the work again after redefine
+    foo.doWork();
+
+    System.out.println("stop here to check results");  // @2 breakpoint
+  }
+}
+
+interface MyInterface1 {
+  public boolean checkFunc();
+  public boolean isMyInterface1();
+}
+
+interface MyInterface2 {
+  public boolean checkFunc();
+  public boolean isMyInterface2();
+}
+
+abstract class MyAbstractClass implements MyInterface1, MyInterface2 {
+  static int counter = 0;
+  public boolean checkFunc() {
+    counter++;
+    System.out.println("MyAbstractClass.checkFunc() called.");
+    // @1 uncomment System.out.println("This is call " + counter + " to checkFunc");
+    return true;
+  }
+  public boolean isMyInterface1() {
+    System.out.println("MyAbstractClass.isMyInterface1() called.");
+    return true;
+  }
+  public boolean isMyInterface2() {
+    System.out.println("MyAbstractClass.isMyInterface2() called.");
+    return true;
+  }
+}
+
+class MyConcreteClass extends MyAbstractClass {
+  public void doWork() {
+    // checkFunc() is called via invokevirtual here; MyConcreteClass
+    // inherits via MyAbstractClass
+    System.out.println("In doWork() calling checkFunc(): " + checkFunc());
+
+    MyInterface1 if1 = (MyInterface1) this;
+    // checkFunc() is called via invokeinterface here; this call will
+    // use the first itable entry
+    System.out.println("In doWork() calling if1.checkFunc(): " + if1.checkFunc());
+
+    MyInterface2 if2 = (MyInterface2) this;
+    // checkFunc() is called via invokeinterface here; this call will
+    // use the second itable entry
+    System.out.println("In doWork() calling if2.checkFunc(): " + if2.checkFunc());
+  }
+}
+
+EOF
+}
+
+# This is called to feed cmds to jdb.
+dojdbCmds()
+{
+    setBkpts @1
+    setBkpts @2
+    runToBkpt @1
+    # modified version of redefineClass function
+    vers=2
+    abs_class=MyAbstractClass
+    cmd redefine $pkgDot$abs_class $tmpFileDir/vers$vers/$abs_class.class
+    cp $tmpFileDir/$classname.java.$vers \
+        $tmpFileDir/$classname.java
+    # end modified version of redefineClass function
+
+    # this will continue to the second breakpoint
+    cmd cont
+}
+
+
+mysetup()
+{
+    if [ -z "$TESTSRC" ] ; then
+        TESTSRC=.
+    fi
+
+    for ii in . $TESTSRC $TESTSRC/.. ; do
+        if [ -r "$ii/ShellScaffold.sh" ] ; then
+            . $ii/ShellScaffold.sh 
+            break
+        fi
+    done
+}
+
+# You could replace this next line with the contents
+# of ShellScaffold.sh and this script will run just the same.
+mysetup
+
+runit
+
+debuggeeFailIfNotPresent 'This is call 4 to checkFunc'
+debuggeeFailIfNotPresent 'This is call 5 to checkFunc'
+debuggeeFailIfNotPresent 'This is call 6 to checkFunc'
+pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,167 @@
+#
+# Copyright (c) 2013, 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.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# @test
+# @bug 7182152
+# @summary Redefine a subclass that implements two interfaces and
+#   verify that the right methods are called.
+# @author Daniel D. Daugherty
+#
+# @run shell MakeJAR3.sh RedefineSubclassWithTwoInterfacesAgent 'Can-Redefine-Classes: true'
+# @run build RedefineSubclassWithTwoInterfacesApp
+# @run shell RedefineSubclassWithTwoInterfaces.sh
+#
+
+if [ "${TESTJAVA}" = "" ]
+then
+  echo "TESTJAVA not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+if [ "${TESTSRC}" = "" ]
+then
+  echo "TESTSRC not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+JAVAC="${TESTJAVA}"/bin/javac
+JAVA="${TESTJAVA}"/bin/java
+
+echo "INFO: building the replacement classes."
+
+cp "${TESTSRC}"/RedefineSubclassWithTwoInterfacesTarget_1.java \
+    RedefineSubclassWithTwoInterfacesTarget.java
+cp "${TESTSRC}"/RedefineSubclassWithTwoInterfacesImpl_1.java \
+    RedefineSubclassWithTwoInterfacesImpl.java
+"${JAVAC}" -cp "${TESTCLASSES}" -d . \
+    RedefineSubclassWithTwoInterfacesTarget.java \
+    RedefineSubclassWithTwoInterfacesImpl.java 
+status="$?"
+if [ "$status" != 0 ]; then
+    echo "FAIL: compile of *_1.java files failed."
+    exit "$status"
+fi
+
+mv RedefineSubclassWithTwoInterfacesTarget.java \
+    RedefineSubclassWithTwoInterfacesTarget_1.java
+mv RedefineSubclassWithTwoInterfacesTarget.class \
+    RedefineSubclassWithTwoInterfacesTarget_1.class
+mv RedefineSubclassWithTwoInterfacesImpl.java \
+    RedefineSubclassWithTwoInterfacesImpl_1.java
+mv RedefineSubclassWithTwoInterfacesImpl.class \
+    RedefineSubclassWithTwoInterfacesImpl_1.class
+
+echo "INFO: launching RedefineSubclassWithTwoInterfacesApp"
+
+# TraceRedefineClasses options:
+#
+#    0x00000001 |          1 - name each target class before loading, after
+#                              loading and after redefinition is completed
+#    0x00000002 |          2 - print info if parsing, linking or
+#                              verification throws an exception
+#    0x00000004 |          4 - print timer info for the VM operation
+#    0x00001000 |       4096 - detect calls to obsolete methods
+#    0x00002000 |       8192 - fail a guarantee() in addition to detection
+#    0x00004000 |      16384 - detect old/obsolete methods in metadata
+#    0x00100000 |    1048576 - impl details: vtable updates
+#    0x00200000 |    2097152 - impl details: itable updates
+#
+#    1+2+4+4096+8192+16384+1048576+2097152 == 3174407
+
+"${JAVA}" ${TESTVMOPTS} \
+    -XX:TraceRedefineClasses=3174407 \
+    -javaagent:RedefineSubclassWithTwoInterfacesAgent.jar \
+    -classpath "${TESTCLASSES}" \
+    RedefineSubclassWithTwoInterfacesApp > output.log 2>&1
+status="$?"
+
+echo "INFO: <begin output.log>"
+cat output.log
+echo "INFO: <end output.log>"
+
+if [ "$status" != 0 ]; then
+    echo "FAIL: RedefineSubclassWithTwoInterfacesApp failed."
+    exit "$status"
+fi
+
+# When this bug manifests, RedefineClasses() will fail to update
+# one of the itable entries to refer to the new method. The log
+# will include the following line when the bug occurs:
+#
+#     guarantee(false) failed: OLD and/or OBSOLETE method(s) found
+#
+# If this guarantee happens, the test should fail in the status
+# check above, but just in case it doesn't, we check for "guarantee".
+#
+
+FAIL_MESG="guarantee"
+grep "$FAIL_MESG" output.log
+status=$?
+if [ "$status" = 0 ]; then
+    echo "FAIL: found '$FAIL_MESG' in the test output."
+    result=1
+else
+    echo "INFO: did NOT find '$FAIL_MESG' in the test output."
+    # be optimistic here
+    result=0
+fi
+
+PASS1_MESG="before any redefines"
+cnt=`grep "$PASS1_MESG" output.log | grep 'version-0' | wc -l | sed 's/^ *//'`
+case "$cnt" in
+2)
+    echo "INFO: found 2 version-0 '$PASS1_MESG' mesgs."
+    ;;
+*)
+    echo "FAIL: did NOT find 2 version-0 '$PASS1_MESG' mesgs."
+    echo "INFO: grep '$PASS1_MESG' output:"
+    grep "$PASS1_MESG" output.log
+    result=1
+    ;;
+esac
+
+PASS2_MESG="after redefine"
+cnt=`grep "$PASS2_MESG" output.log | grep 'version-1' | wc -l | sed 's/^ *//'`
+case "$cnt" in
+2)
+    echo "INFO: found 2 version-1 '$PASS2_MESG' mesgs."
+    ;;
+*)
+    echo "FAIL: did NOT find 2 version-1 '$PASS2_MESG' mesgs."
+    echo "INFO: grep '$PASS2_MESG' output:"
+    grep "$PASS2_MESG" output.log
+    result=1
+    ;;
+esac
+
+if [ "$result" = 0 ]; then
+    echo "PASS: test passed both positive and negative output checks."
+fi
+
+exit $result
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesAgent.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.instrument.Instrumentation;
+
+public class RedefineSubclassWithTwoInterfacesAgent {
+    private static Instrumentation instrumentation;
+
+    private RedefineSubclassWithTwoInterfacesAgent() {
+    }
+
+    public static void premain(String agentArgs, Instrumentation inst) {
+        System.out.println("Hello from " +
+            "RedefineSubclassWithTwoInterfacesAgent!");
+        System.out.println("isRedefineClassesSupported()=" +
+            inst.isRedefineClassesSupported());
+
+        instrumentation = inst;
+    }
+
+    public static Instrumentation getInstrumentation() {
+        return instrumentation;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesApp.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.lang.instrument.*;
+
+public class RedefineSubclassWithTwoInterfacesApp {
+    public static void main(String args[]) throws Exception {
+        System.out.println("Hello from RedefineSubclassWithTwoInterfacesApp!");
+
+        new RedefineSubclassWithTwoInterfacesApp().doTest();
+
+        System.exit(0);
+    }
+
+    private void doTest() throws Exception {
+        RedefineSubclassWithTwoInterfacesImpl impl
+            = new RedefineSubclassWithTwoInterfacesImpl();
+        RedefineSubclassWithTwoInterfacesRemote remote
+            = new RedefineSubclassWithTwoInterfacesRemote(impl, impl);
+        String mesg;
+
+        // make echo() calls before any redefinitions:
+        mesg = remote.echo1("test message #1.1");
+        System.out.println("RedefineSubclassWithTwoInterfacesApp: echo1 mesg='"
+            + mesg + "' before any redefines");
+        mesg = remote.echo2("test message #2.1");
+        System.out.println("RedefineSubclassWithTwoInterfacesApp: echo2 mesg='"
+            + mesg + "' before any redefines");
+
+
+        // redefining RedefineSubclassWithTwoInterfacesImpl before
+        // RedefineSubclassWithTwoInterfacesTarget fails:
+        do_redefine("RedefineSubclassWithTwoInterfacesImpl", 1);
+        do_redefine("RedefineSubclassWithTwoInterfacesTarget", 1);
+
+        mesg = remote.echo1("test message #1.2");
+        System.out.println("RedefineSubclassWithTwoInterfacesApp: echo1 mesg='"
+            + mesg + "' after redefine");
+        mesg = remote.echo2("test message #2.2");
+        System.out.println("RedefineSubclassWithTwoInterfacesApp: echo2 mesg='"
+            + mesg + "' after redefine");
+    }
+
+    private static void do_redefine(String className, int counter)
+            throws Exception {
+        File f = new File(className + "_" + counter + ".class");
+        System.out.println("Reading test class from " + f);
+        InputStream redefineStream = new FileInputStream(f);
+
+        byte[] redefineBuffer
+            = NamedBuffer.loadBufferFromStream(redefineStream);
+
+        ClassDefinition redefineParamBlock = new ClassDefinition(
+            Class.forName(className), redefineBuffer);
+
+        RedefineSubclassWithTwoInterfacesAgent.getInstrumentation().
+            redefineClasses(new ClassDefinition[] {redefineParamBlock});
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesImpl.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Reproducing this bug only requires an EMCP version of the
+// RedefineSubclassWithTwoInterfacesImpl class so
+// RedefineSubclassWithTwoInterfacesImpl.java and
+// RedefineSubclassWithTwoInterfacesImpl_1.java are identical.
+public class RedefineSubclassWithTwoInterfacesImpl
+                 extends RedefineSubclassWithTwoInterfacesTarget
+                 implements RedefineSubclassWithTwoInterfacesIntf1,
+                            RedefineSubclassWithTwoInterfacesIntf2 {
+    // This class is acting in the role of:
+    // wlstest.unit.diagnostics.common.apps.echoejb.EchoBean4_nh7k_Impl
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesImpl_1.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Reproducing this bug only requires an EMCP version of the
+// RedefineSubclassWithTwoInterfacesImpl class so
+// RedefineSubclassWithTwoInterfacesImpl.java and
+// RedefineSubclassWithTwoInterfacesImpl_1.java are identical.
+public class RedefineSubclassWithTwoInterfacesImpl
+                 extends RedefineSubclassWithTwoInterfacesTarget
+                 implements RedefineSubclassWithTwoInterfacesIntf1,
+                            RedefineSubclassWithTwoInterfacesIntf2 {
+    // This class is acting in the role of:
+    // wlstest.unit.diagnostics.common.apps.echoejb.EchoBean4_nh7k_Impl
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesIntf1.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public interface RedefineSubclassWithTwoInterfacesIntf1 {
+    // This interface is acting in the role of:
+    // wlstest.unit.diagnostics.common.apps.echoejb.EchoBean4_nh7k_Intf
+    String echo(String s);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesIntf2.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public interface RedefineSubclassWithTwoInterfacesIntf2 {
+    // This interface is acting in the role of:
+    // weblogic.ejb.container.interfaces.WLEnterpriseBean
+    String echo(String s);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesRemote.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class RedefineSubclassWithTwoInterfacesRemote {
+    // This class is acting in the role of:
+    // wlstest.unit.diagnostics.common.apps.echoejb.EchoBean4_nh7k_EchoRemoteImpl
+    // since it is calling the echo() method via an interface.
+    private RedefineSubclassWithTwoInterfacesIntf1 intf1;
+    private RedefineSubclassWithTwoInterfacesIntf2 intf2;
+
+    RedefineSubclassWithTwoInterfacesRemote(
+            RedefineSubclassWithTwoInterfacesIntf1 intf1,
+            RedefineSubclassWithTwoInterfacesIntf2 intf2) {
+        this.intf1 = intf1;
+        this.intf2 = intf2;
+    }
+
+    // There is actually a bit more logic in the call stack from
+    // EchoBean4_nh7k_EchoRemoteImpl.echo() to EchoBean4_nh7k_Intf.echo()
+    public String echo1(String s) {
+        return "intf1<" + intf1.echo(s) + ">";
+    }
+
+    public String echo2(String s) {
+        return "intf2<" + intf2.echo(s) + ">";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesTarget.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class RedefineSubclassWithTwoInterfacesTarget {
+    // This class is acting in the role of:
+    // wlstest.unit.diagnostics.common.apps.echoejb.EchoBean4
+    public String echo(String s) {
+        return "echo: (version-0) <" + s + ">";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfacesTarget_1.java	Mon Feb 11 10:07:01 2013 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class RedefineSubclassWithTwoInterfacesTarget {
+    // This class is acting in the role of:
+    // wlstest.unit.diagnostics.common.apps.echoejb.EchoBean4
+    public String echo(String s) {
+        return "echo: (version-1) <" + s + ">";
+    }
+}