8225648: [TESTBUG] java/lang/annotation/loaderLeak/Main.java fails with -Xcomp
authorjiefu
Mon, 22 Jul 2019 14:31:04 +0800
changeset 55755 6e97fcd96aee
parent 55754 d645d7ca8ee8
child 55756 d48ffad997b1
8225648: [TESTBUG] java/lang/annotation/loaderLeak/Main.java fails with -Xcomp Reviewed-by: alanb, iklam
test/jdk/java/lang/annotation/loaderLeak/Main.java
--- a/test/jdk/java/lang/annotation/loaderLeak/Main.java	Wed Jul 17 15:40:27 2019 +0200
+++ b/test/jdk/java/lang/annotation/loaderLeak/Main.java	Mon Jul 22 14:31:04 2019 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -56,6 +56,7 @@
         if (c.get() == null) throw new AssertionError();
         System.gc();
         System.gc();
+        Reference.reachabilityFence(loader);
         loader = null;
 
         // Might require multiple calls to System.gc() for weak-references