Unify Java harness validation error messages

Open
#872 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@weichieh0204 is already working on this.

Since Nov 26, 2026.

Assessment

This issue has not been assessed yet.

Description

Java harness validation errors include the exception class name, while the equivalent checks in C, C++, JavaScript and Python report the message alone. This follow-up covers the existing Java checks together rather than changing only the ancestor guard in #846.

At PR #846 head 5bdd0551268c4c3d8e55e7cc8776e688f533f70a, javaCase in web/compiler-explorer.js serializes caught exceptions with error.toString(). The ancestor guard therefore reports:

java.lang.IllegalArgumentException: Returned ancestor must be an original input node.

The other four runners report:

Returned ancestor must be an original input node.

Existing Java graph, list and tree validation checks use the same exception convention. Tests currently accommodate the prefix with endsWith. These observations are based on source inspection; no additional runtime reproduction was performed for this draft.

Introduce a dedicated harness-validation exception, such as the HarnessCheck suggested in the review comment, whose toString() returns only its message. Use it consistently for harness validation failures while preserving the exception class name for errors thrown by candidate code.

Acceptance criteria:

  • Equivalent harness refusals have exactly matching error text across the five runners, including ancestor identity, graph and list checks.
  • Candidate-thrown exceptions, including IllegalArgumentException, retain their class name and message.
  • Regression tests use exact equality for harness messages and cover candidate-thrown exceptions separately.
  • Valid answers, null-result handling and continuation after a per-case refusal retain their existing behavior.

Related work: #725 addresses null graph neighbors; #783 addresses Python and JavaScript runtime-error locations. This follow-up concerns Java harness error formatting.

Dominant language
Rust
Stars
236
Forks
153
Avg merge
1d 9h
Merged PRs (30d)
187

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sysprog21/codetrial

All issues in sysprog21/codetrial

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.