From 5bae727b430101249efb64b845350e9b4e7ba263 Mon Sep 17 00:00:00 2001 From: Christopher Chianelli Date: Fri, 12 Jul 2024 14:49:47 -0400 Subject: [PATCH] chore: Throw IllegalStateException instead of RuntimeException --- .../score/BendableDecimalScorePythonJavaTypeMapping.java | 4 ++-- .../python/score/BendableScorePythonJavaTypeMapping.java | 4 ++-- .../HardMediumSoftDecimalScorePythonJavaTypeMapping.java | 4 ++-- .../score/HardMediumSoftScorePythonJavaTypeMapping.java | 4 ++-- .../score/HardSoftDecimalScorePythonJavaTypeMapping.java | 4 ++-- .../python/score/HardSoftScorePythonJavaTypeMapping.java | 4 ++-- .../python/score/SimpleDecimalScorePythonJavaTypeMapping.java | 4 ++-- .../solver/python/score/SimpleScorePythonJavaTypeMapping.java | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableDecimalScorePythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableDecimalScorePythonJavaTypeMapping.java index 2d30aed..741be6a 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableDecimalScorePythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableDecimalScorePythonJavaTypeMapping.java @@ -58,7 +58,7 @@ public PythonLikeObject toPythonObject(BendableBigDecimalScore javaObject) { softScoresField.set(instance, toPythonList(javaObject.softScores())); return (PythonLikeObject) instance; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -82,7 +82,7 @@ public BendableBigDecimalScore toJavaObject(PythonLikeObject pythonObject) { return BendableBigDecimalScore.ofUninitialized(initScore, hardScores, softScores); } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableScorePythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableScorePythonJavaTypeMapping.java index 7a9e193..2f05fdc 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableScorePythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/BendableScorePythonJavaTypeMapping.java @@ -55,7 +55,7 @@ public PythonLikeObject toPythonObject(BendableLongScore javaObject) { softScoresField.set(instance, toPythonList(javaObject.softScores())); return (PythonLikeObject) instance; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -79,7 +79,7 @@ public BendableLongScore toJavaObject(PythonLikeObject pythonObject) { return BendableLongScore.ofUninitialized(initScore, hardScores, softScores); } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftDecimalScorePythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftDecimalScorePythonJavaTypeMapping.java index 18b5215..2edafd7 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftDecimalScorePythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftDecimalScorePythonJavaTypeMapping.java @@ -51,7 +51,7 @@ public PythonLikeObject toPythonObject(HardMediumSoftBigDecimalScore javaObject) softScoreField.set(instance, new PythonDecimal(javaObject.softScore())); return (PythonLikeObject) instance; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -68,7 +68,7 @@ public HardMediumSoftBigDecimalScore toJavaObject(PythonLikeObject pythonObject) return HardMediumSoftBigDecimalScore.ofUninitialized(initScore, hardScore, mediumScore, softScore); } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftScorePythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftScorePythonJavaTypeMapping.java index f98cf32..4f73c35 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftScorePythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardMediumSoftScorePythonJavaTypeMapping.java @@ -50,7 +50,7 @@ public PythonLikeObject toPythonObject(HardMediumSoftLongScore javaObject) { softScoreField.set(instance, PythonInteger.valueOf(javaObject.softScore())); return (PythonLikeObject) instance; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -67,7 +67,7 @@ public HardMediumSoftLongScore toJavaObject(PythonLikeObject pythonObject) { return HardMediumSoftLongScore.ofUninitialized(initScore, hardScore, mediumScore, softScore); } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftDecimalScorePythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftDecimalScorePythonJavaTypeMapping.java index 66cf0fe..af0ffd8 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftDecimalScorePythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftDecimalScorePythonJavaTypeMapping.java @@ -48,7 +48,7 @@ public PythonLikeObject toPythonObject(HardSoftBigDecimalScore javaObject) { softScoreField.set(instance, new PythonDecimal(javaObject.softScore())); return (PythonLikeObject) instance; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -64,7 +64,7 @@ public HardSoftBigDecimalScore toJavaObject(PythonLikeObject pythonObject) { return HardSoftBigDecimalScore.ofUninitialized(initScore, hardScore, softScore); } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftScorePythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftScorePythonJavaTypeMapping.java index 20b9486..15bc998 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftScorePythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/HardSoftScorePythonJavaTypeMapping.java @@ -46,7 +46,7 @@ public PythonLikeObject toPythonObject(HardSoftLongScore javaObject) { softScoreField.set(instance, PythonInteger.valueOf(javaObject.softScore())); return (PythonLikeObject) instance; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -62,7 +62,7 @@ public HardSoftLongScore toJavaObject(PythonLikeObject pythonObject) { return HardSoftLongScore.ofUninitialized(initScore, hardScore, softScore); } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleDecimalScorePythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleDecimalScorePythonJavaTypeMapping.java index f917ded..4f8cf3f 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleDecimalScorePythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleDecimalScorePythonJavaTypeMapping.java @@ -45,7 +45,7 @@ public PythonLikeObject toPythonObject(SimpleBigDecimalScore javaObject) { scoreField.set(instance, new PythonDecimal(javaObject.score())); return (PythonLikeObject) instance; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -60,7 +60,7 @@ public SimpleBigDecimalScore toJavaObject(PythonLikeObject pythonObject) { return SimpleBigDecimalScore.ofUninitialized(initScore, score); } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } diff --git a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleScorePythonJavaTypeMapping.java b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleScorePythonJavaTypeMapping.java index 749ec0f..bff4245 100644 --- a/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleScorePythonJavaTypeMapping.java +++ b/timefold-solver-python-core/src/main/java/ai/timefold/solver/python/score/SimpleScorePythonJavaTypeMapping.java @@ -43,7 +43,7 @@ public PythonLikeObject toPythonObject(SimpleLongScore javaObject) { scoreField.set(instance, PythonInteger.valueOf(javaObject.score())); return (PythonLikeObject) instance; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -58,7 +58,7 @@ public SimpleLongScore toJavaObject(PythonLikeObject pythonObject) { return SimpleLongScore.ofUninitialized(initScore, score); } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } }