Run on modern JDKs and jgit: Thread.stop, commit signing, console noise#528
Conversation
LessonRunner.stopAll(): Thread.stop() (deprecated for removal) made PLM's in-process recompilation of its framework sources fail on recent JDKs, so no Java exercise could run; use cooperative Thread.interrupt() instead. GitUtils: when the user's git config enables commit.gpgsign, jgit failed to sign PLM's internal tracking commits (ServiceUnavailableException) and dumped a stack trace to the console on every run; setSign(false) on them. LoggerPanel: show only compilation errors, not the deprecation/unchecked warnings from PLM's own framework sources, which are noise to the student.
The custom JavaFileManager.list() returned every in-process compiled class for
any CLASS_PATH package query. javac trusts that list(package=P) returns classes
of P and derives their binary name as P + the file's simple name, so a class
such as plm.core.model.session.SourceFile leaked into the query for
scala.reflect.internal.util and was read as scala.reflect.internal.util.SourceFile
("class file contains wrong class"), breaking any exercise whose recompiled set
holds two classes with the same simple name (e.g. a Buggle Java exercise). Filter
the compiled classes by the queried package, like the source loop just above.
|
Thanks a lot, it's in! |
|
Thanks @mquinson, Thanks for merging this! I discovered this while preparing the next scala 2.12 packages for Debian. Since you also maintain PLM in Debian: these four fixes are queued there too, https://salsa.debian.org/java-team/plm/-/merge_requests/4 That PLM update is waiting on Scala 2.12 returning to the archive (the bootstrap effort), tracked here: I will keep you posted to coordinate the Debian upload whenever it suits you. PS: I loved discovering this package and being brought up to date, I may introduce it to my nephews/nieces |
|
Thanks for your patch and your support, @vejeta ;) I will upload a new upstream release with these fixes to Debian. I just need to update my github action to get the tests to pass again. PLM definitely needs more love, in many regards. |
|
@mquinson, glad to help! I went ahead and prepared a possible solution in #529 The easiest thing is to move to a Maven build: dependencies are declared and fetched The fat jar and the Debian build then come from the one pom.xml: Let me know what you think. Cheers! |
These three independent fixes make PLM usable again on a current system
(tested on Debian with OpenJDK 26 and jgit 6.7).
Description of the problems
Java exercises no longer run (Thread.stop). When running a Java exercise PLM
recompiles a set of its own framework sources in process, together with the
student code. LessonRunner.stopAll() called Thread.stop(), which is
deprecated for removal; on recent JDKs that recompilation fails with
"cannot find symbol: method stop()", so no Java exercise can run. Replaced
with cooperative Thread.interrupt().
Caveat: interrupt() is cooperative, so a student program stuck in a tight
non-cooperative loop is no longer force-killed the way Thread.stop() did.
A fully robust solution would run the student code in a separate,
hard-killable JVM; that is left as a follow-up.
Progress-tracking commits fail when commit.gpgsign is enabled. GitSpy /
GitUtils create a commit on every run. If the user's git configuration
enables commit signing (common on developer machines), jgit throws
"ServiceUnavailableException: Signing service is not available" and prints a
stack trace to the console on every run, in every language. PLM's internal
bookkeeping commits must never be signed: setSign(false) on each
CommitCommand.
Framework compilation warnings leak into the student console. The in-process
recompilation of PLM's own framework sources emits deprecation/unchecked
warnings (e.g. ThreadDeath and AccessController being deprecated for removal,
raw-type usage) into the in-application console -- noise the student did not
write and cannot act on. Show only Diagnostic.Kind.ERROR in LoggerPanel;
real errors in the student's code are still shown.
Solutions applied
LessonRunner.stopAll(): Thread.stop() (deprecated for removal) made PLM's in-process recompilation of its framework sources fail on recent JDKs, so no Java exercise could run; use cooperative Thread.interrupt() instead.
GitUtils: when the user's git config enables commit.gpgsign, jgit failed to sign PLM's internal tracking commits (ServiceUnavailableException) and dumped a stack trace to the console on every run; setSign(false) on them.
LoggerPanel: show only compilation errors, not the deprecation/unchecked warnings from PLM's own framework sources, which are noise to the student.
Follow-up (not in this PR):
the framework still references ThreadDeath and
java.security.AccessController, both deprecated for removal. They should be
modernized (cooperative-cancellation handler; drop the no-op doPrivileged) so
PLM keeps compiling when a future JDK removes them.