Fix tests, build, and support Id.MINIMAL_CLASS, and Id.SIMPLE_NAME #1073
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
I have been using this library for years, and I use Tagged Unions extensively.
I have some situations where I have many sub-classes, and I would like to make writing code as compact and concise as possible.
Jackson supports different kinds of
use=Idvariants, however, onlyNAME, andCLASSare supported.I originally tried to get
MINIMAL_CLASS, and Jacksin 2.18'sSIMPLE_NAMEto work, however, I had problems with running the existing tests and building due to immutables not being on the compilation annotation path, and the fact that Java12+ isn't supported.Fixed the immutables error by adding the annotation to the compilation path (this shouldn't affect the end jar).
Made building the project more error-obvious by introducing MavenEnforcer to demand it be built with Java 11.
Now that building and testing is easier, a Kotlin test is introduced (to allow testing for sealed things, as we are not building in Java17+ yet).
This allows us to write more minimal effort definitions like:
And if we are using Jackson 2.18+, we can use Id.SIMPLE_NAME as well.
It does this by, instead of detecting supported Id types, it detects non-compatible Id types, like
CUSTOM,NONE, andDEDUCTION, which is a more forward compatible method.Without this, one would need to annotate every class with
@JsonTypeName(...)in the case ofId.NAME, or be stuck with the full class:Id.CLASS.