< prev index next >
test/hotspot/jtreg/runtime/RedefineTests/RedefineFinalizer.java
Print this page
rev 50608 : imported patch jep181-rev5
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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,11 +21,11 @@
* questions.
*/
/*
* @test
- * @bug 6904403
+ * @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,29 +39,33 @@
*
* 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 {" +
+ "class RedefineFinalizer_B {" +
" protected void finalize() { " +
" System.out.println(\"Finalizer called\");" +
" }" +
"}";
public static void main(String[] args) throws Exception {
- RedefineClassHelper.redefineClass(B.class, newB);
+ RedefineClassHelper.redefineClass(RedefineFinalizer_B.class, newB);
A a = new A();
}
- static class A extends B {
- }
-
- static class B {
- protected void finalize() {
- // should be empty
- }
+ static class A extends RedefineFinalizer_B {
}
}
< prev index next >