PsiMember (@NotNull MoveMembersOptions options, @NotNull PsiMember member, PsiElement anchor, @NotNull PsiClass targetClass) { if (member instanceof PsiVariable) { ((PsiVariable)member).normalizeDeclaration(); } ChangeContextUtil.encodeContextInfo(member, true); final PsiMember memberCopy; if (toBeConvertedToEnum(options, member, targetClass)) { memberCopy = EnumConstantsUtil.createEnumConstant(targetClass, member.getName(), ((PsiVariable)member).getInitializer()); } else { memberCopy = (PsiMember)member.copy(); final PsiClass containingClass = member.getContainingClass(); if (containingClass != null && containingClass.isInterface() && !targetClass.isInterface()) { // might need to make modifiers explicit, see IDEADEV-11416 final PsiModifierList list = memberCopy.getModifierList(); assert list != null; if (!(member instanceof PsiClass && (((PsiClass)member).isEnum() || ((PsiClass)member).isInterface()))) { list.setModifierProperty(PsiModifier.STATIC, member.hasModifierProperty(PsiModifier.STATIC)); } if (!(member instanceof PsiClass && ((PsiClass)member).isEnum())) { list.setModifierProperty(PsiModifier.FINAL, member.hasModifierProperty(PsiModifier.FINAL)); } VisibilityUtil.setVisibility(list, VisibilityUtil.getVisibilityModifier(member.getModifierList())); } } member.delete(); return anchor != null ? (PsiMember)targetClass.addAfter(memberCopy, anchor) : (PsiMember)targetClass.add(memberCopy); }