Skip to content

Commit 16548d2

Browse files
committed
Consistent use of Class<?> in Assert
1 parent a19c976 commit 16548d2

File tree

1 file changed

+7
-7
lines changed
  • spring-core/src/main/java/org/springframework/util

1 file changed

+7
-7
lines changed

spring-core/src/main/java/org/springframework/util/Assert.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public static void hasText(String text) {
184184
*/
185185
public static void doesNotContain(String textToSearch, String substring, String message) {
186186
if (StringUtils.hasLength(textToSearch) && StringUtils.hasLength(substring) &&
187-
textToSearch.indexOf(substring) != -1) {
187+
textToSearch.contains(substring)) {
188188
throw new IllegalArgumentException(message);
189189
}
190190
}
@@ -236,8 +236,8 @@ public static void notEmpty(Object[] array) {
236236
*/
237237
public static void noNullElements(Object[] array, String message) {
238238
if (array != null) {
239-
for (int i = 0; i < array.length; i++) {
240-
if (array[i] == null) {
239+
for (Object element : array) {
240+
if (element == null) {
241241
throw new IllegalArgumentException(message);
242242
}
243243
}
@@ -315,7 +315,7 @@ public static void notEmpty(Map map) {
315315
* @throws IllegalArgumentException if the object is not an instance of clazz
316316
* @see Class#isInstance
317317
*/
318-
public static void isInstanceOf(Class clazz, Object obj) {
318+
public static void isInstanceOf(Class<?> clazz, Object obj) {
319319
isInstanceOf(clazz, obj, "");
320320
}
321321

@@ -331,7 +331,7 @@ public static void isInstanceOf(Class clazz, Object obj) {
331331
* @throws IllegalArgumentException if the object is not an instance of clazz
332332
* @see Class#isInstance
333333
*/
334-
public static void isInstanceOf(Class type, Object obj, String message) {
334+
public static void isInstanceOf(Class<?> type, Object obj, String message) {
335335
notNull(type, "Type to check against must not be null");
336336
if (!type.isInstance(obj)) {
337337
throw new IllegalArgumentException(
@@ -348,7 +348,7 @@ public static void isInstanceOf(Class type, Object obj, String message) {
348348
* @param subType the sub type to check
349349
* @throws IllegalArgumentException if the classes are not assignable
350350
*/
351-
public static void isAssignable(Class superType, Class subType) {
351+
public static void isAssignable(Class<?> superType, Class<?> subType) {
352352
isAssignable(superType, subType, "");
353353
}
354354

@@ -363,7 +363,7 @@ public static void isAssignable(Class superType, Class subType) {
363363
* ok when prepended to it.
364364
* @throws IllegalArgumentException if the classes are not assignable
365365
*/
366-
public static void isAssignable(Class superType, Class subType, String message) {
366+
public static void isAssignable(Class<?> superType, Class<?> subType, String message) {
367367
notNull(superType, "Type to check against must not be null");
368368
if (subType == null || !superType.isAssignableFrom(subType)) {
369369
throw new IllegalArgumentException(message + subType + " is not assignable to " + superType);

0 commit comments

Comments
 (0)