jklingsporn / vertx-jooq

A jOOQ-CodeGenerator to create vertx-ified DAOs and POJOs.
MIT License
385 stars 53 forks source link

FluentSetters required on 6.1.0 #177

Closed cdekok closed 3 years ago

cdekok commented 3 years ago

This will not work anymore on 6.1.0

.withFluentSetters(false)

It will throw errors on the setOrThrow

.java:269: error: incompatible types: bad return type in method reference
        setOrThrow(this::setFieldId,json::getString,"field_id","java.lang.String");

As it will return void in the setter.

io.github.jklingsporn.vertx.jooq.shared.internal.VertxPojo public static <T> void setOrThrow(@NotNull java.util.function.Function<T, ?> pojoSetter,
                                  @NotNull java.util.function.Function<String, T> jsonGetter,
                                  String fieldName,
                                  String expectedFieldType)
Inferred annotations:
Parameter pojoSetter: @org.jetbrains.annotations.NotNull
Parameter jsonGetter: @org.jetbrains.annotations.NotNull
  Gradle: io.github.jklingsporn:vertx-jooq-shared:6.1.0

Not a big deal to change it in my case but maybe remove the option if it's no longer usable. Or add another setOrThrow method.

jklingsporn commented 3 years ago

Thank you very much for the detailed report. I will come up with a fix.

jklingsporn commented 3 years ago

I will change the method from taking java.util.function.Function<T, ?> pojoSetter to java.util.function.Consumer<T> pojoSetter as a first argument - even though it is a breaking change. The method shouldn't be used outside the fromJson-method so it should be safe to do this. Also, it will work for both cases (fluentSetter true/false).