File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
SequenceAnalysis/src/org/labkey/sequenceanalysis Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -126,15 +126,21 @@ public Class<?> findSuperClassParameterType(Object instance)
126126 }
127127
128128 // Based on: https://www.javacodegeeks.com/2013/12/advanced-java-generics-retreiving-generic-type-arguments.html
129- public static Class <?> findSuperClassParameterType (Object instance , int parameterIndex ) {
129+ public static Class <?> findSuperClassParameterType (Object instance , int parameterIndex )
130+ {
130131 Class <?> clazz = instance .getClass ();
131- while (clazz != clazz .getSuperclass ()) {
132+ if (clazz == null )
133+ {
134+ throw new IllegalStateException ("Class was null for instance: " + instance );
135+ }
136+
137+ while (clazz != null && clazz != clazz .getSuperclass ())
138+ {
132139 if (clazz .getGenericSuperclass () instanceof ParameterizedType pt )
133140 {
134141 return (Class <?>) pt .getActualTypeArguments ()[parameterIndex ];
135142 }
136143
137-
138144 clazz = clazz .getSuperclass ();
139145 }
140146
You can’t perform that action at this time.
0 commit comments