File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
test/hotspot/jtreg/compiler/c2 Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 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
3939import java .lang .ref .Reference ;
4040import java .lang .ref .ReferenceQueue ;
4141import java .lang .ref .WeakReference ;
42+ import java .lang .ref .Cleaner ;
4243
4344public 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 ) {
You can’t perform that action at this time.
0 commit comments