diff --git a/src/plm/core/lang/LangJava.java b/src/plm/core/lang/LangJava.java index 03b1d23f9..5e38c32dd 100644 --- a/src/plm/core/lang/LangJava.java +++ b/src/plm/core/lang/LangJava.java @@ -546,7 +546,16 @@ public Iterable list(Location location, String packageName, Set< if (file.getKind() == Kind.CLASS && file.getName().startsWith(packageName)) files.add(file); } - files.addAll(classLoader.files()); + // Only return the compiled classes that actually live in the queried + // package. javac trusts that list(package=P) returns classes of P and + // derives their binary name as P + simpleName; returning every compiled + // class unconditionally made it mistake e.g. plm...SourceFile for + // scala.reflect.internal.util.SourceFile ("class file contains wrong + // class") and broke compilation. + for (JavaFileObject file : classLoader.files()) { + if (file.getName().startsWith(packageName)) + files.add(file); + } } else if (location == StandardLocation.SOURCE_PATH && kinds.contains(JavaFileObject.Kind.SOURCE)) { for (JavaFileObject file : fileObjects.values()) { if (file.getKind() == Kind.SOURCE && file.getName().startsWith(packageName)) diff --git a/src/plm/core/model/LessonRunner.java b/src/plm/core/model/LessonRunner.java index f567d543a..ed3041e9d 100644 --- a/src/plm/core/model/LessonRunner.java +++ b/src/plm/core/model/LessonRunner.java @@ -103,12 +103,17 @@ public void run() { runners.remove(this); } - /** Stop all the threads that were already started. Harmful but who cares? */ - @SuppressWarnings("deprecation") + /** Stop all the threads that were already started. + * + * Thread.stop() was used here historically, but it is deprecated for removal: + * on recent JDKs its presence in this framework source -- which PLM recompiles + * in process when running a Java exercise -- makes that compilation fail, so + * no Java exercise can run. Replace it with Thread.interrupt(), a cooperative + * request to stop. */ public void stopAll() { while (runners.size()>0) { Thread t = runners.remove(runners.size() - 1); - t.stop(); // harmful but who cares ? + t.interrupt(); } } diff --git a/src/plm/core/model/tracking/GitUtils.java b/src/plm/core/model/tracking/GitUtils.java index 57fe3c749..dff97c10e 100644 --- a/src/plm/core/model/tracking/GitUtils.java +++ b/src/plm/core/model/tracking/GitUtils.java @@ -104,6 +104,7 @@ public void createInitialCommit() throws NoHeadException, NoMessageException, Un git.commit().setMessage("Empty initial commit") .setAuthor(new PersonIdent("John Doe", "john.doe@plm.net")) .setCommitter(new PersonIdent("John Doe", "john.doe@plm.net")) + .setSign(false) // never sign PLM's internal progress-tracking commits .call(); } @@ -159,6 +160,7 @@ else if(res.getMergeStatus() == MergeResult.MergeStatus.CONFLICTING) { git.commit().setMessage("Manual merging") .setAuthor(new PersonIdent("John Doe", "john.doe@plm.net")) .setCommitter(new PersonIdent("John Doe", "john.doe@plm.net")) + .setSign(false) // never sign PLM's internal progress-tracking commits .call(); } else if(res.getMergeStatus() == MergeResult.MergeStatus.FAILED) { @@ -339,6 +341,7 @@ public void commit(String msg) throws NoHeadException, NoMessageException, Unmer this.git.commit().setMessage(msg) .setAuthor(new PersonIdent("John Doe", "john.doe@plm.net")) .setCommitter(new PersonIdent("John Doe", "john.doe@plm.net")) + .setSign(false) // never sign PLM's internal progress-tracking commits .call(); } diff --git a/src/plm/core/ui/LoggerPanel.java b/src/plm/core/ui/LoggerPanel.java index 7f6a04d19..392f918aa 100644 --- a/src/plm/core/ui/LoggerPanel.java +++ b/src/plm/core/ui/LoggerPanel.java @@ -47,6 +47,11 @@ public void log(DiagnosticCollector diagnostics) { Pattern isJava6Pattern = Pattern.compile("major version 51 is newer than 50, the highest major version supported by this compiler"); for (Diagnostic diagnostic : diagnostics.getDiagnostics()) { + // Only show real errors. Warnings and notes here come from PLM's own + // framework sources, which are recompiled in process together with the + // student code; they are not the student's concern and only add noise. + if (diagnostic.getKind() != Diagnostic.Kind.ERROR) + continue; String source = diagnostic.getSource() == null ? "(null)" : diagnostic.getSource().getName(); String msg = diagnostic.getMessage(getLocale());