Skip to content

Commit 9394d84

Browse files
committed
Use weakMemo() explicitly.
1 parent ac116df commit 9394d84

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

core/src/main/java/fj/P1.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,11 @@ public final P1<A> memo() {
262262
public P1<A> softMemo() { return new SoftReferenceMemo<>(this); }
263263

264264
public static <A> P1<A> memo(F<Unit, A> f) {
265-
return P.lazy(f).memo();
265+
return P.lazy(f).weakMemo();
266266
}
267267

268268
public static <A> P1<A> memo(F0<A> f) {
269-
return P.lazy(f).memo();
269+
return P.lazy(f).weakMemo();
270270
}
271271

272272
static final class Memo<A> extends P1<A> {

core/src/test/java/fj/P1Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public final class P1Test {
1111

1212
@Test
1313
public void bug105() throws Exception {
14-
final P1<String> p1 = P.p("Foo").memo();
14+
final P1<String> p1 = P.p("Foo").weakMemo();
1515
final AtomicInteger nullCounter = new AtomicInteger();
1616
ExecutorService executorService = Executors.newCachedThreadPool();
1717

props-core/src/test/java/fj/MemoisationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class MemoisationTest {
1919

2020
public Property test1() {
2121
return property(arbInteger, a -> {
22-
P1<Integer> t = P.lazy(() -> a).memo();
22+
P1<Integer> t = P.lazy(() -> a).weakMemo();
2323
return prop(t._1().equals(t._1())).and(prop(t._1().equals(a)));
2424
});
2525
}

0 commit comments

Comments
 (0)