Repository navigation
Description
Summary
The first Java fence runs in JShell but does not compile inside an otherwise ordinary main because Pane.run declares InterruptedException. All six imports are already present.
Motivation
A reader copying the first example into a conventional application can see the necessary enclosing method declaration or exception handling.
- Developer experience — The first application build produces an unhandled checked-exception diagnostic.
- Immediate benefit — One enclosing declaration was sufficient on each tested JDK.
- Longer-term benefit — First-use documentation should match common javac and REPL entry points.
- End-user experience — A successful application run prints no confirmation unless the reader prints the returned values.
Evidence
On JDK 25, 26 and 27, javac rejected an ordinary main at pane.run. Adding throws InterruptedException outside the unchanged block compiled and ran on all three. Stock JShell worked on all three.
Steps, versions and observations
Run these steps from a checkout of ddcf8d2ff8761c5ea81291c0882007f786be778d unless a step explicitly identifies a released artifact. The release-tag links below identify code or a baseline at v0.1.2 (e8a39689). The observed behavior is attributed to the tested revision or artifact.
Audited revision ddcf8d2ff8761c5ea81291c0882007f786be778d. Linux ARM64, matched tmux 3.8, JDK 25/26/27, pinned core.
- In a clean clone of the public repository, check out the revision under test. Use a JDK 25 launcher, the JDK named below for tests, and tmux on PATH.
git clone https://github.com/libtmux/libtmux-java.git && cd libtmux-java
git checkout ddcf8d2ff8761c5ea81291c0882007f786be778d- Extract the exact public fence and compile it twice with only the surrounding method’s throws clause changed. The first javac invocation is expected to fail. This compile-only reproduction starts no tmux server.
./gradlew :libtmux:jar
CORE=$(find "$PWD/libtmux/build/libs" -name 'libtmux-*.jar' ! -name '*-sources.jar' ! -name '*-javadoc.jar' | head -1)
mkdir -p /tmp/libtmux-java-test
D=$(mktemp -d /tmp/libtmux-java-test/q.XXXXXX)
python3 - "$D" <<'PYTHON'
from pathlib import Path
import sys
d=Path(sys.argv[1])
sample=Path('README.md').read_text().split('```java\n',1)[1].split('```',1)[0]
imports,body=sample.split('\n\n',1)
for name,clause in [('Plain',''),('Declared',' throws InterruptedException')]:
(d/(name+'.java')).write_text(imports+'\nclass '+name+' {public static void main(String[] args)'+clause+' {\n'+body+'}}\n')
PYTHON
javac -cp "$CORE" "$D/Plain.java"
javac -cp "$CORE" "$D/Declared.java"Three independent native clients verified the demo/build pane identity, output and status. All three stock owned servers cleaned up correctly. The unchanged example reads the accessors without printing their values.
Proposal
Options to evaluate.
- Show throws InterruptedException on a minimal main or mention it beside the snippet.
- If visible output is intended, print the accessor values.
References
- README first Java block at ddcf8d2f
- README first Java block at v0.1.2
- Checked exception at ddcf8d2f
- Checked exception at v0.1.2
Maven Central verification
The README at ddcf8d2f selects io.github.libtmux:libtmux:0.1.2. The released core JAR has no Server.start(). A throws clause alone fixes the checkout example and leaves a released-artifact reader with a missing method. The published JAR checksum is 1b866c7389daa212069c8b90b0458e197113ad49.
The interactive README draft opens a private socket using the released builder and types a name into a shell. A source-file launch and JShell both printed hello from libtmux and exit 0. A reviewer repeated the released-JAR run with tmux 3.3a, 3.4 and 3.8. Each run removed the directory it owned. Changing the typed name failed the automated output assertion.
Activity