Skip to content

Commit 00f7967

Browse files
committed
Adapt JDK-8354556: Expand value-based class warnings to java.lang.ref API
1 parent 85b7dcb commit 00f7967

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ea/PartialEscapeAnalysisIterationTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
*/
2525
package jdk.graal.compiler.core.test.ea;
2626

27-
import java.lang.ref.WeakReference;
2827
import java.util.List;
28+
import java.util.concurrent.atomic.AtomicReference;
2929

3030
import org.junit.Assert;
3131
import org.junit.Test;
@@ -66,15 +66,15 @@ private static final class AllocatedObject {
6666
public static String moveIntoBranchBox(int id) {
6767
Double box = object1 + 1;
6868
if (id == 0) {
69-
obj1 = new WeakReference<>(box);
69+
obj1 = new AtomicReference<>(box);
7070
}
7171
return "value";
7272
}
7373

7474
public static String moveIntoBranch(int id) {
7575
AllocatedObject box = new AllocatedObject(object2.value + 1);
7676
if (id == 0) {
77-
obj1 = new WeakReference<>(box);
77+
obj1 = new AtomicReference<>(box);
7878
}
7979
return "value";
8080
}
@@ -104,7 +104,7 @@ public static String noLoopIterationBox(int id) {
104104
Double box = object1 + 1;
105105
for (int i = 0; i < 100; i++) {
106106
if (id == i) {
107-
obj1 = new WeakReference<>(box);
107+
obj1 = new AtomicReference<>(box);
108108
}
109109
}
110110
return "value";
@@ -114,7 +114,7 @@ public static String noLoopIteration(int id) {
114114
AllocatedObject box = new AllocatedObject(object2.value + 1);
115115
for (int i = 0; i < 100; i++) {
116116
if (id == i) {
117-
obj1 = new WeakReference<>(box);
117+
obj1 = new AtomicReference<>(box);
118118
}
119119
}
120120
return "value";
@@ -124,7 +124,7 @@ public static String noLoopIterationEmpty(int id) {
124124
AllocatedObject box = new AllocatedObject();
125125
for (int i = 0; i < 100; i++) {
126126
if (id == i) {
127-
obj1 = new WeakReference<>(box);
127+
obj1 = new AtomicReference<>(box);
128128
}
129129
}
130130
return "value";

0 commit comments

Comments
 (0)