From 36bd4ba3351d77d401bb2a4decfd3ced081716ca Mon Sep 17 00:00:00 2001 From: Dave Brosius Date: Fri, 24 Nov 2023 09:12:53 -0500 Subject: [PATCH] add explicit test for #433, not seeing issue --- src/samples/java/ex/WOC_Sample.java | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/samples/java/ex/WOC_Sample.java b/src/samples/java/ex/WOC_Sample.java index 82a6c3d94..fbb178d39 100755 --- a/src/samples/java/ex/WOC_Sample.java +++ b/src/samples/java/ex/WOC_Sample.java @@ -1,4 +1,5 @@ package ex; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -36,7 +37,7 @@ public void testWOCSimple() { System.out.println("woops"); } } - + public void testGuavaWOCSimple() { // tag WOC_WRITE_ONLY_COLLECTION_LOCAL Set s = Sets.newHashSet(); @@ -46,10 +47,10 @@ public void testGuavaWOCSimple() { System.out.println("woops"); } } - + public void testIterateEmpty() { Set ss = new HashSet(); - + for (String s : ss) { } } @@ -70,6 +71,13 @@ public void testFPWOCAsParm() { memberSet.add("fo"); fpSet.add("boo"); helper(0, m); + + List l = new ArrayList(); + + l.add("a"); + l.add("b"); + + doSomethingWithList(l); } public void testFPWOCCopy() { @@ -104,11 +112,17 @@ public Set testFPTernary(boolean b) { s.add("foo"); s.add("bar"); - return b ? s : Collections. emptySet(); + return b ? s : Collections.emptySet(); } private void helper(int i, Map x) { - System.out.println(x.get(i)); + System.out.println(x.get(String.valueOf(i))); + } + + private void doSomethingWithList(List l) { + for (String s : l) { + System.out.println(s); + } } // no tag, put in anonymous class