Using Jackson with Java 17

2,162 views
Skip to first unread message

Chris Kelley

unread,
Dec 2, 2021, 10:53:28 AM12/2/21
to jackson-user
Hello all!

TL;DR: Will updating the source/target to e.g. Java 1.8 cause problems?

I help package some of the jackson modules in Fedora. In F36 `java-17-openjdk` will be the default system JDK, so I need to make sure that all the packages I maintain will work with Java 17. Currently Fedora uses Java 11 as default and I have not seen any problems with jackson, so I am not expecting any problems with Java 17 either.

However, I see in the source that the source target of `jackson-core` and `jackson-annotations` is set to Java 1.6, for backwards compatibility reasons - this directive causes compilation failure with Java 17 as there is a requirement of Java 1.7+.

If I recompile with Java 1.8, 11 or 17 will the sky fall down? What is the reason for holding the source/target at 1.6?

Thanks in advance for any help/historical context/advice!





Michael Rogers

unread,
Dec 2, 2021, 11:49:28 AM12/2/21
to jackso...@googlegroups.com, Chris Kelley
Hi Chris,

I'm not a Jackson developer, just a list subscriber.

I think the issue here might be Android - specifically Android 6 and
older, which only support the Java 6 API. Any code that calls API
methods that are missing in Java 6 will crash at runtime on older
Android devices. Setting "-source 6 -target 6 -bootclasspath <path to
java 6 standard library>" makes it possible to detect these potential
crashes at compile time.

Starting with Java 9 I believe it's possible to use "--release 6"
instead, without needing a copy of the older standard library. But maybe
the minimum version for --release has been raised in Java 17, along with
the minimum for -source and -target?

Another potential issue with --release is that some people may still
want to compile with Java 8, which doesn't have that option.

If --release isn't feasible, another possibility would be to use Animal
Sniffer, which checks code for compatibility with a specific Java API
version at compile time. The project page says it's in maintenance mode
because --release now does the same job, but if we need to be able to
compile on everything from Java 8 (without --release) to Java 17 (which
may have a minimum --release 7) then maybe Animal Sniffer would still
have a niche?

http://openjdk.java.net/jeps/247

https://www.mojohaus.org/animal-sniffer/

Cheers,
Michael

On 02/12/2021 12:24, Chris Kelley wrote:
> Hello all!
>
> *TL;DR: Will updating the source/target to e.g. Java 1.8 cause problems?*
>
> I help package some of the jackson modules in Fedora. In
> F36 `java-17-openjdk` will be the default system JDK, so I need to make
> sure that all the packages I maintain will work with Java 17. Currently
> Fedora uses Java 11 as default and I have not seen any problems with
> jackson, so I am not expecting any problems with Java 17 either.
>
> However, I see in the source
> <https://github.com/FasterXML/jackson-annotations/blob/2.14/pom.xml#L44> that
> the source target of `jackson-core` and `jackson-annotations` is set to
> Java 1.6, for backwards compatibility reasons - this directive causes
> compilation failure with Java 17 as there is a requirement of Java 1.7+.
>
> If I recompile with Java 1.8, 11 or 17 will the sky fall down? What is
> the reason for holding the source/target at 1.6?
>
> Thanks in advance for any help/historical context/advice!
>
>
> *
> *
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jackson-user...@googlegroups.com
> <mailto:jackson-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jackson-user/d89f7760-7bde-471b-acb0-b8f24d4619c4n%40googlegroups.com
> <https://groups.google.com/d/msgid/jackson-user/d89f7760-7bde-471b-acb0-b8f24d4619c4n%40googlegroups.com?utm_medium=email&utm_source=footer>.
OpenPGP_0x11044FD19FC527CC.asc
OpenPGP_signature

Chris Kelley

unread,
Dec 6, 2021, 11:44:46 AM12/6/21
to jackso...@googlegroups.com
Thanks for the detailed information! I'll have a think about what is best to do.

You received this message because you are subscribed to a topic in the Google Groups "jackson-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jackson-user/1TU921jHWJg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jackson-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/31335422-877c-99da-a7f0-e0adfd9a0373%40briarproject.org.
Reply all
Reply to author
Forward
0 new messages