Repository navigation
Open
Description
Source-confirmed Java test/debug lifecycle defects (related to Ajaymamtora/dotfiles#229)
I reviewed the current adapter source and identified two independent correctness hazards. These are confirmed control-flow observations, not claims of reproduced real JDTLS/Gradle runtime failures.
- Compilation failure is ignored before debug/test launch. core/spec_builder/init.lua invokes
pcall(deps.compile, module.base_dir, compile_mode)and discards both the protected-call status and any explicit returned failure. The code proceeds to resolve the classpath and launch JUnit, potentially executing stale classes after failed compilation. - DAP result collection can await a test JVM indefinitely. core/result_builder.lua calls
spec.context.terminated_command_event.wait()without a visible timeout or cancellation path before reading JUnit XML. If the launch fails, the debugger disconnects early, or the process termination event is never emitted, the Neotest run may never finish.
Suggested focused fix
- Define a clear compilation success/failure contract, including whether deps.compile throws, returns false, or yields a result table. Propagate errors with actionable project/module context and never start a stale test binary after failure.
- Return an invocation-owned cancellable process handle for the Java test JVM. Bound the termination/report wait, distinguish expected normal debug completion from user cancellation and infrastructure errors, and terminate only this JVM.
- Use unique per-invocation report directories; reject missing/stale JUnit XML as infrastructure failure rather than accidental success/skip.
- Keep JDTLS workspace/Java Debug & Test bundle ownership with the existing adapter; do not add a second JVM debugger process manager.
Regression matrix
- Compile throws / reports false / missing JDTLS test bundle; assert no debug process launches.
- Java/JUnit 4 and 5 passing/failing tests with authoritative XML in both normal and debug modes.
- DAP attach fails before the test JVM starts; result future settles and owned tasks close.
- DAP disconnects while paused at a real Java breakpoint; test result is cancelled/infrastructure failure, not passed.
- Parameterized/nested JUnit, Gradle/Maven multi-module, concurrently launched tests (no report directory collisions), Windows wrapper.
- Verify no leftover test JVM, socket, listeners or temp report after termination.
A focused PR with fail-first fixture coverage would address this. The requester has read access but the connected GitHub integration does not have write access to this repository, so this issue is an upstream report, not a claim that the code was fixed or tested. The consuming dotfiles project will retain Java as unverified until its live acceptance passes.
Related: Ajaymamtora/dotfiles#229.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Ajaymamtora commentedon Nov 13, 2026
Additional source-level Java lifecycle blocker — launch can hang before Neotest even receives a RunSpec (13 Nov 2026)
Independent follow-up to the compile-failure and terminated-event observations in this issue. I inspected the current
lua/neotest-java/build_tool/launcher.lua,core/spec_builder/init.lua,core/result_builder.luaandlua/neotest-java/init.lua.Additional P0:
launch_debug_testcan wait indefinitely before returning. The default job runner startsvim.system(...)with an exit callback that only setsterminated_command_event;launch_debug_testthen callstest_command_started_listening.wait()without a deadline. The listening event is set exclusively when stdout contains the stringListening. If Java exits before printing that string (compilation/classpath/JUnit crash, executable launch failure), exits successfully without that exact text, writes readiness to stderr, or never starts listening,build_specstays suspended and never even reaches the Neotest DAP strategy. A DAP-side timeout is insufficient ifbuild_specis already blocked.Resource ownership:
default_job_runner.new(...).startcurrently discards thevim.system()return value, so the launch callback exposes no process handle to terminate during cancellation, timeout or editor shutdown.ResultBuilder.build_resultsawaitsterminated_command_event.wait()without a bound and then reads reports without verifying an invocation-owned process completion state. The report-folder generator inlua/neotest-java/init.luauses a timestamp of seconds (strftime("%d%m%y%H%M%S")), which can collide for concurrent or rapid same-module runs.Required owner-level fix (please do this in neotest-java, not a dotfiles monkey-patch):
stop(); retain a compatible public contract or provide an explicit migration. Do not throw away thevim.systemhandle.pcall(deps.compile, ...)failures and explicit false returns before classpath resolution/launch, so stale compiled classes cannot be used accidentally.Listening; exits zero beforeListening; no readiness text until timeout; readiness followed by a hanging process; cancel while awaiting attach; two concurrent runs; compile throws/returns false; missing/empty/stale reports. Assert exactly-once completion and no child JVM/port/file leaks.The connected account currently has read-only repository access to
rcasia/neotest-java, so this is an implementation blocker report, not a claim of a merged Java fix. The dependent dotfiles master #229 must continue marking Java unverified until there is a writable upstream/fork PR and actual runtime evidence.Ajaymamtora commentedon Nov 13, 2026
Verified fork resolution; upstream adoption still pending (13 Nov 2026)
This supersedes the earlier unverified / implementation-blocked status above for the owned fork, not for upstream
main.e9e1054c337e09606637a2d427bcaed79af5e444, integrating the exact tested head2d485463069a1b7401416ddcdbb02ce4ef8260e9.mainfixed; upstream maintainer review/merge is still required.Observed verification
Limits retained honestly
Windows runtime and live Maven multi-module JDTLS were not exercised. A forced-full Buildship build on a reopened workspace reported a prerequisite-project build-order error; compilation was correctly rejected rather than silently executing stale classes. The normal/default incremental workflow passed both complete live gates. These limits are not blanket certification of the entire suggested platform matrix.
The consuming project can now pin the verified merged fork; upstream #342 remains open pending upstream adoption.