From 35c90b5b5f05c0bae98dc853a0ee78192650ed31 Mon Sep 17 00:00:00 2001 From: MrNavaStar Date: Sun, 18 Aug 2024 14:20:16 -0600 Subject: [PATCH] return empty list instead of throwing class not found --- src/main/java/me/mrnavastar/r/R.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/mrnavastar/r/R.java b/src/main/java/me/mrnavastar/r/R.java index 08ecac1..3b0fa4f 100644 --- a/src/main/java/me/mrnavastar/r/R.java +++ b/src/main/java/me/mrnavastar/r/R.java @@ -2,6 +2,7 @@ import java.lang.reflect.*; import java.util.Arrays; +import java.util.Objects; public class R { @@ -114,9 +115,11 @@ public Class[] generics() { try { return Class.forName(t.getTypeName()); } catch (ClassNotFoundException e) { - throw new RuntimeException(e); + return null; } - }).toArray(Class[]::new); + }) + .filter(Objects::nonNull) + .toArray(Class[]::new); } return new Class[]{}; }