FasterXML / jackson-databind

General data-binding package for Jackson (2.x): works on streaming API (core) implementation(s)
Apache License 2.0
3.52k stars 1.38k forks source link

module-info class lost during 2.18 version #4727

Open bwzhang2011 opened 1 week ago

bwzhang2011 commented 1 week ago

Search before asking

Describe the bug

module info lost during the release since jackson-databind 2.18.0 version while correct in early version released like 2.17.2. notice that 2.17.2 is correct for databind core and annotation package. I recommend new deployed version to be released which could help the upgration of jacskon

Version Information

2.18.0

Reproduction

<-- Any of the following

  1. Brief code sample/snippet: include here in preformatted/code section
  2. Longer example stored somewhere else (diff repo, snippet), add a link
  3. Textual explanation: include here -->
    // Your code here

Expected behavior

no error while import module class support

Additional context

No response

pjfanning commented 1 week ago

Can you give more details? The issue is in jackson-databind 2.18.0 jar and only that jar?

I downloaded jackson-databind 2.18.0 jar and it has:

 1496  09-26-2024 18:56   META-INF/versions/9/module-info.class
AndreasWBartels commented 1 week ago

compile with maven 3.9.5 (and newer) with jdk21 works (openjdk and temurin)

eclipse does not seem to be able to handle the multi version jar which it can with 2.17.2.

tested with eclipse 2024-03 and 2024-09

there is a similar issue on eclipse.jdt.core for gson

GedMarc commented 1 week ago

That is 100% an eclipse problem,

Also found animal sniffer doesn't like compiles into alternative versions, e.g. jdk11 compiling into versions/17 , throws a java error - Same issue, the location of /9 is correct as well, This is internal to eclipse.

pjfanning commented 1 week ago

jackson-core is a Multi-Release jar - not jackson-databind

I agree with @GedMarc that this does not appear to be an issue in jackson-core/jackson-databind and that issue is in tooling that users are using. @bwzhang2011 provided very little detail on what their issue is.

cowtowncoder commented 1 week ago

Not sure if this might be related to a jackson-core fixed issue https://github.com/FasterXML/jackson-core/issues/1340.

Either way description is too incomplete to be actionable; closing. May be re-opened or re-filed with more information; in particular showing how to reproduce the issue.

EDIT: as per @GedMarc that issue appears unrelated to whatever issue was here.

AndreasWBartels commented 1 week ago

This is a moditect issue https://github.com/moditect/moditect/issues/254

Which unfortunately makes it a jackson issue, because you should either downgrade or upgrade as soon as the issue for moditect is fixed.

pjfanning commented 1 week ago

https://github.com/moditect/moditect/commit/5d63f7bfce19dbf9d17fa122a758ac2e88f93e6f seems to be in every release since 1.2.0.Final so maybe the best course of action is to downgrade to moditect 1.1.0 in all Jackson repos - 2.18 branches.

https://mvnrepository.com/artifact/org.moditect/moditect/1.1.0

pjfanning commented 1 week ago

@AndreasWBartels Thanks for the analysis. Moditect is a pretty widely used tool and the commit that you highlight appears to have been in 3 releases of Moditect in the last 6 months. The internet is not ablaze with people complaining about broken jars. My vote would be to use an old version of Moditect until a fix is made - but that there is no reason to rush out a Jackson release.

Users can stick to older Jackson releases if they think they might be affected by this.

cowtowncoder commented 6 days ago

Uggggh. Moditect downgrade is tricky since if I recall it comes via parent poms. And verification of newer versions, once available, seems difficult.

But if we have to, we have to.

GedMarc commented 6 days ago

I'll update the jdk11 compat test to 2.18, should be able to add a test case there, Will check on moditect as well

cowtowncoder commented 5 days ago

Ok. So, if I understand this correctly, the problem reported as https://github.com/moditect/moditect/issues/254 ONLY affects jackson-core and NOT jackson-databind or other Jackson components (or at least not many).

