jackson-module-scala icon indicating copy to clipboard operation
jackson-module-scala copied to clipboard

add Automatic-Module-Name

Open pjfanning opened this issue 3 years ago • 5 comments

https://github.com/sbt/sbt/issues/3368 and maybe other factors seem to have lead to a lack of interest in supporting Jigsaw modules in Scala projects. I've seen reports of jackson-module-scala being used in some Java projects though and maybe adding an Automatic-Module-Name to the manifest.mf would be a good starting point.

pjfanning avatar Feb 26 '22 09:02 pjfanning

One thing I would recommend is that if adding Automatic-Module-Name first, try to make sure that move to "real" module name later on will not break things. My impression is that this can be tricky. I wish I had more specific suggestion to give.

I usually refer to @GedMarc on module knowledge, maybe he could help here. Change would go in 2.14.0.

cowtowncoder avatar Feb 26 '22 19:02 cowtowncoder

I have already added Automatic-Module-Name: com.fasterxml.jackson.module.scala on branch 2.14 and master but can remove it that is a bad idea - the module name seems like an ok one (consistent with the names of other jackson modules).

pjfanning avatar Feb 26 '22 19:02 pjfanning

I will defer this to you @pjfanning -- could maybe ask on jackson-dev mailing list.

Ideally I think regular module info would be nicer of course, but I don't know if Moditect usage works via SBT; I think there was no way to do that when it was briefly discussed earlier. So maybe AMN is the best compromise here.

cowtowncoder avatar Feb 26 '22 19:02 cowtowncoder

@pjfanning it looks like you're going to need to wait a while longer - https://github.com/scala/scala-dev/issues/139

Specifically nothing under JSE-251 has been implemented in scala, adding a module-info file will actually break it all, or simply just be ignored

Multi-Release jars still not supported, Runtime images not supported, so while adding automatic module name, might be doing something, it's certainly not doing what you think it is, with no support on the platform as yet -

Sure it builds, but what is it actually doing hmmm

The Scala compiler does not enforce the restrictions of the Java Platform Module System, which means that code that typechecks may incur linkage errors at runtime. Scala 2.13.x will eventually provide rudimentary support for this (perhaps only in nightlies built on JDK 11).

I wouldn't recommend doing this, based on the state of scala, I wouldn't infer modularity on Scala until version 3 comes out, the results will be very erratic

GedMarc avatar Feb 26 '22 23:02 GedMarc

@GedMarc thanks for advice. I'm aware that Scala users have little interest in Jigsaw - this issue is/was to facilitate any Java users who are. I have reverted the changes for now and will wait to see if there is general need for any Jigsaw support.

pjfanning avatar Feb 27 '22 11:02 pjfanning