Skip to content

Scala module (Jackson 3.x): some work needed wrt JSTEP-4 (unchecked exceptions)ย #494

Closed

Description

@cowtowncoder

So, as per email I sent on jackson-dev, there is work for JSTEP-4 (https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-4), in particular:

FasterXML/jackson-databind#2177

and I intend to merge changes to master of most repos soon (January 19th, 2021), with force publish to get 3.0.0-SNAPSHOT. Right now changes are on exp/jstep-4-for-3.0 branches of affect repos, most notably for jackson-core and jackson-databind.

This issue is just created for coordination: I will update details once I merge changes. Not the ideal mechanism for sure, but hope it's better than mailing lists at least.

Activity

  1. added
    3.xSomething that likely has to be done in 3.x, not 2.x
    on Jan 19, 2021
  2. changed the title [-]Scala 3: some work needed wrt JSTEP-4 (unchecked exceptions)[/-] [+]Scala module (Jackson 3.x): some work needed wrt JSTEP-4 (unchecked exceptions)[/+] on Jan 19, 2021
  3. cowtowncoder commented on Jan 20, 2021

    @cowtowncoder
    MemberAuthor

    Changes mentioned have now been made and a new 3.0.0-SNAPSHOT of core components published.

    In most cases changes needed should be simply either replacing "throws IOException" (and similar) with "throws JacksonException", or just removing (since exceptions are now unchecked): I have tried to indicate likeliest base exception for documentation purpose.

  4. pjfanning commented on Jan 20, 2021

    @pjfanning
    Member

    scala does not force you to explicitly deal with exceptions -- it's almost like it treats every exception as a RuntimeException

    so far, there are no issues with jackson-module-scala -- no new compile problems or additional test failures

  5. cowtowncoder commented on Jan 20, 2021

    @cowtowncoder
    MemberAuthor

    @pjfanning Excellent. Thank you for verification. I should be able to check this on my end too, just hadn't had time to see (still have some loose ends wrt JAX-RS).

  6. pjfanning commented on Jan 26, 2021

    @pjfanning
    Member

    @cowtowncoder I updated a few compilation issues due to rename of getCurrentToken to currentToken.

    These 5 issues still exist in main source (and others likely to exist in test source).

    [info] compiling 60 Scala sources and 1 Java source to /Users/pj.fanning/code/jackson-module-scala/target/scala-2.13/classes ...
    [error] /Users/pj.fanning/code/jackson-module-scala/src/main/scala/com/fasterxml/jackson/module/scala/deser/EitherDeserializer.scala:53:22: value nextFieldName is not a member of com.fasterxml.jackson.core.JsonParser
    [error]         val key = jp.nextFieldName()
    [error]                      ^
    [error] /Users/pj.fanning/code/jackson-module-scala/src/main/scala/com/fasterxml/jackson/module/scala/ser/EitherSerializer.scala:106:10: value writeFieldName is not a member of com.fasterxml.jackson.core.JsonGenerator
    [error]     jgen.writeFieldName(field)
    [error]          ^
    [error] /Users/pj.fanning/code/jackson-module-scala/src/main/scala/com/fasterxml/jackson/module/scala/ser/EnumerationSerializerModule.scala:30:10: value writeStringField is not a member of com.fasterxml.jackson.core.JsonGenerator
    [error]     jgen.writeStringField("enumClass", enumClass)
    [error]          ^
    [error] /Users/pj.fanning/code/jackson-module-scala/src/main/scala/com/fasterxml/jackson/module/scala/ser/EnumerationSerializerModule.scala:31:10: value writeStringField is not a member of com.fasterxml.jackson.core.JsonGenerator
    [error]     jgen.writeStringField("value", value.toString)
    [error]          ^
    [error] /Users/pj.fanning/code/jackson-module-scala/src/main/scala/com/fasterxml/jackson/module/scala/ser/TupleSerializerModule.scala:15:40: value writeObject is not a member of com.fasterxml.jackson.core.JsonGenerator
    [error] did you mean writeObjectId?
    [error]     value.productIterator.foreach(jgen.writeObject _)
    [error]                                        ^
    [error] 5 errors found
    [error] (Compile / compileIncremental) Compilation failed
    [error] Total time: 77 s (01:17), completed 26-Jan-2021 12:12:37
    
  7. cowtowncoder commented on Jan 26, 2021

    @cowtowncoder
    MemberAuthor

    @pjfanning Thanks, apologies for lag in fixing these -- I hope to be done with streaming-level changes soon.

    Fixes for these are:

    • writeFieldName() -> writeName() (big effort to remove refs to "field"; in most cases becomes "property" if not eliminated like here)
    • nextFieldName() -> nextName() similarly
    • writeXxxField() -> writeXxxProperty() (writeStringProperty()) here
    • writeObject() -> writePOJO() (since "Object" elsewhere refers to JSON Object type, but writeObject() is to serialize Java Objects (aka POJOs).
  8. pjfanning commented on Jan 31, 2021

    @pjfanning
    Member

    closing in favour if #431 - builds are passing (although a few tests that work in jackson 2 have been disabled for a while)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.xSomething that likely has to be done in 3.x, not 2.x

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions