Terracotta-OSS / terracotta-platform

http://terracotta.org
Apache License 2.0
32 stars 48 forks source link

[master] Json refactoring (step 1/2 - isolating Jackson from our code) #1145

Closed mathieucarbou closed 1 year ago

mathieucarbou commented 1 year ago

This refactoring is a first step required to switch to Gson, but also anyway a good refactoring to have in order to isolate Jackson from our code and reduce the direct dependencies we have on it.

mathieucarbou commented 1 year ago

(rebased)

mobasherul commented 1 year ago

This refactoring is a first step required to switch to Gson, but also anyway a good refactoring to have in order to isolate Jackson from our code and reduce the direct dependencies we have on it.

  • Introduced Terracotta Json API (currently implemented by Jackson)
  • Isolate Jackson classes from Terracotta code:

    • no direct imports anymore
    • The use of Jackson specific mixins and such are isolated in a *.json package
  • Refactored Sanskrit to get rid of its coupling with Jackson classes
  • Added a Workaround in NomadChange json serialisation due to a bug in how Jackson is handling polymorphism serialisation

@mathieucarbou When moving to some other json library then mixin present in *.json package in all the affected modules will still need to be changed right ?

mathieucarbou commented 1 year ago

This refactoring is a first step required to switch to Gson, but also anyway a good refactoring to have in order to isolate Jackson from our code and reduce the direct dependencies we have on it.

  • Introduced Terracotta Json API (currently implemented by Jackson)
  • Isolate Jackson classes from Terracotta code:

    • no direct imports anymore
    • The use of Jackson specific mixins and such are isolated in a *.json package
  • Refactored Sanskrit to get rid of its coupling with Jackson classes
  • Added a Workaround in NomadChange json serialisation due to a bug in how Jackson is handling polymorphism serialisation

@mathieucarbou When moving to some other json library then mixin present in *.json package in all the affected modules will still need to be changed right ?

Yes! This PR is just isolating all the TC code from Jackson. Currently in platform all the Jackson imports are everywhere. TC code is tightly coupled with Jackson.

This PR (1/2) is a first step: it isolates jackson imports in:

Then, when converting to Gson, only rewriting those impl will be required because all the TC code now depends on the new TC Json API I introduced here.

Next PR (2/2) will switch the Json Factory impl and these mpdules to Gson.

mathieucarbou commented 1 year ago

(rebased)