From 994e977e12df5916eda3ede9f63b1a99a2481bff Mon Sep 17 00:00:00 2001 From: MrNavaStar Date: Fri, 23 Aug 2024 22:10:18 -0600 Subject: [PATCH] calling `.generics()` on an enum will now return an empty array --- src/main/java/me/mrnavastar/r/R.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/me/mrnavastar/r/R.java b/src/main/java/me/mrnavastar/r/R.java index 3b0fa4f..741331d 100644 --- a/src/main/java/me/mrnavastar/r/R.java +++ b/src/main/java/me/mrnavastar/r/R.java @@ -109,6 +109,8 @@ public R call(String name, Object... args) { * Get a list of the generic type params of a class */ public Class[] generics() { + if (clazz.isEnum()) return new Class[]{}; // Enums cant have generics + Type generic = clazz.getGenericSuperclass(); if (generic instanceof ParameterizedType) { return Arrays.stream(((ParameterizedType) generic).getActualTypeArguments()).map(t -> {