void (@Nullable GroovyPsiElement elementToProcess, final UsageInfo[] usages, MultiMap<PsiElement, String> conflicts, boolean replaceFieldsWithGetters, Project project) { if (elementToProcess == null) return; final ReferencedElementsCollector collector = new ReferencedElementsCollector(); elementToProcess.accept(collector); final List<PsiElement> result = collector.getResult(); if (result.isEmpty()) return; for (final UsageInfo usageInfo : usages) { if (!(usageInfo instanceof ExternalUsageInfo) || !IntroduceParameterUtil.isMethodUsage(usageInfo)) continue; final PsiElement place = usageInfo.getElement(); for (PsiElement element : result) { if (element instanceof PsiField && replaceFieldsWithGetters) { //check getter access instead final PsiClass psiClass = ((PsiField)element).getContainingClass(); LOG.assertTrue(psiClass != null); final PsiMethod method = GroovyPropertyUtils.findGetterForField((PsiField)element); if (method != null) { element = method; } } if (element instanceof PsiMember && !JavaPsiFacade.getInstance(project).getResolveHelper().isAccessible((PsiMember)element, place, null)) { String message = JavaRefactoringBundle.message( "0.is.not.accessible.from.1.value.for.introduced.parameter.in.that.method.call.will.be.incorrect", RefactoringUIUtil.getDescription(element, true), RefactoringUIUtil.getDescription(ConflictsUtil.getContainer(place), true)); conflicts.putValue(element, message); } } } }