void (@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation, @NotNull List<? super PsiElement> target, @Nullable String nameHint) { final PsiManager psiManager = psiClass.getManager(); final Collection<PsiMethod> existedConstructors = PsiClassUtil.collectClassConstructorIntern(psiClass); final String accessVisibility = getAccessVisibility(psiAnnotation); // default constructor if (noConstructorWithParamsOfTypesDefined(existedConstructors)) { target.add(createConstructor(psiClass, psiAnnotation, psiManager, accessVisibility).withBodyText("this(null, null);")); } final GlobalSearchScope psiClassResolveScope = psiClass.getResolveScope(); final PsiClassType javaLangStringType = PsiType.getJavaLangString(psiManager, psiClassResolveScope); final PsiClassType javaLangThrowableType = PsiType.getJavaLangThrowable(psiManager, psiClassResolveScope); final boolean addConstructorProperties = ConfigDiscovery.getInstance().getBooleanLombokConfigProperty(ConfigKey.ANYCONSTRUCTOR_ADD_CONSTRUCTOR_PROPERTIES, psiClass); // message constructor if (noConstructorWithParamsOfTypesDefined(existedConstructors, javaLangStringType)) { final LombokLightMethodBuilder messageConstructor = createConstructor(psiClass, psiAnnotation, psiManager, accessVisibility) .withFinalParameter("message", javaLangStringType) .withBodyText("this(message, null);"); if (addConstructorProperties) { messageConstructor.withAnnotation("java.beans.ConstructorProperties(\"message\")"); } target.add(messageConstructor); } // cause constructor if (noConstructorWithParamsOfTypesDefined(existedConstructors, javaLangThrowableType)) { final LombokLightMethodBuilder causeConstructor = createConstructor(psiClass, psiAnnotation, psiManager, accessVisibility) .withFinalParameter("cause", javaLangThrowableType) .withBodyText("this(cause != null ? cause.getMessage() : null, cause);"); if (addConstructorProperties) { causeConstructor.withAnnotation("java.beans.ConstructorProperties(\"cause\")"); } target.add(causeConstructor); } // message and cause constructor if (noConstructorWithParamsOfTypesDefined(existedConstructors, javaLangStringType, javaLangThrowableType)) { final LombokLightMethodBuilder messageCauseConstructor = createConstructor(psiClass, psiAnnotation, psiManager, accessVisibility) .withFinalParameter("message", javaLangStringType) .withFinalParameter("cause", javaLangThrowableType) .withBodyText("super(message);\n" + "if (cause != null) super.initCause(cause);"); if (addConstructorProperties) { messageCauseConstructor.withAnnotation("java.beans.ConstructorProperties({\"message\",\"cause\"})"); } target.add(messageCauseConstructor); } }