Skip to content

Commit ea13d1e

Browse files
authored
refactor: remove remaining deprecation from public API (#2124)
1 parent 398a266 commit ea13d1e

141 files changed

Lines changed: 339 additions & 2518 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/src/main/java/ai/timefold/solver/core/api/domain/lookup/PlanningId.java renamed to core/src/main/java/ai/timefold/solver/core/api/domain/common/PlanningId.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ai.timefold.solver.core.api.domain.lookup;
1+
package ai.timefold.solver.core.api.domain.common;
22

33
import static java.lang.annotation.ElementType.FIELD;
44
import static java.lang.annotation.ElementType.METHOD;

core/src/main/java/ai/timefold/solver/core/api/domain/entity/PinningFilter.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

core/src/main/java/ai/timefold/solver/core/api/domain/entity/PlanningEntity.java

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import ai.timefold.solver.core.api.domain.common.ComparatorFactory;
1111
import ai.timefold.solver.core.api.domain.solution.PlanningSolution;
1212
import ai.timefold.solver.core.api.domain.variable.PlanningVariable;
13-
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionSorterWeightFactory;
1413

1514
/**
1615
* Specifies that the class is a planning entity.
@@ -69,80 +68,4 @@ interface NullComparator<T> extends Comparator<T> {
6968
interface NullComparatorFactory<Solution_, T> extends ComparatorFactory<Solution_, T> {
7069
}
7170

72-
/**
73-
* A pinned planning entity is never changed during planning,
74-
* this is useful in repeated planning use cases (such as continuous planning and real-time planning).
75-
* This applies to all the planning variables of this planning entity.
76-
* <p>
77-
* The method {@link PinningFilter#accept(Object, Object)} returns false if the selection entity is pinned
78-
* and it returns true if the selection entity is movable
79-
*
80-
* @return {@link NullPinningFilter} when it is null (workaround for annotation limitation)
81-
* @deprecated Prefer using {@link PlanningPin}.
82-
*/
83-
@Deprecated(forRemoval = true, since = "1.23.0")
84-
Class<? extends PinningFilter> pinningFilter() default NullPinningFilter.class;
85-
86-
/**
87-
* Workaround for annotation limitation in {@link #pinningFilter()}.
88-
*
89-
* @deprecated Prefer using {@link PlanningPin}.
90-
*/
91-
@Deprecated(forRemoval = true, since = "1.23.0")
92-
interface NullPinningFilter extends PinningFilter {
93-
}
94-
95-
/**
96-
* Allows a collection of planning entities to be sorted by difficulty.
97-
* A difficultyWeight estimates how hard is to plan a certain PlanningEntity.
98-
* Some algorithms benefit from planning on more difficult planning entities first/last or from focusing on them.
99-
* <p>
100-
* The {@link Comparator} should sort in ascending difficulty
101-
* (even though many optimization algorithms will reverse it).
102-
* For example: sorting 3 processes on difficultly based on their RAM usage requirement:
103-
* Process B (1GB RAM), Process A (2GB RAM), Process C (7GB RAM),
104-
* <p>
105-
* Do not use together with {@link #difficultyWeightFactoryClass()}.
106-
*
107-
* @deprecated Deprecated in favor of {@link #comparatorClass()}.
108-
*
109-
* @return {@link NullDifficultyComparator} when it is null (workaround for annotation limitation)
110-
* @see #difficultyWeightFactoryClass()
111-
*/
112-
@Deprecated(forRemoval = true, since = "1.28.0")
113-
Class<? extends Comparator> difficultyComparatorClass() default NullDifficultyComparator.class;
114-
115-
/**
116-
* Workaround for annotation limitation in {@link #difficultyComparatorClass()}.
117-
*
118-
* @deprecated Deprecated in favor of {@link NullComparator}.
119-
*/
120-
@Deprecated(forRemoval = true, since = "1.28.0")
121-
interface NullDifficultyComparator<T> extends NullComparator<T> {
122-
}
123-
124-
/**
125-
* The {@link SelectionSorterWeightFactory} alternative for {@link #difficultyComparatorClass()}.
126-
* <p>
127-
* Do not use together with {@link #difficultyComparatorClass()}.
128-
*
129-
* @deprecated Deprecated in favor of {@link #comparatorFactoryClass()}.
130-
*
131-
* @return {@link NullDifficultyWeightFactory} when it is null (workaround for annotation limitation)
132-
* @see #difficultyComparatorClass()
133-
*/
134-
@Deprecated(forRemoval = true, since = "1.28.0")
135-
Class<? extends SelectionSorterWeightFactory> difficultyWeightFactoryClass() default NullDifficultyWeightFactory.class;
136-
137-
/**
138-
* Workaround for annotation limitation in {@link #difficultyWeightFactoryClass()}.
139-
*
140-
* @deprecated Deprecated in favor of {@link NullComparatorFactory}.
141-
*/
142-
@Deprecated(forRemoval = true, since = "1.28.0")
143-
interface NullDifficultyWeightFactory<Solution_, T>
144-
extends SelectionSorterWeightFactory<Solution_, T>,
145-
NullComparatorFactory<Solution_, T> {
146-
}
147-
14871
}

