< prev index next >

test/hotspot/jtreg/runtime/RedefineTests/RedefineFinalizer.java

Print this page
rev 50289 : [mq]: jep181-rev5

*** 1,7 **** /* ! * Copyright (c) 2014, 2016, 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. --- 1,7 ---- /* ! * Copyright (c) 2014, 2018, 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.
*** 21,31 **** * questions. */ /* * @test ! * @bug 6904403 * @summary Don't assert if we redefine finalize method * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument --- 21,31 ---- * questions. */ /* * @test ! * @bug 6904403 8010319 * @summary Don't assert if we redefine finalize method * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument
*** 39,67 **** * * assert(f == k->has_finalizer()) failed: inconsistent has_finalizer * * when redefining finalizer method */ public class RedefineFinalizer { public static String newB = ! "class RedefineFinalizer$B {" + " protected void finalize() { " + " System.out.println(\"Finalizer called\");" + " }" + "}"; public static void main(String[] args) throws Exception { ! RedefineClassHelper.redefineClass(B.class, newB); A a = new A(); } ! static class A extends B { ! } ! ! static class B { ! protected void finalize() { ! // should be empty ! } } } --- 39,71 ---- * * assert(f == k->has_finalizer()) failed: inconsistent has_finalizer * * when redefining finalizer method */ + + + // package access top-level class to avoid problem with RedefineClassHelper + // and nested types. + class RedefineFinalizer_B { + protected void finalize() { + // should be empty + } + } + public class RedefineFinalizer { public static String newB = ! "class RedefineFinalizer_B {" + " protected void finalize() { " + " System.out.println(\"Finalizer called\");" + " }" + "}"; public static void main(String[] args) throws Exception { ! RedefineClassHelper.redefineClass(RedefineFinalizer_B.class, newB); A a = new A(); } ! static class A extends RedefineFinalizer_B { } }
< prev index next >