PsiMethod (@NotNull PsiField psiField, @NotNull PsiClass psiClass, @NotNull String methodModifier, @Nullable String nameHint) { final AccessorsInfo accessorsInfo = AccessorsInfo.buildFor(psiField); final String methodName = LombokUtils.getGetterName(psiField, accessorsInfo); if (nameHint != null && !nameHint.equals(methodName)) return null; LombokLightMethodBuilder methodBuilder = new LombokLightMethodBuilder(psiField.getManager(), methodName) .withMethodReturnType(psiField.getType()) .withContainingClass(psiClass) .withNavigationElement(psiField) .withPureContract(); if (StringUtil.isNotEmpty(methodModifier)) { methodBuilder.withModifier(methodModifier); } boolean isStatic = psiField.hasModifierProperty(PsiModifier.STATIC); if (isStatic) { methodBuilder.withModifier(PsiModifier.STATIC); } if (accessorsInfo.isMakeFinal()) { methodBuilder.withModifier(PsiModifier.FINAL); } final String blockText = String.format("return %s.%s;", isStatic ? psiClass.getName() : "this", psiField.getName()); methodBuilder.withBodyText(blockText); final LombokLightModifierList modifierList = methodBuilder.getModifierList(); LombokCopyableAnnotations.copyCopyableAnnotations(psiField, modifierList, LombokCopyableAnnotations.BASE_COPYABLE); PsiAnnotation fieldGetterAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiField, LombokClassNames.GETTER); LombokCopyableAnnotations.copyOnXAnnotations(fieldGetterAnnotation, modifierList, "onMethod"); if (psiField.isDeprecated()) { modifierList.addAnnotation(CommonClassNames.JAVA_LANG_DEPRECATED); } return methodBuilder; }