PsiMethod (PsiMethod prototype, HashMap<String,PsiMethod> nameToAncestor) { PsiMethod existing = myClass.findMethodBySignature(prototype, false); PsiMethod result = existing; try{ if (existing == null){ PsiUtil.setModifierProperty(prototype, myDescriptor.getAccessorsVisibility(), true); result = (PsiMethod) myClass.add(prototype); } else{ //TODO : change visibility } nameToAncestor.put(prototype.getName(), result); return result; } catch(IncorrectOperationException e){ LOG.error(e); } return null; }