Skip to content

fix(java): newer zulu versions use a different directory structure#9365

Merged
jdx merged 1 commit intojdx:mainfrom
roele:issues/9337
Apr 24, 2026
Merged

fix(java): newer zulu versions use a different directory structure#9365
jdx merged 1 commit intojdx:mainfrom
roele:issues/9337

Conversation

@roele
Copy link
Copy Markdown
Contributor

@roele roele commented Apr 24, 2026

Addresses issues with new packaging of Zulu Java versions for macOS as mentioned in #9337

Copilot AI review requested due to automatic review settings April 24, 2026 17:43
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

This PR fixes Java installation for newer Zulu versions on macOS, which ship with a flat Contents/Home directory structure instead of the nested zulu-{major}.jdk/Contents/Home layout used in older releases. The source_dir selection is now driven by filesystem introspection (Contents/Home.is_dir()) rather than a vendor/OS match, and the zulu-{major}.jdk/Contents symlink creation is now gated on whether that path actually exists — making the install logic forward-compatible with both old and new packaging layouts.

Confidence Score: 4/5

Safe to merge for the Zulu fix, but the implicit behavior change for Liberica on macOS (flagged in previous threads) is worth confirming before landing.

The fix correctly addresses new-style Zulu macOS packaging and gracefully handles both layouts via filesystem probing. No new regressions are introduced beyond the Liberica side-effect already discussed in previous review threads. Score held at 4 until the Liberica behavior change is explicitly confirmed as intentional or a Liberica-specific guard is added.

src/plugins/core/java.rs — specifically the source_dir logic around line 162 and how it interacts with Liberica macOS tarballs.

Important Files Changed

Filename Overview
src/plugins/core/java.rs Two-part fix: (1) source_dir now uses Contents/Home for any vendor on macOS when that directory exists (instead of only for non-zulu/non-liberica vendors), and (2) Zulu's zulu-{major}.jdk/Contents symlink creation is now guarded so it is only created when the nested path exists and Contents is not already present — accommodating new flat-layout Zulu tarballs.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[move_to_install_path] --> B{os == macosx AND\nContents/Home is dir?}
    B -- Yes --> C[source_dir = basedir/Contents/Home\nnew-style flat layout]
    B -- No --> D[source_dir = basedir\nclassic layout]
    C --> E[Move source_dir entries\nto install_path]
    D --> E
    E --> F{cfg macos?}
    F -- Yes --> G[handle_macos_integration\nwith basedir/Contents]
    F -- No --> Z[Done]
    G --> H{basedir/Contents exists?}
    H -- Yes --> I[Move non-Home entries\nto install_path/Contents]
    I --> J[Symlink install_path/Contents/Home\n→ install_path]
    H -- No --> K{vendor == zulu?}
    J --> K
    K -- Yes --> L{zulu-N.jdk/Contents exists\nAND install_path/Contents absent?}
    L -- Yes --> M[Symlink install_path/Contents\n→ install_path/zulu-N.jdk/Contents\nold-style Zulu only]
    L -- No --> N[Skip symlink\nnew-style Zulu]
    K -- No --> Z
    M --> Z
    N --> Z
Loading

Reviews (2): Last reviewed commit: "fix(java): newer zulu versions use a dif..." | Re-trigger Greptile

Comment thread src/plugins/core/java.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Java core plugin’s macOS install logic to better handle Zulu JDK tarballs whose extracted directory layout differs across newer versions (issue #9337), avoiding incorrect moves and failing symlink operations.

Changes:

  • Detect and use Contents/Home as the extraction source directory on macOS when present (instead of vendor-based branching).
  • Make the Zulu Contents symlink creation conditional on the expected directory existing and the link not already being present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Java plugin's logic for determining the installation source directory on macOS, moving from a vendor-specific check to a path existence check for 'Contents/Home'. It also updates the Zulu-specific symlinking process to include safety checks and simplifies version string parsing. Review feedback suggests using is_dir() instead of exists() for more explicit directory validation and simplifying the major_version extraction logic.

Comment thread src/plugins/core/java.rs Outdated
Comment thread src/plugins/core/java.rs Outdated
@jdx jdx merged commit 16acdc8 into jdx:main Apr 24, 2026
34 checks passed
@roele roele deleted the issues/9337 branch April 24, 2026 18:51
mise-en-dev added a commit that referenced this pull request Apr 25, 2026
### 🚀 Features

- **(registry)** add --security flag to include security info in JSON
output by @jdx in [#9364](#9364)

### 🐛 Bug Fixes

- **(config)** limit resolved backend opts to aliases by @risu729 in
[#9315](#9315)
- **(docs)** stack banner message and link on mobile by @jdx in
[#9362](#9362)
- **(github)** prefer shortest asset name as tiebreaker in
auto-detection by @jdx in [#9361](#9361)
- **(java)** newer zulu versions use a different directory structure by
@roele in [#9365](#9365)
- **(prune)** respect tracked lockfiles by @jdx in
[#9373](#9373)
- **(task)** skip tool install for missing naked tasks by @jdx in
[#9374](#9374)
- **(trust)** add untrust command by @jdx in
[#9370](#9370)
- fix - flux-operator-mcp aqua path by @monotek in
[#9357](#9357)

### 📚 Documentation

- update ruby compile msg by @fladson in
[#9338](#9338)

### 📦️ Dependency Updates

- update ubuntu docker tag to v26 by @renovate[bot] in
[#9347](#9347)
- update ghcr.io/jdx/mise:deb docker digest to 1af5a69 by @renovate[bot]
in [#9352](#9352)
- update taiki-e/install-action digest to 787505c by @renovate[bot] in
[#9354](#9354)
- update ghcr.io/jdx/mise:rpm docker digest to 7015ff3 by @renovate[bot]
in [#9353](#9353)
- update ghcr.io/jdx/mise:copr docker digest to da63a0f by
@renovate[bot] in [#9351](#9351)
- update ghcr.io/jdx/mise:alpine docker digest to 461700f by
@renovate[bot] in [#9350](#9350)
- bump communique 1.0.3 → 1.0.4 by @jdx in
[#9378](#9378)

### 📦 Registry

- remove openshift-install by @jdx in
[#9372](#9372)
- remove go-sdk by @jdx in
[#9371](#9371)

### Chore

- **(npm-publish)** use aube publish instead of npm publish by @jdx in
[#9328](#9328)

### New Contributors

- @fladson made their first contribution in
[#9338](#9338)
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.

4 participants