jjwt
jjwt copied to clipboard
[#719] JSON-B extension.
Fixes #719:
This commit will add a JSON-B extension based on JSON-B specification 1.0.2.
Noteworthy
- Since this specification uses Java 8 features (static methods in interfaces), the property
jdk.versionwas set to8. - Since we now use Java 8, there is little advantage in using custom assertions, this
nullinput is validated byjava.util.Objcets.requireNonNulland will throw aNullPointerException(which makes more sense anyway) instead of anIllegalArgumentException. - Instead of
Strings.UTF_8the JDK8-includedStandardCharsets.UTF_8was used. - I used Johnzon for testing, but only because it is an Apache project. It should work with Eclipse Yasson without any changes. If desirable, I could implement a maven profile for this – or even better, an IT project (e.g.
intergation-tests/json/jsonb-yassonandintergation-tests/json/jsonb-sth-else). - The (
provided) dependency on json-api (aka json-p for JSON-Parser) is needed at least for Johnzon, but probably for some Exceptions as well. Johnzon fails becausejavax.json.JsonExceptionis missing. But since json-api/json-p is a transitive dependency for json-bind-api (json-b) as well, this should be okay.
Other notes
- The
providedscope is because of JakarteEE Application Server usage. Tested on OpenLiberty. But for JavaSE apps, users of this lib would need to include those by hand, as well as the implementation. This should go into the README.
Tasks
- [X] Added implementation.
- [X] README.md updated.
- [X] Added notice about JavaSE vs JakartaEE environments and their ([not-]provided) dependencies.
- [X] Added "when-to-use" note.
Great work!
Oh, shouldn’t the profile name be "nonJDK7"? And did I, by accident, not rebase the PR?
good point, java8plus, nonJDK7 or something like that would work
good point, java8plus, nonJDK7 or something like that would work
Nah you already have "nonJDK7" in your root-pom.xml.
I will rebase this PR later when I have a first version of my modules-PR available. I finished it yesterday evening but didn’t push it yet, just a moment.