PsiMethod (@Nullable PsiType type, String propertyName, @NotNull GroovyPsiElement context) { final String setterName = getSetterName(propertyName); if (type == null) { final GrExpression fromText = GroovyPsiElementFactory.getInstance(context.getProject()).createExpressionFromText("this", context); return findPropertySetter(fromText.getType(), propertyName, context); } final AccessorProcessor processor = new AccessorProcessor(propertyName, PropertyKind.SETTER, null, context); ResolveUtil.processAllDeclarations(type, processor, ResolveState.initial(), context); return PsiImplUtil.extractUniqueElement(processor.getResults().toArray(GroovyResolveResult.EMPTY_ARRAY)); }