Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Commit 5bae727

Browse files
chore: Throw IllegalStateException instead of RuntimeException
1 parent 8fb60b9 commit 5bae727

8 files changed

+16
-16
lines changed

timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableDecimalScorePythonJavaTypeMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public PythonLikeObject toPythonObject(BendableBigDecimalScore javaObject) {
5858
softScoresField.set(instance, toPythonList(javaObject.softScores()));
5959
return (PythonLikeObject) instance;
6060
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
61-
throw new RuntimeException(e);
61+
throw new IllegalStateException(e);
6262
}
6363
}
6464

@@ -82,7 +82,7 @@ public BendableBigDecimalScore toJavaObject(PythonLikeObject pythonObject) {
8282
return BendableBigDecimalScore.ofUninitialized(initScore, hardScores, softScores);
8383
}
8484
} catch (IllegalAccessException e) {
85-
throw new RuntimeException(e);
85+
throw new IllegalStateException(e);
8686
}
8787
}
8888
}

timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableScorePythonJavaTypeMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public PythonLikeObject toPythonObject(BendableLongScore javaObject) {
5555
softScoresField.set(instance, toPythonList(javaObject.softScores()));
5656
return (PythonLikeObject) instance;
5757
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
58-
throw new RuntimeException(e);
58+
throw new IllegalStateException(e);
5959
}
6060
}
6161

@@ -79,7 +79,7 @@ public BendableLongScore toJavaObject(PythonLikeObject pythonObject) {
7979
return BendableLongScore.ofUninitialized(initScore, hardScores, softScores);
8080
}
8181
} catch (IllegalAccessException e) {
82-
throw new RuntimeException(e);
82+
throw new IllegalStateException(e);
8383
}
8484
}
8585
}

timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftDecimalScorePythonJavaTypeMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public PythonLikeObject toPythonObject(HardMediumSoftBigDecimalScore javaObject)
5151
softScoreField.set(instance, new PythonDecimal(javaObject.softScore()));
5252
return (PythonLikeObject) instance;
5353
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
54-
throw new RuntimeException(e);
54+
throw new IllegalStateException(e);
5555
}
5656
}
5757

@@ -68,7 +68,7 @@ public HardMediumSoftBigDecimalScore toJavaObject(PythonLikeObject pythonObject)
6868
return HardMediumSoftBigDecimalScore.ofUninitialized(initScore, hardScore, mediumScore, softScore);
6969
}
7070
} catch (IllegalAccessException e) {
71-
throw new RuntimeException(e);
71+
throw new IllegalStateException(e);
7272
}
7373
}
7474
}

timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftScorePythonJavaTypeMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public PythonLikeObject toPythonObject(HardMediumSoftLongScore javaObject) {
5050
softScoreField.set(instance, PythonInteger.valueOf(javaObject.softScore()));
5151
return (PythonLikeObject) instance;
5252
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
53-
throw new RuntimeException(e);
53+
throw new IllegalStateException(e);
5454
}
5555
}
5656

@@ -67,7 +67,7 @@ public HardMediumSoftLongScore toJavaObject(PythonLikeObject pythonObject) {
6767
return HardMediumSoftLongScore.ofUninitialized(initScore, hardScore, mediumScore, softScore);
6868
}
6969
} catch (IllegalAccessException e) {
70-
throw new RuntimeException(e);
70+
throw new IllegalStateException(e);
7171
}
7272
}
7373
}

timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftDecimalScorePythonJavaTypeMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public PythonLikeObject toPythonObject(HardSoftBigDecimalScore javaObject) {
4848
softScoreField.set(instance, new PythonDecimal(javaObject.softScore()));
4949
return (PythonLikeObject) instance;
5050
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
51-
throw new RuntimeException(e);
51+
throw new IllegalStateException(e);
5252
}
5353
}
5454

@@ -64,7 +64,7 @@ public HardSoftBigDecimalScore toJavaObject(PythonLikeObject pythonObject) {
6464
return HardSoftBigDecimalScore.ofUninitialized(initScore, hardScore, softScore);
6565
}
6666
} catch (IllegalAccessException e) {
67-
throw new RuntimeException(e);
67+
throw new IllegalStateException(e);
6868
}
6969
}
7070
}

timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftScorePythonJavaTypeMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public PythonLikeObject toPythonObject(HardSoftLongScore javaObject) {
4646
softScoreField.set(instance, PythonInteger.valueOf(javaObject.softScore()));
4747
return (PythonLikeObject) instance;
4848
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
49-
throw new RuntimeException(e);
49+
throw new IllegalStateException(e);
5050
}
5151
}
5252

@@ -62,7 +62,7 @@ public HardSoftLongScore toJavaObject(PythonLikeObject pythonObject) {
6262
return HardSoftLongScore.ofUninitialized(initScore, hardScore, softScore);
6363
}
6464
} catch (IllegalAccessException e) {
65-
throw new RuntimeException(e);
65+
throw new IllegalStateException(e);
6666
}
6767
}
6868
}

timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleDecimalScorePythonJavaTypeMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public PythonLikeObject toPythonObject(SimpleBigDecimalScore javaObject) {
4545
scoreField.set(instance, new PythonDecimal(javaObject.score()));
4646
return (PythonLikeObject) instance;
4747
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
48-
throw new RuntimeException(e);
48+
throw new IllegalStateException(e);
4949
}
5050
}
5151

@@ -60,7 +60,7 @@ public SimpleBigDecimalScore toJavaObject(PythonLikeObject pythonObject) {
6060
return SimpleBigDecimalScore.ofUninitialized(initScore, score);
6161
}
6262
} catch (IllegalAccessException e) {
63-
throw new RuntimeException(e);
63+
throw new IllegalStateException(e);
6464
}
6565
}
6666
}

timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleScorePythonJavaTypeMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public PythonLikeObject toPythonObject(SimpleLongScore javaObject) {
4343
scoreField.set(instance, PythonInteger.valueOf(javaObject.score()));
4444
return (PythonLikeObject) instance;
4545
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
46-
throw new RuntimeException(e);
46+
throw new IllegalStateException(e);
4747
}
4848
}
4949

@@ -58,7 +58,7 @@ public SimpleLongScore toJavaObject(PythonLikeObject pythonObject) {
5858
return SimpleLongScore.ofUninitialized(initScore, score);
5959
}
6060
} catch (IllegalAccessException e) {
61-
throw new RuntimeException(e);
61+
throw new IllegalStateException(e);
6262
}
6363
}
6464
}

0 commit comments

Comments
 (0)