Skip to content

Commit 05ffad6

Browse files
committed
fix Checkstyle warnings about JavaDoc, hidden fields, etc.
1 parent bae2a1c commit 05ffad6

File tree

4 files changed

+19
-38
lines changed

4 files changed

+19
-38
lines changed

src/org/sosy_lab/java_smt/api/SLFormulaManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
* complains at runtime!
1818
*
1919
* @see <a href="https://en.wikipedia.org/wiki/Separation_logic">Separation Logic</a>
20-
* @see <a href="https://cacm.acm.org/research/separation-logic/>Separation Logic</a>
20+
* @see <a href="https://cacm.acm.org/research/separation-logic/">Separation Logic</a>
2121
* @see <a
2222
* href="https://www.cs.cmu.edu/afs/cs.cmu.edu/project/fox-19/member/jcr/www15818As2011/cs818A3-11.html">15-818A3
2323
* Introduction to Separation Logic (6 units) Spring 2011</a>
24-
* @see <a href="https://www.philipzucker.com/executable-seperation>Modeling Separation Logic with
24+
* @see <a href="https://www.philipzucker.com/executable-seperation">Modeling Separation Logic with
2525
* Python Dicts and Z3</a>
2626
*/
2727
@SuppressWarnings("MethodTypeParameterName")
@@ -52,7 +52,7 @@ public interface SLFormulaManager {
5252
/**
5353
* Creates a formula representing the "magic wand" (-*) operator in separation logic. The "magic
5454
* wand" operator asserts that if the first formula holds, then the second formula can be added to
55-
* the heap without conflict. It is a form of implication (=>) that takes into account the
55+
* the heap without conflict. It is a form of implication (=&gt;) that takes into account the
5656
* disjointness of memory regions.
5757
*
5858
* @return a Boolean formula representing the "magic wand" of {@code f1} and {@code f2}.

src/org/sosy_lab/java_smt/solvers/cvc5/CVC5AbstractProver.java

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.util.List;
3636
import java.util.Optional;
3737
import java.util.Set;
38-
import javax.annotation.Nonnull;
3938
import org.sosy_lab.common.ShutdownNotifier;
4039
import org.sosy_lab.common.UniqueIdGenerator;
4140
import org.sosy_lab.common.collect.PathCopyingPersistentTreeMap;
@@ -55,7 +54,6 @@ abstract class CVC5AbstractProver<T> extends AbstractProverWithAllSat<T> {
5554
private final FormulaManager mgr;
5655
protected final CVC5FormulaCreator creator;
5756
private final int randomSeed;
58-
private final ImmutableSet<ProverOptions> options;
5957
private final ImmutableMap<String, String> furtherOptionsMap;
6058
protected Solver solver; // final in incremental mode, non-final in non-incremental mode
6159
private boolean changedSinceLastSatQuery = false;
@@ -79,24 +77,20 @@ protected CVC5AbstractProver(
7977

8078
mgr = pMgr;
8179
creator = pFormulaCreator;
82-
options = ImmutableSet.copyOf(pOptions);
8380
furtherOptionsMap = pFurtherOptionsMap;
8481
randomSeed = pRandomSeed;
8582
incremental = !enableSL;
8683
assertedTerms.add(PathCopyingPersistentTreeMap.of());
8784

8885
if (incremental) {
89-
solver = getNewSolver(randomSeed, options, furtherOptionsMap);
86+
solver = getNewSolver();
9087
}
9188
}
9289

93-
protected Solver getNewSolver(
94-
int randomSeed,
95-
Set<ProverOptions> pOptions,
96-
ImmutableMap<String, String> pFurtherOptionsMap) {
90+
protected Solver getNewSolver() {
9791
Solver newSolver = new Solver(creator.getEnv());
9892
try {
99-
CVC5SolverContext.setSolverOptions(newSolver, randomSeed, pFurtherOptionsMap);
93+
CVC5SolverContext.setSolverOptions(newSolver, randomSeed, furtherOptionsMap);
10094
} catch (CVC5ApiRecoverableException e) {
10195
// We've already used these options in CVC5SolverContext, so there should be no exception
10296
throw new AssertionError("Unexpected exception", e);
@@ -226,7 +220,7 @@ public boolean isUnsat() throws InterruptedException, SolverException {
226220
if (solver != null) {
227221
solver.deletePointer(); // cleanup
228222
}
229-
solver = getNewSolver(randomSeed, options, furtherOptionsMap);
223+
solver = getNewSolver();
230224

231225
ImmutableSet<BooleanFormula> assertedFormulas = getAssertedFormulas();
232226
if (enableSL) {
@@ -237,8 +231,9 @@ public boolean isUnsat() throws InterruptedException, SolverException {
237231

238232
Result result;
239233
try {
240-
result = checkSat();
241-
} catch (CVC5ApiException e) {
234+
result = solver.checkSat();
235+
} catch (Exception e) {
236+
// we actually only want to catch CVC5ApiException, but need to catch all.
242237
throw new SolverException("CVC5 failed during satisfiability check", e);
243238
} finally {
244239
/* Shutdown currently not possible in CVC5. */
@@ -247,10 +242,6 @@ public boolean isUnsat() throws InterruptedException, SolverException {
247242
return convertSatResult(result);
248243
}
249244

250-
private Result checkSat() throws CVC5ApiException {
251-
return solver.checkSat();
252-
}
253-
254245
private void declareHeap(ImmutableSet<BooleanFormula> pAssertedFormulas) throws SolverException {
255246
// get heap sort from asserted terms
256247
final Multimap<Sort, Sort> heapSorts;
@@ -278,9 +269,8 @@ private void declareHeap(ImmutableSet<BooleanFormula> pAssertedFormulas) throws
278269
solver.declareSepHeap(heapSort, elementSort);
279270
}
280271

281-
@Nonnull
282272
private Multimap<Sort, Sort> getHeapSorts(ImmutableSet<BooleanFormula> pAssertedFormulas)
283-
throws CVC5ApiException, SolverException {
273+
throws CVC5ApiException {
284274
final Deque<Term> waitlist = new ArrayDeque<>();
285275
for (BooleanFormula f : pAssertedFormulas) {
286276
waitlist.add(creator.extractInfo(f));

src/org/sosy_lab/java_smt/solvers/cvc5/CVC5InterpolatingProver.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,39 +38,30 @@ public class CVC5InterpolatingProver extends CVC5AbstractProver<String>
3838
private final TermManager termManager = creator.getEnv();
3939

4040
private final FormulaManager mgr;
41-
private final Set<ProverOptions> solverOptions;
42-
private final ImmutableMap<String, String> furtherOptionsMap;
43-
private final int seed;
4441
private final CVC5BooleanFormulaManager bmgr;
4542
private final boolean validateInterpolants;
4643

4744
CVC5InterpolatingProver(
4845
CVC5FormulaCreator pFormulaCreator,
4946
ShutdownNotifier pShutdownNotifier,
50-
int randomSeed,
47+
int pRandomSeed,
5148
ImmutableSet<ProverOptions> pOptions,
5249
FormulaManager pMgr,
5350
ImmutableMap<String, String> pFurtherOptionsMap,
5451
boolean pValidateInterpolants) {
55-
super(pFormulaCreator, pShutdownNotifier, randomSeed, pOptions, pMgr, pFurtherOptionsMap);
52+
super(pFormulaCreator, pShutdownNotifier, pRandomSeed, pOptions, pMgr, pFurtherOptionsMap);
5653
mgr = pMgr;
57-
solverOptions = pOptions;
58-
seed = randomSeed;
5954
bmgr = (CVC5BooleanFormulaManager) mgr.getBooleanFormulaManager();
6055
validateInterpolants = pValidateInterpolants;
61-
furtherOptionsMap = pFurtherOptionsMap;
6256
}
6357

6458
/**
6559
* Sets the same solver Options of the Original Solver to the separate solvertoSet, except for
6660
* produce-interpolants which is set here. From CVC5AbstractProver Line 66
6761
*/
6862
@Override
69-
protected Solver getNewSolver(
70-
int randomSeed,
71-
Set<ProverOptions> pOptions,
72-
ImmutableMap<String, String> pFurtherOptionsMap) {
73-
Solver newSolver = super.getNewSolver(randomSeed, pOptions, pFurtherOptionsMap);
63+
protected Solver getNewSolver() {
64+
Solver newSolver = super.getNewSolver();
7465
newSolver.setOption("produce-interpolants", "true");
7566
return newSolver;
7667
}
@@ -184,7 +175,7 @@ private Term getCVC5Interpolation(Collection<Term> formulasA, Collection<Term> f
184175
Term phiMinus = bmgr.andImpl(formulasB);
185176

186177
// Uses a separate Solver instance to leave the original solver-context unmodified
187-
Solver itpSolver = getNewSolver(seed, solverOptions, furtherOptionsMap);
178+
Solver itpSolver = getNewSolver();
188179

189180
Term interpolant;
190181
try {
@@ -225,7 +216,7 @@ private void checkInterpolationCriteria(Term interpolant, Term phiPlus, Term phi
225216

226217
// build and check both Craig interpolation formulas with the generated interpolant.
227218
// interpolation option is not required for validation
228-
Solver validationSolver = getNewSolver(seed, solverOptions, furtherOptionsMap);
219+
Solver validationSolver = getNewSolver();
229220
try {
230221
validationSolver.push();
231222
validationSolver.assertFormula(termManager.mkTerm(Kind.IMPLIES, phiPlus, interpolant));

src/org/sosy_lab/java_smt/solvers/cvc5/CVC5TheoremProver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class CVC5TheoremProver extends CVC5AbstractProver<Void>
2424
protected CVC5TheoremProver(
2525
CVC5FormulaCreator pFormulaCreator,
2626
ShutdownNotifier pShutdownNotifier,
27-
int randomSeed,
27+
int pRandomSeed,
2828
ImmutableSet<ProverOptions> pOptions,
2929
FormulaManager pMgr,
3030
ImmutableMap<String, String> pFurtherOptionsMap) {
31-
super(pFormulaCreator, pShutdownNotifier, randomSeed, pOptions, pMgr, pFurtherOptionsMap);
31+
super(pFormulaCreator, pShutdownNotifier, pRandomSeed, pOptions, pMgr, pFurtherOptionsMap);
3232
}
3333

3434
@Override

0 commit comments

Comments
 (0)