Skip to content

Commit b042082

Browse files
authored
Merge pull request #69 from goblint/contexts
Read and show contexts in warnings if available
2 parents 80651da + 1d360b9 commit b042082

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/api/messages/GoblintMessagesResult.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public interface MultiPiece {
5858
public static class Piece implements MultiPiece {
5959
private String text;
6060
private GoblintLocation loc;
61+
private context context;
62+
63+
public static class context {
64+
private Integer tag;
65+
}
6166

6267
/**
6368
* Converts the Single (Piece type of) Goblint messages from the
@@ -70,7 +75,8 @@ public static class Piece implements MultiPiece {
7075
*/
7176
public List<AnalysisResult> convert(List<Tag> tags, String severity, boolean explode) {
7277
GoblintPosition pos = getLocation(loc);
73-
String msg = joinTags(tags) + " " + text;
78+
String ctx = context == null || context.tag == null ? "" : " in context " + context.tag;
79+
String msg = joinTags(tags) + " " + text + ctx;
7480
GoblintMessagesAnalysisResult result = new GoblintMessagesAnalysisResult(pos, msg, severity);
7581
return List.of(result);
7682
}

0 commit comments

Comments
 (0)