package com.siyeh.igtest.bugs.mismatched_collection_query_update;
import java.util.*;
import java.io.FileInputStream;
public class MismatchedCollectionQueryUpdate {
private Set foo = new HashSet();
private Set foo2 = new HashSet();
private Set bar ;
private Set bar2 = new HashSet(foo2);
private Set bal ;
public void bar()
{
foo.add(new Integer(bar.size()));
final boolean found = foo.add(new Integer(bar2.size()));
}
public void bar2()
{
final List barzoom = new ArrayList(3);
barzoom.add(new Integer(3));
}
public List bar4()
{
final List barzoom = new ArrayList(3);
barzoom.add(new Integer(3));
return true?null:barzoom;
}
public List bar3()
{
final List barzoom = new ArrayList(3);
barzoom.add(new Integer(3));
return barzoom;
}
class Node{
private SortedSet mChildren;
public synchronized SortedSet getChildren(){
if(mChildren == null){
mChildren = queryChildren();
}
return mChildren;
}
private SortedSet queryChildren(){
return null;
}
}
static class SNMP {
public static final int AGENT_PORT;
public static final int MANAGER_PORT;
static {
int agentPort;
int mgrPort;
try {
Properties p = new Properties();
p.loadFromXML(new FileInputStream("config/comms.xml"));
agentPort = Integer.parseInt(p.getProperty("snmp.agent.port"));
mgrPort = Integer.parseInt(p.getProperty("snmp.manager.port"));
} catch (Exception e) {
agentPort = 161;
mgrPort = 162;
}
AGENT_PORT = agentPort;
MANAGER_PORT = mgrPort;
}
}
class A {
private final List list = new ArrayList();
void foo(String s) {
list.add(s);
}
boolean bar(String s, boolean b, Set set2) {
return (b ? list : set2).contains(s);
}
}
class B {
private final List list = new ArrayList();
boolean foo(String s) {
return list.contains(s);
}
void bar(String s, boolean b, Set set2) {
(b ? list : set2).add(s);
}
}
class C {
private final java.util.concurrent.BlockingDeque deque =
new java.util.concurrent.LinkedBlockingDeque();
{
try {
final Object o = deque.takeFirst();
deque.putLast(o);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
class Test {
public String add(final String value) {
final List list = getList();
list.add(value);
return value;
}
private List getList() {
return null;
}
}
private static String foos() {
final List bar = new ArrayList();
bar.add("okay");
return "not " + bar + "";
}
void methodArgument() {
Listfoos = new ArrayList<>();
Listbars = new ArrayList<>();
foos.removeAll( bars );
List other = new ArrayList<>();
other.add("a");
m(other);
}
void m(List l) {}
public void foo()
{
final Set localFoo = foo;
}
public void foofoo()
{
final MapanotherMap = new HashMap();
final SortedMap map = new TreeMap(anotherMap);
final Iterator it = map.keySet().iterator();
while(it.hasNext()){
Object o = it.next();
}
}
class MyClass {
private List ourValues = new ArrayList() {{
Collections.addAll((this), "A", "B", "C");
}};
public void foo() {
for (final String value : ourValues) {}
}
}
class MyClass2 {
private List ourValues = new ArrayList() {{
(this).add("");
}};
public void foo() {
for (final String value : ourValues) {}
}
}
private void updateAttachmentWarning(final String message) {
final List includedAttachments;
if (message instanceof Object &&
!(includedAttachments = boo()).isEmpty()) {
if (includedAttachments.size() == 1) {
}
}
}
List boo() {return null;}
}
class MethReference {
private String foo(){
List list = new ArrayList<>();
forEach(list::add);
return list.toString();
}
void copyStuff(List other) {
List list = new ArrayList();
J j = list::add;
}
private void forEach(I ei) {}
interface I {
boolean _(E e);
}
interface J {
void m(E e);
}
void qTest() {
Map map = new HashMap<>();
map.put(1, true);
I mapper = map::get;
}
void foo(int a,Collection b) {
final ArrayList x = new ArrayList();
x.add("1");
for (Object o : a>0? b : x)
{
System.out.println(o);
}
}
}
class CollectionsUser {
void a(List list) {
List l = new ArrayList();
Collections.addAll(l, "1", "2", "4");
Collections.copy(list, l);
}
int b(List list) {
List l = new ArrayList();
Collections.addAll(l, "1", "2", "4");
return Collections.indexOfSubList(list, l);
}
void c() {
Listl = new ArrayList();
final int frequency = Collections.frequency(l, "one");
}
List d() {
Listl = new ArrayList();
return Collections.unmodifiableList(l);
}
List e() {
List l = new ArrayList();
return Collections.checkedList(l, String.class);
}
private final List