void (@NotNull PsiMethod method) { super.visitMethod(method); final PsiParameterList parameterList = method.getParameterList(); final int parametersCount = parameterList.getParametersCount(); if (parametersCount == 0) { return; } final PsiParameter[] parameters = parameterList.getParameters(); final IntList functionalIndices = new IntArrayList(2); for (int i = 0; i < parameters.length; i++) { final PsiParameter parameter = parameters[i]; if (LambdaUtil.isFunctionalType(parameter.getType())) { functionalIndices.add(i); } } if (functionalIndices.isEmpty()) { return; } final PsiClass containingClass = method.getContainingClass(); if (containingClass == null) { return; } if (MethodUtils.hasSuper(method)) { return; } final String name = method.getName(); outer: for (PsiMethod sameNameMethod : containingClass.findMethodsByName(name, true)) { if (method.equals(sameNameMethod) || PsiSuperMethodUtil.isSuperMethod(method, sameNameMethod)) { continue; } final PsiParameterList otherParameterList = sameNameMethod.getParameterList(); if (parametersCount != otherParameterList.getParametersCount()) { continue; } final PsiParameter[] otherParameters = otherParameterList.getParameters(); if (!areOtherParameterTypesConvertible(parameters, otherParameters, functionalIndices)) { continue; } final int max = functionalIndices.size(); boolean equalTypes = true; for (int i = 0; i < max; i++) { final int index = functionalIndices.getInt(i); final PsiType otherFunctionalType = otherParameters[index].getType(); if (!LambdaUtil.isFunctionalType(otherFunctionalType)) { continue outer; } final PsiType functionalType = parameters[index].getType(); if (!areSameShapeFunctionalTypes(functionalType, otherFunctionalType)) { continue outer; } equalTypes &= Objects.equals(TypeConversionUtil.erasure(functionalType), TypeConversionUtil.erasure(otherFunctionalType)); } if (equalTypes) { continue; } registerMethodError(method, method); return; } }