MutationSignature (PsiMethod method) { PsiClass aClass = method.getContainingClass(); if (aClass == null) return MutationSignature.unknown(); String className = aClass.getQualifiedName(); if (className == null) return MutationSignature.unknown(); String name = method.getName(); if ("java.util.Objects".equals(className) && "requireNonNull".equals(name)) { PsiParameter[] parameters = method.getParameterList().getParameters(); if (parameters.length == 2 && parameters[1].getType().getCanonicalText().contains("Supplier")) { return MutationSignature.unknown(); } } if ("remove".equals(name) || "add".equals(name)) { return MutationSignature.pure().alsoMutatesThis(); } if ("java.lang.System".equals(className)) { return MutationSignature.unknown(); } if (JAVA_UTIL_ARRAYS.equals(className)) { return PURE_ARRAY_METHODS.contains(name) ? MutationSignature.pure() : // else: fill, parallelPrefix, parallelSort, sort MutationSignature.pure().alsoMutatesArg(0); } if (QUEUE_POLL.methodMatches(method)) { return MutationSignature.pure().alsoMutatesThis(); } return MutationSignature.pure(); }