Skip to content

Commit

Permalink
return empty list instead of throwing class not found
Browse files Browse the repository at this point in the history
  • Loading branch information
MrNavaStar committed Aug 18, 2024
1 parent a4d5fc6 commit 35c90b5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/me/mrnavastar/r/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.lang.reflect.*;
import java.util.Arrays;
import java.util.Objects;

public class R {

Expand Down Expand Up @@ -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[]{};
}
Expand Down

0 comments on commit 35c90b5

Please sign in to comment.