Skip to content

Commit

Permalink
Look for ParseExceptionResult marker instead of instanceof ParserError (
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek authored Aug 9, 2024
1 parent 60166a4 commit 4dc14a5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import org.openrewrite.remote.Remote;
import org.openrewrite.style.NamedStyles;
import org.openrewrite.text.PlainTextParser;
import org.openrewrite.tree.ParseError;
import org.openrewrite.tree.ParsingEventListener;
import org.openrewrite.tree.ParsingExecutionContextView;
import org.openrewrite.xml.tree.Xml;
Expand Down Expand Up @@ -1152,12 +1151,13 @@ private SourceFileStream parseMultiplatformKotlinProject(Project subproject, Col
}

private SourceFile logParseErrors(SourceFile source) {
if (source instanceof ParseError) {
source.getMarkers().findFirst(ParseExceptionResult.class).ifPresent(e -> {
if (firstWarningLogged.compareAndSet(false, true)) {
logger.warn("There were problems parsing some source files, run with --info to see full stack traces");
}
logger.warn("There were problems parsing " + source.getSourcePath());
}
logger.debug(e.getMessage());
});
return source;
}

Expand Down

0 comments on commit 4dc14a5

Please sign in to comment.