Skip to content

Make the models compile with JDK 25 - #49

Open
tautschnig wants to merge 1 commit into
masterfrom
kiro/jdk25
Open

tautschnig wants to merge 1 commit into
masterfrom
kiro/jdk25

Conversation

@tautschnig

@tautschnig tautschnig commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

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.

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).

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>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 21:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 cproverMonitorCount initialization from the Object constructor to its field declaration.
  • Comments out the call to the removed ClassLoader.checkClassLoaderPermission method.
  • 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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants