Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/plm/core/lang/LangJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,16 @@ public Iterable<JavaFileObject> 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))
Expand Down
11 changes: 8 additions & 3 deletions src/plm/core/model/LessonRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/plm/core/model/tracking/GitUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public void createInitialCommit() throws NoHeadException, NoMessageException, Un
git.commit().setMessage("Empty initial commit")
.setAuthor(new PersonIdent("John Doe", "[email protected]"))
.setCommitter(new PersonIdent("John Doe", "[email protected]"))
.setSign(false) // never sign PLM's internal progress-tracking commits
.call();
}

Expand Down Expand Up @@ -159,6 +160,7 @@ else if(res.getMergeStatus() == MergeResult.MergeStatus.CONFLICTING) {
git.commit().setMessage("Manual merging")
.setAuthor(new PersonIdent("John Doe", "[email protected]"))
.setCommitter(new PersonIdent("John Doe", "[email protected]"))
.setSign(false) // never sign PLM's internal progress-tracking commits
.call();
}
else if(res.getMergeStatus() == MergeResult.MergeStatus.FAILED) {
Expand Down Expand Up @@ -339,6 +341,7 @@ public void commit(String msg) throws NoHeadException, NoMessageException, Unmer
this.git.commit().setMessage(msg)
.setAuthor(new PersonIdent("John Doe", "[email protected]"))
.setCommitter(new PersonIdent("John Doe", "[email protected]"))
.setSign(false) // never sign PLM's internal progress-tracking commits
.call();
}

Expand Down
5 changes: 5 additions & 0 deletions src/plm/core/ui/LoggerPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public void log(DiagnosticCollector<JavaFileObject> diagnostics) {
Pattern isJava6Pattern = Pattern.compile("major version 51 is newer than 50, the highest major version supported by this compiler");

for (Diagnostic<? extends JavaFileObject> 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());

Expand Down
Loading