Skip to content

Commit

Permalink
Record compiler exception as problem when save failed in decompiler p…
Browse files Browse the repository at this point in the history
…ane, if present

Most common case of this is compiling against a version of Java that is too old.
  • Loading branch information
Col-E committed Jan 11, 2024
1 parent 6cce931 commit 40d2a1a
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import software.coley.recaf.ui.control.ModalPaneComponent;
import software.coley.recaf.ui.control.richtext.Editor;
import software.coley.recaf.ui.control.richtext.problem.Problem;
import software.coley.recaf.ui.control.richtext.problem.ProblemLevel;
import software.coley.recaf.ui.control.richtext.problem.ProblemPhase;
import software.coley.recaf.ui.control.richtext.search.SearchBar;
import software.coley.recaf.ui.control.richtext.source.JavaContextActionSupport;
Expand Down Expand Up @@ -256,6 +257,9 @@ private void save() {
} else {
// Handle compile-result failure, or uncaught thrown exception.
if (result != null) {
if (result.getDiagnostics().isEmpty() && result.getException() != null)
problemTracking.add(new Problem(-1, -1, ProblemLevel.ERROR, ProblemPhase.BUILD, result.getException().toString()));

for (CompilerDiagnostic diagnostic : result.getDiagnostics())
problemTracking.add(Problem.fromDiagnostic(diagnostic));

Expand Down

0 comments on commit 40d2a1a

Please sign in to comment.