Find collection lookups with an argument that can never match

Proprietary

Marks a call such as Collection.contains(Object), Map.get(Object) or List.indexOf(Object) whose argument's type can never be cast to the collection's element, key or value type, as in List<String>.contains(1). Such a call never finds, matches or removes anything. containsAll, removeAll and retainAll compare the element types of both collections. Calls are not marked when a raw type, an unbounded wildcard or type variable, an intersection type, or a type missing from the classpath is involved.

io.moderne.staticanalysis.FindCollectionIncompatibleType
mod run . --recipe=io.moderne.staticanalysis.FindCollectionIncompatibleType

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.