I have a problem in using Drools Planner (written in Java) in Scala. One of interfaces in Drools planner is declared as:
public interface Score<S extends Score> extends Comparable<S>
However another interface uses ‘Score’ as a raw type:
public interface Solution {
Score getScore();
Then I’d like to implement this interface in Scala:
class MySolution extends Solution {
def getScore: Score = ...
And I get a compilation error: Scala compiler disallows writing just ‘def getScore: Score’. When I try adding ‘Score[_]’ or ‘Score[whatever]’ compiler complains about type incompatibility. What should I do?
The next release of Drools Planner (5.2.0.M2) will fix this issue.
Here’s the commit on git.
In some cases, people want to define their own
Scoreimplementation (for exampleNurseRosterScoreimplementsHardAndSoftScore), to be able to show to the user per hard or soft constraint type what exactly is violated in the best solution. This change is the first step to make that easier and cleaner (even though it’s already possible).