Skip to content

Commit 84df74c

Browse files
afshin-zafariTobiHartmann
authored andcommitted
8305079: Remove finalize() from compiler/c2/Test719030
Reviewed-by: thartmann, coleenp
1 parent 0b5c504 commit 84df74c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/hotspot/jtreg/compiler/c2/Test7190310.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -39,17 +39,13 @@
3939
import java.lang.ref.Reference;
4040
import java.lang.ref.ReferenceQueue;
4141
import java.lang.ref.WeakReference;
42+
import java.lang.ref.Cleaner;
4243

4344
public class Test7190310 {
4445
private static Object str = new Object() {
4546
public String toString() {
4647
return "The Object";
4748
}
48-
49-
protected void finalize() throws Throwable {
50-
System.out.println("The Object is being finalized");
51-
super.finalize();
52-
}
5349
};
5450
private final static ReferenceQueue<Object> rq =
5551
new ReferenceQueue<Object>();
@@ -58,6 +54,7 @@ protected void finalize() throws Throwable {
5854

5955
public static void main(String[] args)
6056
throws InterruptedException {
57+
Cleaner.create().register(str, () -> System.out.println("The Object is being finalized"));
6158
Thread reader = new Thread() {
6259
public void run() {
6360
while (wr.get() != null) {

0 commit comments

Comments
 (0)