Crash.java revision 1870:4aa2e64eff30
1190214Srpaulo/* 2190214Srpaulo * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 3190214Srpaulo * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4190214Srpaulo * 5190214Srpaulo * This code is free software; you can redistribute it and/or modify it 6190214Srpaulo * under the terms of the GNU General Public License version 2 only, as 7190214Srpaulo * published by the Free Software Foundation. 8190214Srpaulo * 9190214Srpaulo * This code is distributed in the hope that it will be useful, but WITHOUT 10190214Srpaulo * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11190214Srpaulo * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12190214Srpaulo * version 2 for more details (a copy is included in the LICENSE file that 13190214Srpaulo * accompanied this code). 14190214Srpaulo * 15190214Srpaulo * You should have received a copy of the GNU General Public License version 16190214Srpaulo * 2 along with this work; if not, write to the Free Software Foundation, 17190214Srpaulo * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18190214Srpaulo * 19190214Srpaulo * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20190214Srpaulo * or visit www.oracle.com if you need additional information or have any 21190214Srpaulo * questions. 22190214Srpaulo */ 23190214Srpaulo 24190214Srpauloimport sun.misc.Unsafe; 25190214Srpaulo 26190214Srpauloimport java.lang.reflect.Field; 27190214Srpaulo 28190214Srpaulo/* 29190214Srpaulo * @test 30190214Srpaulo * @run main/othervm Crash 31190214Srpaulo */ 32190214Srpaulopublic class Crash { 33190214Srpaulo public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException { 34190214Srpaulo Field f = Unsafe.class.getDeclaredField("theUnsafe"); 35190214Srpaulo f.setAccessible(true); 36190214Srpaulo Unsafe u = (Unsafe) f.get(null); 37190214Srpaulo u.setMemory(0, 42, (byte) 0xFF); 38214518Srpaulo } 39190214Srpaulo} 40190214Srpaulo