private PsiMethod createConstructor(@NotNull PsiClass psiClass, @PsiModifier.ModifierConstant @NotNull String modifier,
                                      boolean useJavaDefaults, @NotNull Collection<PsiField> params, @NotNull PsiAnnotation psiAnnotation) {
    LombokLightMethodBuilder constructorBuilder = new LombokLightMethodBuilder(psiClass.getManager(), getConstructorName(psiClass))
      .withConstructor(true)
      .withContainingClass(psiClass)
      .withNavigationElement(psiAnnotation)
      .withModifier(modifier)
      .withWriteAccess();

    LombokCopyableAnnotations.copyOnXAnnotations(psiAnnotation, constructorBuilder.getModifierList(), "onConstructor");

    if (useJavaDefaults) {
      final StringBuilder blockText = new StringBuilder();

      for (PsiField param : params) {
        final String fieldInitializer = PsiTypesUtil.getDefaultValueOfType(param.getType());
        blockText.append(String.format("this.%s = %s;\n", param.getName(), fieldInitializer));
      }
      constructorBuilder.withBodyText(blockText.toString());
    }
    else {
      final List<String> fieldNames = new ArrayList<>();
      final AccessorsInfo.AccessorsValues classAccessorsValues = AccessorsInfo.getAccessorsValues(psiClass);
      for (PsiField psiField : params) {
        final AccessorsInfo paramAccessorsInfo = AccessorsInfo.buildFor(psiField, classAccessorsValues);
        fieldNames.add(paramAccessorsInfo.removePrefix(psiField.getName()));
      }

      if (!fieldNames.isEmpty()) {
        boolean addConstructorProperties =
          configDiscovery.getBooleanLombokConfigProperty(ConfigKey.ANYCONSTRUCTOR_ADD_CONSTRUCTOR_PROPERTIES, psiClass);
        if (addConstructorProperties ||
            !configDiscovery.getBooleanLombokConfigProperty(ConfigKey.ANYCONSTRUCTOR_SUPPRESS_CONSTRUCTOR_PROPERTIES, psiClass)) {
          final String constructorPropertiesAnnotation = "java.beans.ConstructorProperties( {" +
                                                         fieldNames.stream().collect(Collectors.joining("\", \"", "\"", "\"")) +
                                                         "} ) ";
          constructorBuilder.withAnnotation(constructorPropertiesAnnotation);
        }
      }

      final StringBuilder blockText = new StringBuilder();

      final Iterator<String> fieldNameIterator = fieldNames.iterator();
      final Iterator<PsiField> fieldIterator = params.iterator();
      while (fieldNameIterator.hasNext() && fieldIterator.hasNext()) {
        final String parameterName = fieldNameIterator.next();
        final PsiField parameterField = fieldIterator.next();

        final LombokLightParameter parameter = new LombokLightParameter(parameterName, parameterField.getType(), constructorBuilder);
        parameter.setNavigationElement(parameterField);
        constructorBuilder.withParameter(parameter);
        LombokCopyableAnnotations.copyCopyableAnnotations(parameterField, parameter.getModifierList(),
                                                          LombokCopyableAnnotations.BASE_COPYABLE);

        blockText.append(String.format("this.%s = %s;\n", parameterField.getName(), parameterName));
      }

      constructorBuilder.withBodyText(blockText.toString());
    }

    return constructorBuilder;
  }
private PsiMethod createConstructor(@NotNull PsiClass psiClass, @PsiModifier.ModifierConstant @NotNull String modifier,
                                      boolean useJavaDefaults, @NotNull Collection<PsiField> params, @NotNull PsiAnnotation psiAnnotation)