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
5 changes: 4 additions & 1 deletion src/main/java/edu/uiowa/cs/clc/kind2/results/Object.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public enum Object
postAnalysisEnd("postAnalysisEnd"),
modelElementSet("modelElementSet"),
progress("progress"),
lsp("lsp");
lsp("lsp"),
modelSetEnumeration("modelSetEnumeration");

private final String value;

Expand Down Expand Up @@ -60,6 +61,8 @@ public static Object getKind2Object(String kind2Object)
return progress;
case "lsp":
return lsp;
case "modelSetEnumeration":
return modelSetEnumeration;
default:
throw new UnsupportedOperationException("Value " + kind2Object + " is not defined");
}
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/edu/uiowa/cs/clc/kind2/results/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void initialize(String json) {
Analysis kind2Analysis = null;
// for post analysis
Analysis previousAnalysis = null;

boolean emptyAnalysis = false;
for (JsonElement jsonElement : jsonArray) {
String objectType = jsonElement.getAsJsonObject().get(Labels.objectType).getAsString();
Object kind2Object = Object.getKind2Object(objectType);
Expand Down Expand Up @@ -250,14 +250,17 @@ public void initialize(String json) {
PostAnalysis postAnalysis = new PostAnalysis(previousAnalysis, jsonElement);
previousAnalysis.setPostAnalysis(postAnalysis);
} else {
throw new RuntimeException("Can not parse kind2 json output");
// This can occur sometimes with no previous analysis when the node had no properties to check.
emptyAnalysis = true;
}
}

if (kind2Object == Object.postAnalysisEnd) {
if (previousAnalysis != null && previousAnalysis.getPostAnalysis() != null) {
// finish the post analysis
previousAnalysis = null;
} else if (emptyAnalysis){
//Do nothing, had a no-analysis postAnalysisStart beforehand.
} else {
throw new RuntimeException("Failed to analyze kind2 json output");
}
Expand All @@ -269,7 +272,8 @@ public void initialize(String json) {
ModelElementSet elementSet = new ModelElementSet(postAnalysis, jsonElement);
postAnalysis.addModelElementSet(elementSet);
} else {
throw new RuntimeException("Can not parse kind2 json output");
// This branch gets hit sometimes when we have empty (nonexistent) analyses of nodes with
// no properties to check, causing missing analyses before postAnalyses, as well as this object.
}
}
}
Expand Down