PsiField (@NotNull PsiMember psiMember, boolean makeUppercased, @NotNull PsiClass containingClass) { final PsiManager manager = containingClass.getContainingFile().getManager(); final PsiType fieldNameConstType = PsiType.getJavaLangString(manager, GlobalSearchScope.allScope(containingClass.getProject())); LombokLightFieldBuilder fieldNameConstant = new LombokLightFieldBuilder(manager, makeFieldNameConstant(psiMember, makeUppercased), fieldNameConstType) .withContainingClass(containingClass) .withNavigationElement(psiMember) .withModifier(PsiModifier.PUBLIC) .withModifier(PsiModifier.STATIC) .withModifier(PsiModifier.FINAL); final PsiElementFactory psiElementFactory = JavaPsiFacade.getElementFactory(containingClass.getProject()); final PsiExpression initializer = psiElementFactory.createExpressionFromText("\"" + psiMember.getName() + "\"", containingClass); fieldNameConstant.setInitializer(initializer); return fieldNameConstant; }