22
22
*/
23
23
package jdk .internal .ref ;
24
24
25
- import jdk .internal .ref .CleanerFactory ;
26
-
27
25
import java .lang .ref .Cleaner ;
28
26
import java .lang .ref .Cleaner .Cleanable ;
27
+ /*[IF JAVA_SPEC_VERSION < 24]*/
29
28
import java .lang .reflect .InvocationTargetException ;
30
29
import java .lang .reflect .Method ;
31
30
import java .security .AccessController ;
32
31
import java .security .PrivilegedAction ;
32
+ /*[ENDIF] JAVA_SPEC_VERSION < 24 */
33
33
34
34
@ SuppressWarnings ("javadoc" )
35
35
public class CleanerShutdown {
@@ -47,14 +47,15 @@ public static void shutdownCleaner() {
47
47
}
48
48
}
49
49
50
+ /*[IF JAVA_SPEC_VERSION < 24]*/
50
51
try {
51
- Method phantomRemove = PhantomCleanable .class .getDeclaredMethod ("remove" , ( Class <?>[]) null ); //$NON-NLS-1$
52
+ Method phantomRemove = PhantomCleanable .class .getDeclaredMethod ("remove" ); //$NON-NLS-1$
52
53
AccessController .doPrivileged ((PrivilegedAction <Void >) () -> {
53
54
phantomRemove .setAccessible (true );
54
55
return null ;
55
56
});
56
- while (!commonCleanerImpl .phantomCleanableList .isListEmpty ()) {
57
- phantomRemove .invoke (commonCleanerImpl .phantomCleanableList , ( Object []) null );
57
+ while (!commonCleanerImpl .phantomCleanableList .isListEmpty ()) {
58
+ phantomRemove .invoke (commonCleanerImpl .phantomCleanableList );
58
59
}
59
60
} catch (NoSuchMethodException
60
61
| SecurityException
@@ -65,5 +66,6 @@ public static void shutdownCleaner() {
65
66
/* should not fail */
66
67
e .printStackTrace ();
67
68
}
69
+ /*[ENDIF] JAVA_SPEC_VERSION < 24 */
68
70
}
69
71
}
0 commit comments