core/src/main/java/ai/timefold/solver/core/api/domain/solution/PlanningSolution.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import java.lang.annotation.Target;
88

99
import ai.timefold.solver.core.api.domain.autodiscover.AutoDiscoverMemberType;
10-
import ai.timefold.solver.core.api.domain.lookup.LookUpStrategyType;
11-
import ai.timefold.solver.core.api.domain.lookup.PlanningId;
1210
import ai.timefold.solver.core.api.domain.solution.cloner.SolutionCloner;
1311
import ai.timefold.solver.core.api.score.stream.ConstraintProvider;
1412

@@ -73,11 +71,4 @@
7371
interface NullSolutionCloner extends SolutionCloner {
7472
}
7573

76-
/**
77-
* @deprecated When multi-threaded solving, ensure your domain classes use {@link PlanningId} instead.
78-
*/
79-
@Deprecated(forRemoval = true, since = "1.10.0")
80-
@NonNull
81-
LookUpStrategyType lookUpStrategyType() default LookUpStrategyType.PLANNING_ID_OR_NONE;
82-
8374
}

core/src/main/java/ai/timefold/solver/core/api/domain/variable/PlanningVariable.java

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import ai.timefold.solver.core.api.domain.entity.PlanningEntity;
1313
import ai.timefold.solver.core.api.domain.solution.PlanningSolution;
1414
import ai.timefold.solver.core.api.domain.valuerange.ValueRangeProvider;
15-
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionSorterWeightFactory;
1615

