Skip to content

Commit 519fa60

Browse files
committed
Merge branch '5.3.x'
2 parents 5d508de + 8087eb6 commit 519fa60

File tree

2 files changed

+69
-68
lines changed

2 files changed

+69
-68
lines changed

spring-core/src/main/java/org/springframework/core/ResolvableType.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,11 +48,11 @@
4848
* {@link #getGeneric(int...) generic parameters} along with the ability to ultimately
4949
* {@link #resolve() resolve} to a {@link java.lang.Class}.
5050
*
51-
* <p>{@code ResolvableTypes} may be obtained from {@link #forField(Field) fields},
52-
* {@link #forMethodParameter(Method, int) method parameters},
53-
* {@link #forMethodReturnType(Method) method returns} or
54-
* {@link #forClass(Class) classes}. Most methods on this class will themselves return
55-
* {@link ResolvableType ResolvableTypes}, allowing easy navigation. For example:
51+
* <p>A {@code ResolvableType} may be obtained from a {@linkplain #forField(Field) field},
52+
* a {@linkplain #forMethodParameter(Method, int) method parameter},
53+
* a {@linkplain #forMethodReturnType(Method) method return type}, or a
54+
* {@linkplain #forClass(Class) class}. Most methods on this class will themselves return
55+
* a {@code ResolvableType}, allowing for easy navigation. For example:
5656
* <pre class="code">
5757
* private HashMap&lt;Integer, List&lt;String&gt;&gt; myMap;
5858
*
@@ -182,7 +182,7 @@ private ResolvableType(Type type, @Nullable TypeProvider typeProvider,
182182

183183
/**
184184
* Private constructor used to create a new {@link ResolvableType} on a {@link Class} basis.
185-
* Avoids all {@code instanceof} checks in order to create a straight {@link Class} wrapper.
185+
* <p>Avoids all {@code instanceof} checks in order to create a straight {@link Class} wrapper.
186186
* @since 4.2
187187
*/
188188
private ResolvableType(@Nullable Class<?> clazz) {
@@ -406,7 +406,7 @@ public ResolvableType getComponentType() {
406406

407407
/**
408408
* Convenience method to return this type as a resolvable {@link Collection} type.
409-
* Returns {@link #NONE} if this type does not implement or extend
409+
* <p>Returns {@link #NONE} if this type does not implement or extend
410410
* {@link Collection}.
411411
* @see #as(Class)
412412
* @see #asMap()
@@ -417,7 +417,7 @@ public ResolvableType asCollection() {
417417

418418
/**
419419
* Convenience method to return this type as a resolvable {@link Map} type.
420-
* Returns {@link #NONE} if this type does not implement or extend
420+
* <p>Returns {@link #NONE} if this type does not implement or extend
421421
* {@link Map}.
422422
* @see #as(Class)
423423
* @see #asCollection()
@@ -458,7 +458,7 @@ public ResolvableType as(Class<?> type) {
458458

459459
/**
460460
* Return a {@link ResolvableType} representing the direct supertype of this type.
461-
* If no supertype is available this method returns {@link #NONE}.
461+
* <p>If no supertype is available this method returns {@link #NONE}.
462462
* <p>Note: The resulting {@link ResolvableType} instance may not be {@link Serializable}.
463463
* @see #getInterfaces()
464464
*/
@@ -607,7 +607,7 @@ private boolean isWildcardWithoutBounds() {
607607

608608
/**
609609
* Return a {@link ResolvableType} for the specified nesting level.
610-
* See {@link #getNested(int, Map)} for details.
610+
* <p>See {@link #getNested(int, Map)} for details.
611611
* @param nestingLevel the nesting level
612612
* @return the {@link ResolvableType} type, or {@code #NONE}
613613
*/
@@ -995,7 +995,7 @@ public String toString() {
995995
/**
996996
* Return a {@link ResolvableType} for the specified {@link Class},
997997
* using the full generic type information for assignability checks.
998-
* For example: {@code ResolvableType.forClass(MyArrayList.class)}.
998+
* <p>For example: {@code ResolvableType.forClass(MyArrayList.class)}.
999999
* @param clazz the class to introspect ({@code null} is semantically
10001000
* equivalent to {@code Object.class} for typical use cases here)
10011001
* @return a {@link ResolvableType} for the specified class
@@ -1010,7 +1010,7 @@ public static ResolvableType forClass(@Nullable Class<?> clazz) {
10101010
* Return a {@link ResolvableType} for the specified {@link Class},
10111011
* doing assignability checks against the raw class only (analogous to
10121012
* {@link Class#isAssignableFrom}, which this serves as a wrapper for.
1013-
* For example: {@code ResolvableType.forRawClass(List.class)}.
1013+
* <p>For example: {@code ResolvableType.forRawClass(List.class)}.
10141014
* @param clazz the class to introspect ({@code null} is semantically
10151015
* equivalent to {@code Object.class} for typical use cases here)
10161016
* @return a {@link ResolvableType} for the specified class
@@ -1039,7 +1039,7 @@ public boolean isAssignableFrom(ResolvableType other) {
10391039
/**
10401040
* Return a {@link ResolvableType} for the specified base type
10411041
* (interface or base class) with a given implementation class.
1042-
* For example: {@code ResolvableType.forClass(List.class, MyArrayList.class)}.
1042+
* <p>For example: {@code ResolvableType.forClass(List.class, MyArrayList.class)}.
10431043
* @param baseType the base type (must not be {@code null})
10441044
* @param implementationClass the implementation class
10451045
* @return a {@link ResolvableType} for the specified base type backed by the
@@ -1081,7 +1081,7 @@ public static ResolvableType forClassWithGenerics(Class<?> clazz, ResolvableType
10811081
Assert.notNull(clazz, "Class must not be null");
10821082
Assert.notNull(generics, "Generics array must not be null");
10831083
TypeVariable<?>[] variables = clazz.getTypeParameters();
1084-
Assert.isTrue(variables.length == generics.length, "Mismatched number of generics specified");
1084+
Assert.isTrue(variables.length == generics.length, () -> "Mismatched number of generics specified for " + clazz.toGenericString());
10851085

10861086
Type[] arguments = new Type[generics.length];
10871087
for (int i = 0; i < generics.length; i++) {
@@ -1234,7 +1234,7 @@ public static ResolvableType forMethodReturnType(Method method) {
12341234

12351235
/**
12361236
* Return a {@link ResolvableType} for the specified {@link Method} return type.
1237-
* Use this variant when the class that declares the method includes generic
1237+
* <p>Use this variant when the class that declares the method includes generic
12381238
* parameter variables that are satisfied by the implementation class.
12391239
* @param method the source for the method return type
12401240
* @param implementationClass the implementation class

0 commit comments

Comments
 (0)