Skip to content

Commit 43611f5

Browse files
committed
learner-it-support: improve nullability declarations
1 parent f135932 commit 43611f5

File tree

8 files changed

+20
-6
lines changed

8 files changed

+20
-6
lines changed

test-support/learner-it-support/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ limitations under the License.
6060
<artifactId>learnlib-util</artifactId>
6161
</dependency>
6262

63+
<!-- build -->
64+
<dependency>
65+
<groupId>org.checkerframework</groupId>
66+
<artifactId>checker-qual</artifactId>
67+
</dependency>
68+
6369
<!-- external -->
6470
<dependency>
6571
<groupId>net.automatalib</groupId>

test-support/learner-it-support/src/main/java/de/learnlib/testsupport/it/learner/AbstractLearnerVariantITCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import net.automatalib.automaton.concept.Output;
3030
import net.automatalib.common.util.random.RandomUtil;
3131
import net.automatalib.word.Word;
32+
import org.checkerframework.checker.nullness.qual.Nullable;
3233
import org.slf4j.Logger;
3334
import org.slf4j.LoggerFactory;
3435
import org.testng.Assert;
@@ -104,6 +105,6 @@ public String getTestName() {
104105
return variant.getLearnerName() + "[" + variant.getName() + "]/" + example.getClass().getSimpleName();
105106
}
106107

107-
protected abstract Word<I> checkEquivalence(M hypothesis);
108+
protected abstract @Nullable Word<I> checkEquivalence(M hypothesis);
108109

109110
}

test-support/learner-it-support/src/main/java/de/learnlib/testsupport/it/learner/OneSEVPALearnerITCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import net.automatalib.automaton.vpa.OneSEVPA;
2121
import net.automatalib.util.automaton.vpa.OneSEVPAs;
2222
import net.automatalib.word.Word;
23+
import org.checkerframework.checker.nullness.qual.Nullable;
2324

2425
public class OneSEVPALearnerITCase<I> extends AbstractLearnerVariantITCase<I, Boolean, OneSEVPA<?, I>> {
2526

@@ -33,7 +34,7 @@ public class OneSEVPALearnerITCase<I> extends AbstractLearnerVariantITCase<I, Bo
3334
}
3435

3536
@Override
36-
protected Word<I> checkEquivalence(OneSEVPA<?, I> hypothesis) {
37+
protected @Nullable Word<I> checkEquivalence(OneSEVPA<?, I> hypothesis) {
3738
return OneSEVPAs.findSeparatingWord(this.example.getReferenceAutomaton(),
3839
hypothesis,
3940
this.example.getAlphabet());

test-support/learner-it-support/src/main/java/de/learnlib/testsupport/it/learner/SBALearnerITCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import net.automatalib.automaton.procedural.SBA;
2121
import net.automatalib.util.automaton.procedural.SBAs;
2222
import net.automatalib.word.Word;
23+
import org.checkerframework.checker.nullness.qual.Nullable;
2324

2425
public class SBALearnerITCase<I> extends AbstractLearnerVariantITCase<I, Boolean, SBA<?, I>> {
2526

@@ -33,7 +34,7 @@ public class SBALearnerITCase<I> extends AbstractLearnerVariantITCase<I, Boolean
3334
}
3435

3536
@Override
36-
protected Word<I> checkEquivalence(SBA<?, I> hypothesis) {
37+
protected @Nullable Word<I> checkEquivalence(SBA<?, I> hypothesis) {
3738
return SBAs.findSeparatingWord(this.example.getReferenceAutomaton(),
3839
hypothesis,
3940
this.example.getAlphabet());

test-support/learner-it-support/src/main/java/de/learnlib/testsupport/it/learner/SPALearnerITCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import net.automatalib.automaton.procedural.SPA;
2121
import net.automatalib.util.automaton.procedural.SPAs;
2222
import net.automatalib.word.Word;
23+
import org.checkerframework.checker.nullness.qual.Nullable;
2324

2425
public class SPALearnerITCase<I> extends AbstractLearnerVariantITCase<I, Boolean, SPA<?, I>> {
2526

@@ -33,7 +34,7 @@ public class SPALearnerITCase<I> extends AbstractLearnerVariantITCase<I, Boolean
3334
}
3435

3536
@Override
36-
protected Word<I> checkEquivalence(SPA<?, I> hypothesis) {
37+
protected @Nullable Word<I> checkEquivalence(SPA<?, I> hypothesis) {
3738
return SPAs.findSeparatingWord(this.example.getReferenceAutomaton(),
3839
hypothesis,
3940
this.example.getAlphabet());

test-support/learner-it-support/src/main/java/de/learnlib/testsupport/it/learner/SPMMLearnerITCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import net.automatalib.automaton.procedural.SPMM;
2121
import net.automatalib.util.automaton.procedural.SPMMs;
2222
import net.automatalib.word.Word;
23+
import org.checkerframework.checker.nullness.qual.Nullable;
2324

2425
public class SPMMLearnerITCase<I, O> extends AbstractLearnerVariantITCase<I, Word<O>, SPMM<?, I, ?, O>> {
2526

@@ -33,7 +34,7 @@ public class SPMMLearnerITCase<I, O> extends AbstractLearnerVariantITCase<I, Wor
3334
}
3435

3536
@Override
36-
protected Word<I> checkEquivalence(SPMM<?, I, ?, O> hypothesis) {
37+
protected @Nullable Word<I> checkEquivalence(SPMM<?, I, ?, O> hypothesis) {
3738
return SPMMs.findSeparatingWord(this.example.getReferenceAutomaton(),
3839
hypothesis,
3940
this.example.getAlphabet());

test-support/learner-it-support/src/main/java/de/learnlib/testsupport/it/learner/UniversalDeterministicLearnerITCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import net.automatalib.automaton.concept.Output;
2222
import net.automatalib.util.automaton.Automata;
2323
import net.automatalib.word.Word;
24+
import org.checkerframework.checker.nullness.qual.Nullable;
2425

2526
public class UniversalDeterministicLearnerITCase<I, D, M extends UniversalDeterministicAutomaton<?, I, ?, ?, ?> & Output<I, D>>
2627
extends AbstractLearnerVariantITCase<I, D, M> {
@@ -35,7 +36,7 @@ public class UniversalDeterministicLearnerITCase<I, D, M extends UniversalDeterm
3536
}
3637

3738
@Override
38-
protected Word<I> checkEquivalence(M hypothesis) {
39+
protected @Nullable Word<I> checkEquivalence(M hypothesis) {
3940
return Automata.findSeparatingWord(this.example.getReferenceAutomaton(),
4041
hypothesis,
4142
this.example.getAlphabet());

test-support/learner-it-support/src/main/java/module-info.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,7 @@
4242
requires org.slf4j;
4343
requires org.testng;
4444

45+
requires static org.checkerframework.checker.qual;
46+
4547
exports de.learnlib.testsupport.it.learner;
4648
}

0 commit comments

Comments
 (0)