1716
/**
1817
* Specifies that a bean property (or a field) can be changed and should be optimized by the optimization algorithms.
@@ -84,63 +83,4 @@ interface NullComparator<T> extends Comparator<T> {
8483
interface NullComparatorFactory<Solution_, T> extends ComparatorFactory<Solution_, T> {
8584
}
8685

87-
/**
88-
* As defined by {@link #allowsUnassigned()}.
89-
*
90-
* @deprecated Use {@link #allowsUnassigned()} instead.
91-
* @return true if null is a valid value for this planning variable
92-
*/
93-
@Deprecated(forRemoval = true, since = "1.8.0")
94-
boolean nullable() default false;
95-
96-
/**
97-
* Allows a collection of planning values for this variable to be sorted by strength.
98-
* A strengthWeight estimates how strong a planning value is.
99-
* Some algorithms benefit from planning on weaker planning values first or from focusing on them.
100-
* <p>
101-
* The {@link Comparator} should sort in ascending strength.
102-
* For example: sorting 3 computers on strength based on their RAM capacity:
103-
* Computer B (1GB RAM), Computer A (2GB RAM), Computer C (7GB RAM),
104-
* <p>
105-
* Do not use together with {@link #strengthWeightFactoryClass()}.
106-
*
107-
* @deprecated Deprecated in favor of {@link #comparatorClass()}.
108-
*
109-
* @return {@link NullStrengthComparator} when it is null (workaround for annotation limitation)
110-
* @see #strengthWeightFactoryClass()
111-
*/
112-
@Deprecated(forRemoval = true, since = "1.28.0")
113-
Class<? extends Comparator> strengthComparatorClass() default NullStrengthComparator.class;
114-
115-
/**
116-
* Workaround for annotation limitation in {@link #strengthComparatorClass()}.
117-
*
118-
* @deprecated Deprecated in favor of {@link NullComparator}.
119-
*/
120-
@Deprecated(forRemoval = true, since = "1.28.0")
121-
interface NullStrengthComparator<T> extends NullComparator<T> {
122-
}
123-
124-
/**
125-
* The {@link SelectionSorterWeightFactory} alternative for {@link #strengthComparatorClass()}.
126-
* <p>
127-
* Do not use together with {@link #strengthComparatorClass()}.
128-
*
129-
* @deprecated Deprecated in favor of {@link #comparatorFactoryClass()}.
130-
*
131-
* @return {@link NullStrengthWeightFactory} when it is null (workaround for annotation limitation)
132-
* @see #strengthComparatorClass()
133-
*/
134-
@Deprecated(forRemoval = true, since = "1.28.0")
135-
Class<? extends SelectionSorterWeightFactory> strengthWeightFactoryClass() default NullStrengthWeightFactory.class;
136-
137-
/**
138-
* Workaround for annotation limitation in {@link #strengthWeightFactoryClass()}.
139-
*
140-
* @deprecated Deprecated in favor of {@link NullComparatorFactory}.
141-
*/
142-
@Deprecated(forRemoval = true, since = "1.28.0")
143-
interface NullStrengthWeightFactory<Solution_, T>
144-
extends SelectionSorterWeightFactory<Solution_, T>, NullComparatorFactory<Solution_, T> {
145-
}
14686
}

core/src/main/java/ai/timefold/solver/core/api/score/director/ScoreDirector.java

Lines changed: 5 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package ai.timefold.solver.core.api.score.director;
22

3-
import ai.timefold.solver.core.api.domain.lookup.LookUpStrategyType;
4-
import ai.timefold.solver.core.api.domain.lookup.PlanningId;
3+
import ai.timefold.solver.core.api.domain.common.PlanningId;
54
import ai.timefold.solver.core.api.domain.solution.PlanningSolution;
65
import ai.timefold.solver.core.api.score.Score;
76
import ai.timefold.solver.core.api.solver.change.ProblemChange;
87

9-
import org.jspecify.annotations.NonNull;
8+
import org.jspecify.annotations.NullMarked;
109
import org.jspecify.annotations.Nullable;
1110

