@@ -353,10 +353,8 @@ public static List<Class<?>> getAllInterfaces(final Class<?> cls) {
353353 if (cls == null ) {
354354 return null ;
355355 }
356-
357356 final LinkedHashSet <Class <?>> interfacesFound = new LinkedHashSet <>();
358357 getAllInterfaces (cls , interfacesFound );
359-
360358 return new ArrayList <>(interfacesFound );
361359 }
362360
@@ -369,13 +367,11 @@ public static List<Class<?>> getAllInterfaces(final Class<?> cls) {
369367 private static void getAllInterfaces (Class <?> cls , final HashSet <Class <?>> interfacesFound ) {
370368 while (cls != null ) {
371369 final Class <?>[] interfaces = cls .getInterfaces ();
372-
373370 for (final Class <?> i : interfaces ) {
374371 if (interfacesFound .add (i )) {
375372 getAllInterfaces (i , interfacesFound );
376373 }
377374 }
378-
379375 cls = cls .getSuperclass ();
380376 }
381377 }
@@ -737,7 +733,6 @@ public static String getPackageName(String className) {
737733 if (StringUtils .isEmpty (className )) {
738734 return StringUtils .EMPTY ;
739735 }
740-
741736 // Strip array encoding
742737 while (className .charAt (0 ) == '[' ) {
743738 className = className .substring (1 );
@@ -746,7 +741,6 @@ public static String getPackageName(String className) {
746741 if (className .charAt (0 ) == 'L' && className .charAt (className .length () - 1 ) == ';' ) {
747742 className = className .substring (1 );
748743 }
749-
750744 final int i = className .lastIndexOf (PACKAGE_SEPARATOR_CHAR );
751745 if (i == -1 ) {
752746 return StringUtils .EMPTY ;
@@ -785,15 +779,12 @@ static Class<?> getPrimitiveClass(final String className) {
785779 * requirements
786780 */
787781 public static Method getPublicMethod (final Class <?> cls , final String methodName , final Class <?>... parameterTypes ) throws NoSuchMethodException {
788-
789782 final Method declaredMethod = cls .getMethod (methodName , parameterTypes );
790783 if (isPublic (declaredMethod .getDeclaringClass ())) {
791784 return declaredMethod ;
792785 }
793-
794786 final List <Class <?>> candidateClasses = new ArrayList <>(getAllInterfaces (cls ));
795787 candidateClasses .addAll (getAllSuperclasses (cls ));
796-
797788 for (final Class <?> candidateClass : candidateClasses ) {
798789 if (!isPublic (candidateClass )) {
799790 continue ;
@@ -808,7 +799,6 @@ public static Method getPublicMethod(final Class<?> cls, final String methodName
808799 return candidateMethod ;
809800 }
810801 }
811-
812802 throw new NoSuchMethodException ("Can't find a public method for " + methodName + " " + ArrayUtils .toString (parameterTypes ));
813803 }
814804
@@ -1009,9 +999,7 @@ public static String getShortClassName(String className) {
1009999 if (StringUtils .isEmpty (className )) {
10101000 return StringUtils .EMPTY ;
10111001 }
1012-
10131002 final StringBuilder arrayPrefix = new StringBuilder ();
1014-
10151003 // Handle array encoding
10161004 if (className .startsWith ("[" )) {
10171005 while (className .charAt (0 ) == '[' ) {
@@ -1022,12 +1010,10 @@ public static String getShortClassName(String className) {
10221010 if (className .charAt (0 ) == 'L' && className .charAt (className .length () - 1 ) == ';' ) {
10231011 className = className .substring (1 , className .length () - 1 );
10241012 }
1025-
10261013 if (REVERSE_ABBREVIATION_MAP .containsKey (className )) {
10271014 className = REVERSE_ABBREVIATION_MAP .get (className );
10281015 }
10291016 }
1030-
10311017 final int lastDotIdx = className .lastIndexOf (PACKAGE_SEPARATOR_CHAR );
10321018 final int innerIdx = className .indexOf (INNER_CLASS_SEPARATOR_CHAR , lastDotIdx == -1 ? 0 : lastDotIdx + 1 );
10331019 String out = className .substring (lastDotIdx + 1 );
@@ -1185,7 +1171,7 @@ private void walkInterfaces(final Set<Class<?>> addTo, final Class<?> c) {
11851171 }
11861172
11871173 /**
1188- * Checks if one {@link Class} can be assigned to a variable of another {@link Class}.
1174+ * Tests whether one {@link Class} can be assigned to a variable of another {@link Class}.
11891175 *
11901176 * <p>
11911177 * Unlike the {@link Class#isAssignableFrom(java.lang.Class)} method, this method takes into account widenings of
@@ -1224,7 +1210,7 @@ public static boolean isAssignable(final Class<?> cls, final Class<?> toClass) {
12241210 }
12251211
12261212 /**
1227- * Checks if one {@link Class} can be assigned to a variable of another {@link Class}.
1213+ * Tests whether one {@link Class} can be assigned to a variable of another {@link Class}.
12281214 *
12291215 * <p>
12301216 * Unlike the {@link Class#isAssignableFrom(java.lang.Class)} method, this method takes into account widenings of
@@ -1312,7 +1298,7 @@ public static boolean isAssignable(Class<?> cls, final Class<?> toClass, final b
13121298 }
13131299
13141300 /**
1315- * Checks if an array of Classes can be assigned to another array of Classes.
1301+ * Tests whether an array of Classes can be assigned to another array of Classes.
13161302 *
13171303 * <p>
13181304 * This method calls {@link #isAssignable(Class, Class) isAssignable} for each Class pair in the input arrays. It can be
@@ -1357,7 +1343,7 @@ public static boolean isAssignable(final Class<?>[] classArray, final Class<?>..
13571343 }
13581344
13591345 /**
1360- * Checks if an array of Classes can be assigned to another array of Classes.
1346+ * Tests whether an array of Classes can be assigned to another array of Classes.
13611347 *
13621348 * <p>
13631349 * This method calls {@link #isAssignable(Class, Class) isAssignable} for each Class pair in the input arrays. It can be
@@ -1407,7 +1393,7 @@ public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArra
14071393 }
14081394
14091395 /**
1410- * Is the specified class an inner class or static nested class.
1396+ * Tests whether the specified class an inner class or static nested class.
14111397 *
14121398 * @param cls the class to check, may be null
14131399 * @return {@code true} if the class is an inner or static nested class, false if not or {@code null}
@@ -1417,7 +1403,7 @@ public static boolean isInnerClass(final Class<?> cls) {
14171403 }
14181404
14191405 /**
1420- * Returns whether the given {@code type} is a primitive or primitive wrapper ({@link Boolean}, {@link Byte},
1406+ * Tests whether the given {@code type} is a primitive or primitive wrapper ({@link Boolean}, {@link Byte},
14211407 * {@link Character}, {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
14221408 *
14231409 * @param type The class to query or null.
@@ -1431,6 +1417,7 @@ public static boolean isPrimitiveOrWrapper(final Class<?> type) {
14311417 }
14321418 return type .isPrimitive () || isPrimitiveWrapper (type );
14331419 }
1420+
14341421 /**
14351422 * Tests whether the given {@code type} is a primitive wrapper ({@link Boolean}, {@link Byte}, {@link Character},
14361423 * {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
@@ -1446,6 +1433,7 @@ public static boolean isPrimitiveWrapper(final Class<?> type) {
14461433
14471434 /**
14481435 * Tests whether a {@link Class} is public.
1436+ *
14491437 * @param cls Class to test.
14501438 * @return {@code true} if {@code cls} is public.
14511439 * @since 3.13.0
@@ -1466,11 +1454,9 @@ public static Class<?>[] primitivesToWrappers(final Class<?>... classes) {
14661454 if (classes == null ) {
14671455 return null ;
14681456 }
1469-
14701457 if (classes .length == 0 ) {
14711458 return classes ;
14721459 }
1473-
14741460 final Class <?>[] convertedClasses = new Class [classes .length ];
14751461 Arrays .setAll (convertedClasses , i -> primitiveToWrapper (classes [i ]));
14761462 return convertedClasses ;
@@ -1590,11 +1576,9 @@ public static Class<?>[] wrappersToPrimitives(final Class<?>... classes) {
15901576 if (classes == null ) {
15911577 return null ;
15921578 }
1593-
15941579 if (classes .length == 0 ) {
15951580 return classes ;
15961581 }
1597-
15981582 final Class <?>[] convertedClasses = new Class [classes .length ];
15991583 Arrays .setAll (convertedClasses , i -> wrapperToPrimitive (classes [i ]));
16001584 return convertedClasses ;
0 commit comments