If so, I think the safest patch would be to override plugin version just for jackson-core and not via oss-parent.

Does this make sense? My concern with oss-parent change is mostly that there may be fixes in Moditect (plugin) 1.2 that we'd roll back if downgrading generally. And also, to a degree, the fact that oss-parent is not well versioned to align with Jackson components so changes should be incremental.

But most importantly: is the issue -- as far as we understand it -- limited to jackson-core only?

AndreasWBartels commented 5 days ago

The problem affects all modules that only add module-info.java, i.e. jackson-databind, jackson-databind-jsr310.

jackson-core adds classes for different versions, which indirectly solves the problem.

$ less jackson-core/2.18.0/jackson-core-2.18.0.jar

5235 Defl:N 2457 53% 2024-09-26 18:41 456dff2e com/fasterxml/jackson/core/util/VersionUtil.class 137 Defl:N 119 13% 2024-09-26 18:41 7bb3a2d5 com/fasterxml/jackson/core/util/package-info.class 0 Defl:N 2 0% 2024-09-26 18:41 00000000 META-INF/maven/ 0 Defl:N 2 0% 2024-09-26 18:41 00000000 META-INF/maven/com.fasterxml.jackson.core/ 0 Defl:N 2 0% 2024-09-26 18:41 00000000 META-INF/maven/com.fasterxml.jackson.core/jackson-core/ 12964 Defl:N 3143 76% 2024-09-26 18:41 d1a50ac1 META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml 74 Defl:N 67 10% 2024-09-26 18:41 20136f0d META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties > 0 Defl:N 2 0% 2024-09-26 18:41 00000000 META-INF/versions/ 0 Defl:N 2 0% 2024-09-26 18:41 00000000 META-INF/versions/9/ 748 Defl:N 291 61% 2024-09-26 18:41 d11640ca META-INF/versions/9/module-info.class 1999 Defl:N 747 63% 2024-09-13 12:50 03a7944a META-INF/FastDoubleParser-NOTICE 3047 Defl:N 1424 53% 2024-09-13 12:50 f319319f META-INF/thirdparty-LICENSE 0 Defl:N 2 0% 2024-09-13 12:50 00000000 com/fasterxml/jackson/core/internal/ 0 Defl:N 2 0% 2024-09-13 12:50 00000000 com/fasterxml/jackson/core/internal/shaded/ 0 Defl:N 2 0% 2024-09-13 12:50 00000000 com/fasterxml/jackson/core/internal/shaded/fdp/

$ less jackson-databind/2.18.0/jackson-databind-2.18.0.jar

18148 Defl:N 7178 60% 2024-09-26 18:56 c00f3bee com/fasterxml/jackson/databind/util/internal/PrivateMaxEntriesMap.class 150 Defl:N 128 15% 2024-09-26 18:56 602f1aeb com/fasterxml/jackson/databind/util/internal/package-info.class 141 Defl:N 122 14% 2024-09-26 18:56 9962f878 com/fasterxml/jackson/databind/util/package-info.class 21547 Defl:N 5219 76% 2024-09-26 18:56 12ca3bf1 META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml 78 Defl:N 73 6% 2024-09-26 18:56 6fa4ab13 META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.properties > 1496 Defl:N 487 67% 2024-09-26 18:56 6f852290 META-INF/versions/9/module-info.class


4388303 1477165 66% 827 files

cowtowncoder commented 4 days ago

@AndreasWBartels ahhhhh. Ok, so the reverse of what I thought. This is... unfortunate to say the least.

In that case, need to consider placement. oss-parent may make sense, then... although jackson-parent could work too (or for most components, jackson-base).

pjfanning commented 4 days ago

The real fix here is to get Eclipse to fix JDT.

cowtowncoder commented 4 days ago

I agree wrt @pjfanning 's comment. But in the meantime maybe https://github.com/FasterXML/oss-parent/pull/179 is worth considering.