Skip to content

Commit 362c470

Browse files
daniel-larrazclaude
andcommitted
Fix Java compiler warnings
Resolves the 14 warnings reported by the Eclipse JDT compiler (the one backing the VS Code Java extension); javac was already clean. - Remove unused imports: URISyntaxException (Main), HashMap/Map (PostAnalysis), Collector (Suggestion). - Remove write-only field Node.jsonElement; the constructor parameter is still used to build the json string. - Remove NodeResult.isVisited, which was never read anywhere. - Add LogLevel.toString() returning the backing value, matching the Object enum in the same package. Behaviorally a no-op, since every constant's value string is identical to its name. - Add a default case to the object-type switch in Result.addJsonElement so the four untracked constants no longer warn. This matches the existing behavior of Result.initialize, which ignores them as well. - Make Suggestion.getKind2Result() public. It was dead because it was private, unlike the equivalent accessor on NodeResult, Property, StepValue, Value, and SubNode, which are all public. - Drop two unused local variables in Kind2ResultTests, keeping the calls. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 726cbce commit 362c470

8 files changed

Lines changed: 13 additions & 17 deletions

File tree

src/main/java/edu/uiowa/cs/clc/kind2/results/LogLevel.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,10 @@ public static LogLevel getLevel(String level)
5050
throw new UnsupportedOperationException("Log " + level + " is not defined");
5151
}
5252
}
53+
54+
@Override
55+
public String toString()
56+
{
57+
return this.value;
58+
}
5359
}

src/main/java/edu/uiowa/cs/clc/kind2/results/Main.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import java.io.IOException;
1111
import java.math.RoundingMode;
12-
import java.net.URISyntaxException;
1312
import java.nio.file.Files;
1413
import java.nio.file.Paths;
1514

src/main/java/edu/uiowa/cs/clc/kind2/results/Node.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public class Node
2424
*/
2525
private final String json;
2626

