File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
main/java/io/swagger/util Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ public static boolean isConstructorCompatible(Constructor<?> constructor) {
145145 * @return list of Fields
146146 */
147147 public static List <Field > getDeclaredFields (Class <?> cls ) {
148- if (cls . equals ( Object .class )) {
148+ if (cls == null || Object .class . equals ( cls )) {
149149 return Collections .emptyList ();
150150 }
151151 final List <Field > fields = new ArrayList <Field >();
Original file line number Diff line number Diff line change 33import io .swagger .annotations .ApiOperation ;
44import io .swagger .annotations .ApiResponses ;
55import io .swagger .reflection .Child ;
6+ import io .swagger .reflection .IParent ;
67import io .swagger .reflection .Parent ;
78import io .swagger .util .ReflectionUtils ;
89
1213import java .lang .reflect .Method ;
1314import java .lang .reflect .Type ;
1415import java .util .Arrays ;
16+ import java .util .Collections ;
1517
1618import javax .ws .rs .Path ;
1719
@@ -114,4 +116,10 @@ public void testDerivedAnnotation() {
114116 Assert .assertNotNull (annotation );
115117 Assert .assertEquals (annotation .value (), "parentInterfacePath" );
116118 }
119+
120+ @ Test
121+ public void getDeclaredFieldsFromInterfaceTest () throws NoSuchMethodException {
122+ final Class cls = IParent .class ;
123+ Assert .assertEquals (Collections .emptyList (), ReflectionUtils .getDeclaredFields (cls ));
124+ }
117125}
You can’t perform that action at this time.
0 commit comments