8305079: Remove finalize() from compiler/c2/Test719030

Reviewed-by: thartmann, coleenp
This commit is contained in:
Afshin Zafari 2023-04-28 06:32:25 +00:00 committed by Tobias Hartmann
parent 0b5c504ad0
commit 84df74ca39

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023, 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
@ -39,17 +39,13 @@ package compiler.c2;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.lang.ref.Cleaner;
public class Test7190310 {
private static Object str = new Object() {
public String toString() {
return "The Object";
}
protected void finalize() throws Throwable {
System.out.println("The Object is being finalized");
super.finalize();
}
};
private final static ReferenceQueue<Object> rq =
new ReferenceQueue<Object>();
@ -58,6 +54,7 @@ public class Test7190310 {
public static void main(String[] args)
throws InterruptedException {
Cleaner.create().register(str, () -> System.out.println("The Object is being finalized"));
Thread reader = new Thread() {
public void run() {
while (wr.get() != null) {