FasterXML / jackson-jr

Stand-alone data-binding module designed as a light-weight (and -featured) alternative to `jackson-databind`: will only deal with "Maps, Lists, Strings, wrappers and Java Beans" (jr-objects), or simple read-only trees (jr-stree)
Apache License 2.0
242 stars 31 forks source link

Java 17 Record tests do not run (jackson-jr-test-module) #149

Closed cowtowncoder closed 5 months ago

cowtowncoder commented 5 months ago

Looks like tests added for #94 (and further #148) do not actually get run with 2.17/2.17: groovy tests do, java tests not. Need to figure out now.

At first thought use of JUnit5 was the problem (all other tests run on JUnit4) but that's not it. Maven module is not imported by Eclipse so I have limited visibility (can try with Idea next).

I wonder if Groovy and Java17 tests need to be separate into different modules, even.

cowtowncoder commented 5 months ago

/cc @Shounaks @TomaszGaweda

cowtowncoder commented 5 months ago

Started by renaming existing module as jr-groovy-test. Also noticed it was being published (even if as just pom.xml) -- that is wasteful and unnecessary, so will block that.

And it is necessary to separate out Records test as they can only run with JDK 17 -- and the way to do that (while still allowing other modules to build on JDK 8) is , I think, via Profiles (or play with toolchains or something else). At least jackson-databind does that. But I think I'll try to create separate Maven module for test(s) to avoid possible breakage of jr-objects.

cowtowncoder commented 5 months ago

Fixed so that test now run; under new jackson-jr-record-test module.

But one thing that I think it's wrong -- and I wish I had noticed it originally is that this:

JSON.builder().enable(JSON.Feature.USE_FIELD_MATCHING_GETTERS).build();

should NOT be needed; setting should be dynamically applied for Record types. I'll create separate issues for fixing this for serialization, and deserialization.