diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/constraint/ConstraintRefPythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/constraint/ConstraintRefPythonJavaTypeMapping.java index 1654414..15dc8de 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/constraint/ConstraintRefPythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/constraint/ConstraintRefPythonJavaTypeMapping.java @@ -50,8 +50,8 @@ public PythonLikeObject toPythonObject(ConstraintRef javaObject) { @Override public ConstraintRef toJavaObject(PythonLikeObject pythonObject) { try { - var packageName = ((PythonString) packageNameField.get(pythonObject)).value.toString(); - var constraintName = ((PythonString) constraintNameField.get(pythonObject)).value.toString(); + var packageName = ((PythonString) packageNameField.get(pythonObject)).value; + var constraintName = ((PythonString) constraintNameField.get(pythonObject)).value; return ConstraintRef.of(packageName, constraintName); } catch (IllegalAccessException e) { throw new RuntimeException(e); diff --git a/timefold-solver-python-core/src/main/python/score/_score_analysis.py b/timefold-solver-python-core/src/main/python/score/_score_analysis.py index 08ab098..2d8a9d8 100644 --- a/timefold-solver-python-core/src/main/python/score/_score_analysis.py +++ b/timefold-solver-python-core/src/main/python/score/_score_analysis.py @@ -57,7 +57,7 @@ def constraint_id(self) -> str: @staticmethod def parse_id(constraint_id: str): slash_index = constraint_id.rfind('/') - if slash_index == -1: raise RuntimeError( + if slash_index == -1: raise IndexError( f'The constraint_id {constraint_id} is invalid as it does not contain a package separator \'/\'.') package_name = constraint_id[:slash_index] constraint_name = constraint_id[slash_index + 1:]