1211
/**
@@ -15,6 +14,7 @@
1514
*
1615
* @param <Solution_> the solution type, the class with the {@link PlanningSolution} annotation
1716
*/
17+
@NullMarked
1818
public interface ScoreDirector<Solution_> {
1919

2020
/**
@@ -23,7 +23,6 @@ public interface ScoreDirector<Solution_> {
2323
* Because a {@link Score} is best calculated incrementally (by deltas),
2424
* the {@link ScoreDirector} needs to be notified when its {@link PlanningSolution working solution} changes.
2525
*/
26-
@NonNull
2726
Solution_ getWorkingSolution();
2827

2928
void beforeVariableChanged(Object entity, String variableName);
@@ -44,103 +43,12 @@ public interface ScoreDirector<Solution_> {
4443

4544
void triggerVariableListeners();
4645

47-
/**
48-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
49-
* Use {@link ProblemChange} instead.
50-
*/
51-
@Deprecated(forRemoval = true, since = "1.8.0")
52-
default void beforeEntityAdded(Object entity) {
53-
throw new UnsupportedOperationException();
54-
}
55-
56-
/**
57-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
58-
* Use {@link ProblemChange} instead.
59-
*/
60-
@Deprecated(forRemoval = true, since = "1.8.0")
61-
default void afterEntityAdded(Object entity) {
62-
throw new UnsupportedOperationException();
63-
}
64-
65-
/**
66-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
67-
* Use {@link ProblemChange} instead.
68-
*/
69-
@Deprecated(forRemoval = true, since = "1.8.0")
70-
default void beforeEntityRemoved(Object entity) {
71-
throw new UnsupportedOperationException();
72-
}
73-
74-
/**
75-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
76-
* Use {@link ProblemChange} instead.
77-
*/
78-
@Deprecated(forRemoval = true, since = "1.8.0")
79-
default void afterEntityRemoved(Object entity) {
80-
throw new UnsupportedOperationException();
81-
}
82-
83-
/**
84-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
85-
* Use {@link ProblemChange} instead.
86-
*/
87-
@Deprecated(forRemoval = true, since = "1.8.0")
88-
default void beforeProblemFactAdded(Object problemFact) {
89-
throw new UnsupportedOperationException();
90-
}
91-
92-
/**
93-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
94-
* Use {@link ProblemChange} instead.
95-
*/
96-
@Deprecated(forRemoval = true, since = "1.8.0")
97-
default void afterProblemFactAdded(Object problemFact) {
98-
throw new UnsupportedOperationException();
99-
}
100-
101-
/**
102-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
103-
* Use {@link ProblemChange} instead.
104-
*/
105-
@Deprecated(forRemoval = true, since = "1.8.0")
106-
default void beforeProblemPropertyChanged(Object problemFactOrEntity) {
107-
throw new UnsupportedOperationException();
108-
}
109-
110-
/**
111-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
112-
* Use {@link ProblemChange} instead.
113-
*/
114-
@Deprecated(forRemoval = true, since = "1.8.0")
115-
default void afterProblemPropertyChanged(Object problemFactOrEntity) {
116-
throw new UnsupportedOperationException();
117-
}
118-
119-
/**
120-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
121-
* Use {@link ProblemChange} instead.
122-
*/
123-
@Deprecated(forRemoval = true, since = "1.8.0")
124-
default void beforeProblemFactRemoved(Object problemFact) {
125-
throw new UnsupportedOperationException();
126-
}
127-
128-
/**
129-
* @deprecated Calling this method by user code is not recommended and will lead to unforeseen consequences.
130-
* Use {@link ProblemChange} instead.
131-
*/
132-
@Deprecated(forRemoval = true, since = "1.8.0")
133-
default void afterProblemFactRemoved(Object problemFact) {
134-
throw new UnsupportedOperationException();
135-
}
136-
13746
/**
13847
* Translates an entity or fact instance (often from another {@link Thread} or JVM)
13948
* to this {@link ScoreDirector}'s internal working instance.
14049
* Useful for move rebasing and in a {@link ProblemChange}.
14150
* <p>
142-
* Matching is determined by the {@link LookUpStrategyType} on {@link PlanningSolution}.
143-
* Matching uses a {@link PlanningId} by default.
51+
* Matching uses {@link PlanningId}.
14452
*
14553
* @return null if externalObject is null
14654
* @throws IllegalArgumentException if there is no workingObject for externalObject, if it cannot be looked up
@@ -156,7 +64,7 @@ default void afterProblemFactRemoved(Object problemFact) {
15664
* It's recommended to use {@link #lookUpWorkingObject(Object)} instead,
15765
* especially in move rebasing code.
15866
*
159-
* @return null if externalObject is null or if there is no workingObject for externalObject
67+
* @return null if externalObject is null, or if there is no workingObject for externalObject
16068
* @throws IllegalArgumentException if it cannot be looked up or if the externalObject's class is not supported
16169
* @throws IllegalStateException if it cannot be looked up
16270
* @param <E> the object type

core/src/main/java/ai/timefold/solver/core/api/score/stream/ConstraintFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import java.util.function.Function;
55
import java.util.function.Predicate;
66

7+
import ai.timefold.solver.core.api.domain.common.PlanningId;
78
import ai.timefold.solver.core.api.domain.entity.PlanningEntity;
8-
import ai.timefold.solver.core.api.domain.lookup.PlanningId;
99
import ai.timefold.solver.core.api.domain.solution.ProblemFactCollectionProperty;
1010
import ai.timefold.solver.core.api.domain.variable.InverseRelationShadowVariable;
1111
import ai.timefold.solver.core.api.domain.variable.PlanningListVariable;

0 commit comments

Comments
 (0)