Skip to content

Commit

Permalink
add explicit test for #433, not seeing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mebigfatguy committed Nov 24, 2023
1 parent 377f94d commit 36bd4ba
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/samples/java/ex/WOC_Sample.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package ex;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
Expand Down Expand Up @@ -36,7 +37,7 @@ public void testWOCSimple() {
System.out.println("woops");
}
}

public void testGuavaWOCSimple() {
// tag WOC_WRITE_ONLY_COLLECTION_LOCAL
Set<String> s = Sets.newHashSet();
Expand All @@ -46,10 +47,10 @@ public void testGuavaWOCSimple() {
System.out.println("woops");
}
}

public void testIterateEmpty() {
Set<String> ss = new HashSet<String>();

for (String s : ss) {
}
}
Expand All @@ -70,6 +71,13 @@ public void testFPWOCAsParm() {
memberSet.add("fo");
fpSet.add("boo");
helper(0, m);

List l = new ArrayList<String>();

l.add("a");
l.add("b");

doSomethingWithList(l);
}

public void testFPWOCCopy() {
Expand Down Expand Up @@ -104,11 +112,17 @@ public Set<String> testFPTernary(boolean b) {
s.add("foo");
s.add("bar");

return b ? s : Collections.<String> emptySet();
return b ? s : Collections.<String>emptySet();
}

private void helper(int i, Map<String, String> x) {
System.out.println(x.get(i));
System.out.println(x.get(String.valueOf(i)));
}

private void doSomethingWithList(List<String> l) {
for (String s : l) {
System.out.println(s);
}
}

// no tag, put in anonymous class
Expand Down

0 comments on commit 36bd4ba

Please sign in to comment.