hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java
author igerasim
Tue, 25 Aug 2015 19:45:07 +0300
changeset 32276 2d5fcc89e099
parent 30604 b8d532cb6420
child 36508 5f9eee6b383b
permissions -rw-r--r--
8134356: {@code} tag contains < and > sequences Reviewed-by: martin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28373
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     1
/*
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     4
 *
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     8
 *
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    13
 * accompanied this code).
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    14
 *
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    18
 *
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    21
 * questions.
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    22
 */
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    23
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    24
/*
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    25
 * @test
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    26
 * @bug 6583051
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    27
 * @summary Give error if java.lang.Object has been incompatibly overridden on the bootpath
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    28
 * @library /testlibrary
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28373
diff changeset
    29
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28373
diff changeset
    30
 *          java.management
28373
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    31
 * @compile Object.java
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    32
 * @run main BootstrapRedefine
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    33
 */
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    34
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    35
import jdk.test.lib.*;
28373
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    36
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    37
public class BootstrapRedefine {
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    38
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    39
    public static void main(String[] args) throws Exception {
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    40
        String testClasses = System.getProperty("test.classes", ".");
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    41
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/p:" + testClasses, "-version");
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    42
        new OutputAnalyzer(pb.start())
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    43
            .shouldContain("Incompatible definition of java.lang.Object")
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    44
            .shouldHaveExitValue(1);
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    45
    }
26fdc99d32f8 6583051: crash when adding non-static methods to java.lang.Object class
coleenp
parents:
diff changeset
    46
}