Repository navigation
Make the models compile with JDK 25 - #49
Open
tautschnig wants to merge 1 commit into
Open
tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
Building the models with JDK 25 (the default JDK on Ubuntu 26.04, and thus on GitHub's ubuntu-latest runners) fails with three errors: - Object.java: "flexible constructors is not supported in -source 8". java.lang.Object has no superclass, so javac 25 treats every statement in its constructor as part of a constructor prologue (JEP 513). Initialise cproverMonitorCount in its declaration instead. - Class.java: ClassLoader.checkClassLoaderPermission no longer exists. As the call was already passing null for the caller class, it did not check anything; comment it out like the original call. - URLEncoder.java: package sun.security.action does not exist. Read the file.encoding property with System.getProperty: doPrivileged has no effect without a security manager. With these changes the models build with JDK 11, 17 and 25. With JDK 17, the bytecode of Class differs only in the removed call and constant-pool indices, and that of Object only in the constructor no longer storing 0 to cproverMonitorCount, which is the default value of the field. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the JDK 25 compatibility changes.
No open issues 🎉
What changed in this PR
Updates the Java models for JDK 25 compilation, addressing compatibility issues that affect JBMC builds in CBMC’s CodeQL workflow.
Changes:
- Moves
cproverMonitorCountinitialization from theObjectconstructor to its field declaration. - Comments out the call to the removed
ClassLoader.checkClassLoaderPermissionmethod. - Replaces the internal privileged property lookup with
System.getProperty("file.encoding").
| File | Description |
|---|---|
src/main/java/java/net/URLEncoder.java |
Removes internal security imports and reads the encoding property directly. |
src/main/java/java/lang/Object.java |
Moves field initialization to avoid JDK 25 constructor compilation restrictions. |
src/main/java/java/lang/Class.java |
Disables a permission-check call unavailable in JDK 25. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building the models with JDK 25 (the default JDK on Ubuntu 26.04, and
thus on GitHub's ubuntu-latest runners) fails with three errors:
java.lang.Object has no superclass, so javac 25 treats every
statement in its constructor as part of a constructor prologue
(JEP 513). Initialise cproverMonitorCount in its declaration instead.
As the call was already passing null for the caller class, it did
not check anything; comment it out like the original call.
file.encoding property with System.getProperty: doPrivileged has no
effect without a security manager.
With these changes the models build with JDK 11, 17 and 25. With
JDK 17, the bytecode of Class differs only in the removed call and
constant-pool indices, and that of Object only in the constructor no
longer storing 0 to cproverMonitorCount, which is the default value of
the field.
CBMC's CodeQL workflow builds JBMC, including these models, on
ubuntu-latest, which is moving to Ubuntu 26.04 and thus JDK 25; it currently fails because of the first two of these errors (the version of the models that CBMC uses predates URLEncoder.java).