Skip to content

Fix build scripts and HoverTest for Java 21#20

Open
melsiir wants to merge 1 commit intoidelice:masterfrom
melsiir:feature/java21-fix
Open

Fix build scripts and HoverTest for Java 21#20
melsiir wants to merge 1 commit intoidelice:masterfrom
melsiir:feature/java21-fix

Conversation

@melsiir
Copy link
Copy Markdown

@melsiir melsiir commented Mar 6, 2026

Changes

1. HoverTest.java fixes

Issue: contents is typed as Object in recent LSP4J versions, so the for-each loop and h.value fail to compile.

2. build.sh improvements

The old build script blindly download jdk for every os so I made changes to only download for the current os only if necessary
Detect system Java:
If $JAVA_HOME exists and Java ≥ 21 → skip all JDK downloads
Otherwise → download only the JDK for the current OS
Run only the OS-specific link script (Linux/macOS/Windows) instead of all three.

3. link scripts (link_linux.sh, link_mac.sh)

Detect and use $JAVA_HOME if Java ≥ 21
Fallback to downloaded JDK for the OS if system Java is missing or too old
Normalize jlink paths so scripts work consistently across environments

Benefits

Hover tests compile successfully with modern LSP4J
Builds are faster and OS-aware, avoiding unnecessary downloads
Reduces network usage and avoids running irrelevant link scripts
Maintains compatibility across Linux, macOS, and Windows

@idelice
Copy link
Copy Markdown
Owner

idelice commented Mar 21, 2026

please rebase

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