PsiModifierList (EncapsulateFieldsDescriptor descriptor) { PsiModifierList newModifierList = null; PsiElementFactory factory = JavaPsiFacade.getElementFactory(descriptor.getTargetClass().getProject()); try { PsiField field = factory.createField("a", PsiTypes.intType()); EncapsulateFieldsProcessor.setNewFieldVisibility(field, descriptor); newModifierList = field.getModifierList(); } catch (IncorrectOperationException e) { LOG.error(e); } return newModifierList; }