Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle 7.6.3 fails to incrementally compile when the classpath contains a multi-release jar with a Java 21 class #27856

Closed
CRogers opened this issue Jan 29, 2024 · 2 comments
Assignees
Labels
a:bug in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures
Milestone

Comments

@CRogers
Copy link

CRogers commented Jan 29, 2024

Current Behavior

Jackson 2.16.1's jackson-core library is a multi-release jar containing a Java 21 (class file major version 65) class:

META-INF/versions/21/com/fasterxml/jackson/core/io/doubleparser/FastDoubleSwar.class

On Gradle 7.6.3, when this library is included in the classpath that is sent to the Java compiler, it fails to incrementally compile:

[INFO] [org.gradle.api.internal.tasks.compile.incremental.SelectiveCompiler] Full recompilation is required because FastIntegerMath.class could not be analyzed for incremental compilation. See the debug log for more details. Analysis took 0.439 secs.

(I could not see more details in the debug log)

Projects that used to recompile in seconds now take minutes, which destroys devex.

Expected Behavior

Incremental compilation continues to work when multi-release jars contain classes that are too high for Gradle to understand.

Under the scenes, I would expect these classes to be ignored like, in the multi-release jar fixes for the plugin classpath instrumentation (#27633).

Either that, or merely bumping asm may be enough as temporary fix.

Context (optional)

The context is the same for the plugin classpath issue: #27156 (comment) (please read).

Summary: We are in the middle of an immense Gradle 7 -> Gradle 8 migration. As a customer of a number of governments, we must keep libraries updated when there are CVEs (this is our sad compliance reality). A CVE could force us to upgrade Jackson at any time. This would cause all projects still on Gradle 7 to lose incremental compilation, hugely damaging devex. It's not quite as bad as the plugin classpath issue, but still not good.

Unless this had been fixed in Gradle 8, current and future versions of Gradle will also have the same problem for multi-release jars for future versions of java. Ideal would be fixing it similar to the plugin classpath instrumentation fixes to stop this happening in the future.

Gradle 7.6.4 has not be released yet - would it be possible to slip in a fix for this too? Even if it's just an asm bump, that would buy us plenty of time.

Steps to Reproduce

Run repro.sh in this repo: https://github.com/CRogers/gradle-7.6.3-inc-compilation-jackson

Gradle version

7.6.3

Build scan URL (optional)

No response

Your Environment (optional)

No response

@ljacomet ljacomet added closed:duplicate Duplicated or superseeded by another issue in:instrumentation in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures and removed to-triage closed:duplicate Duplicated or superseeded by another issue in:instrumentation labels Jan 30, 2024
@ljacomet ljacomet added this to the 7.6.4 milestone Jan 30, 2024
@ljacomet
Copy link
Member

Thank you for taking the time to report this

It makes sense to include an ASM version bump in the 7.6.4 release to me.

@ov7a ov7a self-assigned this Jan 31, 2024
@ov7a
Copy link
Member

ov7a commented Jan 31, 2024

Fixed in #27868 and will be included in 7.6.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures
Projects
None yet
Development

No branches or pull requests

3 participants