PsiMethod (@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { final PsiManager psiManager = psiClass.getManager(); final String blockText = String.format("return other instanceof %s;", PsiTypesUtil.getClassType(psiClass).getCanonicalText()); final LombokLightMethodBuilder methodBuilder = new LombokLightMethodBuilder(psiManager, CAN_EQUAL_METHOD_NAME) .withModifier(PsiModifier.PROTECTED) .withMethodReturnType(PsiTypes.booleanType()) .withContainingClass(psiClass) .withNavigationElement(psiAnnotation) .withFinalParameter("other", PsiType.getJavaLangObject(psiManager, psiClass.getResolveScope())); LombokLightParameter parameter = methodBuilder.getParameterList().getParameter(0); if (null != parameter) { LombokAddNullAnnotations.createRelevantNullableAnnotation(psiClass, parameter); copyOnXAnnotationsForFirstParam(psiAnnotation, parameter); } methodBuilder.withBodyText(blockText); return methodBuilder; }