Skip to content

Commit fd769e5

Browse files
committed
remove mutability from PropertyOracles
1 parent 97cc60e commit fd769e5

File tree

6 files changed

+3
-33
lines changed

6 files changed

+3
-33
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
2929

3030
* The `de.learnlib.tooling:learnlib-annotation-processor` artifact has been dropped. The functionality has been moved to a [standalone project](https://github.com/LearnLib/build-tools).
3131
* The `de.learnlib:learnlib-rpni-edsm` and `de.learnlib:learnlib-rpni-mdl` artifacts have been dropped. The code has been merged with the `de.learnlib:learnlib-rpni` artifact.
32+
* `PropertyOracle`s can no longer set a property. This value is now immutable and must be provided during instantiation. Previously, the internal state wasn't updated accordingly if a property was overridden.
3233

3334

3435
## [0.17.0] - 2023-11-15

api/src/main/java/de/learnlib/oracle/PropertyOracle.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ default boolean isDisproved() {
5353
return getCounterExample() != null;
5454
}
5555

56-
/**
57-
* Set the property.
58-
*
59-
* @param property
60-
* the property to set
61-
*/
62-
void setProperty(P property);
63-
6456
/**
6557
* Returns the property.
6658
*

oracles/property-oracles/src/main/java/de/learnlib/oracle/property/AbstractPropertyOracle.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ abstract class AbstractPropertyOracle<I, A extends Output<I, D>, P, D, R extends
4444

4545
private final InclusionOracle<A, I, D> inclusionOracle;
4646
private final EmptinessOracle<R, I, D> emptinessOracle;
47-
private P property;
47+
private final P property;
4848
private @Nullable DefaultQuery<I, D> counterExample;
4949

5050
protected AbstractPropertyOracle(P property,
@@ -60,11 +60,6 @@ protected AbstractPropertyOracle(P property,
6060
return counterExample;
6161
}
6262

63-
@Override
64-
public void setProperty(P property) {
65-
this.property = property;
66-
}
67-
6863
@Override
6964
public P getProperty() {
7065
return property;

oracles/property-oracles/src/main/java/de/learnlib/oracle/property/LoggingPropertyOracle.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ public boolean isDisproved() {
6262
return propertyOracle.isDisproved();
6363
}
6464

65-
@Override
66-
public void setProperty(P property) {
67-
this.propertyOracle.setProperty(property);
68-
}
69-
7065
@Override
7166
public P getProperty() {
7267
return propertyOracle.getProperty();

oracles/property-oracles/src/main/java/de/learnlib/oracle/property/MealyFinitePropertyOracle.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public MealyFinitePropertyOracle(P property,
4949

5050
@Override
5151
protected MealyMachine<?, I, ?, O> modelCheck(MealyMachine<?, I, ?, O> hypothesis, Collection<? extends I> inputs) {
52-
5352
return modelChecker.findCounterExample(hypothesis, inputs, getProperty());
5453
}
5554
}

oracles/property-oracles/src/main/java/de/learnlib/oracle/property/PropertyOracleChain.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
generics = {@Generic("I"), @Generic("O"), @Generic("P")}))
7878
public class PropertyOracleChain<I, A extends Output<I, D>, @Nullable P, D> implements PropertyOracle<I, A, P, D> {
7979

80-
private P property;
80+
private final P property;
8181

8282
private @Nullable DefaultQuery<I, D> counterExample;
8383

@@ -97,12 +97,6 @@ public PropertyOracleChain(Collection<? extends PropertyOracle<I, ? super A, P,
9797
}
9898
}
9999

100-
public void addOracle(PropertyOracle<I, ? super A, P, D> oracle) {
101-
assert oracle.getProperty() == null || oracle.getProperty().equals(property);
102-
oracle.setProperty(property);
103-
oracles.add(oracle);
104-
}
105-
106100
@Override
107101
public @Nullable DefaultQuery<I, D> doFindCounterExample(A hypothesis, Collection<? extends I> inputs) {
108102
for (PropertyOracle<I, ? super A, P, D> oracle : oracles) {
@@ -128,12 +122,6 @@ public void addOracle(PropertyOracle<I, ? super A, P, D> oracle) {
128122
return null;
129123
}
130124

131-
@Override
132-
public void setProperty(P property) {
133-
oracles.forEach(o -> o.setProperty(property));
134-
this.property = property;
135-
}
136-
137125
@Override
138126
public P getProperty() {
139127
return property;

0 commit comments

Comments
 (0)