void (@NotNull final Set<? super PsiModifierListOwner> result, @NotNull PsiParameter parameter) { PsiElement parent = parameter.getParent(); if (!(parent instanceof PsiParameterList)) { return; } final int index = ((PsiParameterList)parent).getParameterIndex(parameter); Consumer<PsiMethod> forEachSuperMethod = method -> { PsiParameter[] superParameters = method.getParameterList().getParameters(); if (index < superParameters.length) { result.add(superParameters[index]); } }; PsiElement scope = parent.getParent(); if (scope instanceof PsiLambdaExpression) { PsiMethod method = LambdaUtil.getFunctionalInterfaceMethod(((PsiLambdaExpression)scope).getFunctionalInterfaceType()); if (method != null) { forEachSuperMethod.consume(method); for (PsiMethod superMethod : getSuperAnnotationOwners(method)) { forEachSuperMethod.consume(superMethod); } } } else if (scope instanceof PsiMethod) { for (PsiMethod superMethod : getSuperAnnotationOwners((PsiMethod)scope)) { forEachSuperMethod.consume(superMethod); } } }