27-
private final JsonElement jsonElement;
2827
/**
2928
* Name of the node
3029
*/
@@ -41,7 +40,6 @@ public class Node
4140
public Node(ModelElementSet modelElementSet, JsonElement jsonElement)
4241
{
4342
this.modelElementSet = modelElementSet;
44-
this.jsonElement = jsonElement;
4543
json = new GsonBuilder().setPrettyPrinting().create().toJson(jsonElement);
4644
JsonObject jsonObject = jsonElement.getAsJsonObject();
4745
name = jsonObject.get(Labels.name).getAsString();

src/main/java/edu/uiowa/cs/clc/kind2/results/NodeResult.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ public class NodeResult
4141
*/
4242
private boolean isAnalyzed = false;
4343

44-
/**
45-
* determines whether the current component is printed. The current component may be called recursively
46-
* by multiple components, and we need to print it only once.
47-
*/
48-
private boolean isVisited = true;
49-
5044
/**
5145
* The list of suggestions for this component.
5246
*/

src/main/java/edu/uiowa/cs/clc/kind2/results/PostAnalysis.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
import com.google.gson.JsonElement;
1212

1313
import java.util.ArrayList;
14-
import java.util.HashMap;
1514
import java.util.List;
16-
import java.util.Map;
1715

1816
/**
1917
* PostAnalysis in Kind 2

src/main/java/edu/uiowa/cs/clc/kind2/results/Result.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@ public void addJsonElement(JsonElement jsonElement) {
435435
// no properties to check, causing missing analyses before postAnalyses, as well as this object.
436436
}
437437
break;
438+
439+
default:
440+
// other object types are not tracked by the result
441+
break;
438442
}
439443

440444
}

src/main/java/edu/uiowa/cs/clc/kind2/results/Suggestion.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package edu.uiowa.cs.clc.kind2.results;
99

1010
import java.util.*;
11-
import java.util.stream.Collector;
1211
import java.util.stream.Collectors;
1312

1413
/**
@@ -71,7 +70,7 @@ private Suggestion(NodeResult nodeResult, SuggestionType suggestionType)
7170
/**
7271
* @return the associated kind2 result.
7372
*/
74-
private Result getKind2Result()
73+
public Result getKind2Result()
7574
{
7675
return nodeResult.getKind2Result();
7776
}

src/test/java/edu/uiowa/cs/clc/kind2/results/Kind2ResultTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,10 @@ void iml()
383383
@Test
384384
void iml2()
385385
{
386-
Result result;
387386
String json = "[{'objectType': 'kind2Options', 'enabled': ['bmc', 'ind', 'ind2', 'ic3', 'invgents', 'invgenos', 'invgenintos', 'invgenintos'], 'timeout': 5.0, 'bmcMax': 0, 'compositional': True, 'modular': True}, {'objectType': 'log', 'level': 'info', 'source': 'parse', 'value': 'kind2 v1.1.0-488-gcc1e9bd5'}, {'objectType': 'log', 'level': 'error', 'source': 'parse', 'line': 28, 'column': 53, 'value': 'Syntax error'}]";
388387
try
389388
{
390-
result = Result.analyzeJsonResult(json);
389+
Result.analyzeJsonResult(json);
391390
}
392391
catch (RuntimeException exception)
393392
{
@@ -404,8 +403,7 @@ void iml3()
404403
Result.setPrintingLineNumbersEnabled(true);
405404
String json = "[{'objectType': 'kind2Options', 'enabled': ['bmc', 'ind', 'ind2', 'ic3', 'invgents', 'invgenos', 'invgenintos', 'invgenintos'], 'timeout': 1.0, 'bmcMax': 0, 'compositional': True, 'modular': True}, {'objectType': 'log', 'level': 'info', 'source': 'parse', 'value': 'kind2 v1.1.0-488-gcc1e9bd5'}, {'objectType': 'analysisStart', 'top': 'agree_dot_UTRC_Explain_Yes_dot_top_level_dot_Impl', 'concrete': [], 'abstract': ['agree_dot_UTRC_Explain_Yes_dot_C', 'agree_dot_UTRC_Explain_Yes_dot_B', 'agree_dot_UTRC_Explain_Yes_dot_A'], 'assumptions': []}, {'objectType': 'property', 'name': 'guarantee[l26c2][1]', 'scope': 'agree_dot_UTRC_Explain_Yes_dot_top_level_dot_Impl', 'line': 26, 'column': 2, 'source': 'Guarantee', 'runtime': {'unit': 'sec', 'timeout': False, 'value': 0.021}, 'k': 0, 'answer': {'source': 'ic3', 'value': 'falsifiable'}, 'counterExample': [{'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_top_level_dot_Impl', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 0]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 55]]}, {'name': 'A_sub_Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'local', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'A_sub_Output.data', 'type': 'int', 'class': 'local', 'instantValues': [[0, 20]]}, {'name': 'B_sub_Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'local', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'B_sub_Output.data', 'type': 'int', 'class': 'local', 'instantValues': [[0, 35]]}], 'subnodes': [{'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_B', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 20]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 35]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}, {'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_A', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 0]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 20]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}, {'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_C', 'streams': [{'name': 'Input1.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 20]]}, {'name': 'Input1.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Input2.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 35]]}, {'name': 'Input2.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 55]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}]}]}, {'objectType': 'property', 'name': 'agree_dot_UTRC_Explain_Yes_dot_A[l32c19].assume[l64c2][1]', 'scope': 'agree_dot_UTRC_Explain_Yes_dot_A', 'line': 64, 'column': 2, 'source': 'Assumption', 'runtime': {'unit': 'sec', 'timeout': False, 'value': 0.021}, 'k': 0, 'answer': {'source': 'ic3', 'value': 'falsifiable'}, 'counterExample': [{'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_top_level_dot_Impl', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 0]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 55]]}, {'name': 'A_sub_Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'local', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'A_sub_Output.data', 'type': 'int', 'class': 'local', 'instantValues': [[0, 20]]}, {'name': 'B_sub_Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'local', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'B_sub_Output.data', 'type': 'int', 'class': 'local', 'instantValues': [[0, 35]]}], 'subnodes': [{'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_B', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 20]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 35]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}, {'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_A', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 0]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 20]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}, {'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_C', 'streams': [{'name': 'Input1.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 20]]}, {'name': 'Input1.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Input2.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 35]]}, {'name': 'Input2.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 55]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}]}]}, {'objectType': 'property', 'name': 'agree_dot_UTRC_Explain_Yes_dot_B[l34c19].assume[l45c2][1]', 'scope': 'agree_dot_UTRC_Explain_Yes_dot_B', 'line': 45, 'column': 2, 'source': 'Assumption', 'runtime': {'unit': 'sec', 'timeout': False, 'value': 0.021}, 'k': 0, 'answer': {'source': 'ic3', 'value': 'falsifiable'}, 'counterExample': [{'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_top_level_dot_Impl', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 0]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 55]]}, {'name': 'A_sub_Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'local', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'A_sub_Output.data', 'type': 'int', 'class': 'local', 'instantValues': [[0, 20]]}, {'name': 'B_sub_Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'local', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'B_sub_Output.data', 'type': 'int', 'class': 'local', 'instantValues': [[0, 35]]}], 'subnodes': [{'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_B', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 20]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 35]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}, {'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_A', 'streams': [{'name': 'Input.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 0]]}, {'name': 'Input.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 20]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}, {'blockType': 'node', 'name': 'agree_dot_UTRC_Explain_Yes_dot_C', 'streams': [{'name': 'Input1.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 20]]}, {'name': 'Input1.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Input2.data', 'type': 'int', 'class': 'input', 'instantValues': [[0, 35]]}, {'name': 'Input2.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'input', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}, {'name': 'Output.data', 'type': 'int', 'class': 'output', 'instantValues': [[0, 55]]}, {'name': 'Output.direction', 'type': 'iml_dot_systems_dot_Direction', 'class': 'output', 'instantValues': [[0, 'iml_dot_systems_dot_Direction_dot_IN']]}]}]}]}, {'objectType': 'analysisStop'}]";
406405

407-
Result result = Result.analyzeJsonResult(json);
408-
// System.out.println(result);
406+
Result.analyzeJsonResult(json);
409407
}
410408

411409
@Test

0 commit comments

Comments
 (0)