Skip to content

Commit a10f9f2

Browse files
committed
Polishing
1 parent dcedd29 commit a10f9f2

File tree

2 files changed

+15
-31
lines changed

2 files changed

+15
-31
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ public String toString() {
924924
* using the full generic type information for assignability checks.
925925
* For example: {@code ResolvableType.forClass(MyArrayList.class)}.
926926
* @param clazz the class to introspect ({@code null} is semantically
927-
* equivalent to {@code Object.class} for typical use cases here}
927+
* equivalent to {@code Object.class} for typical use cases here)
928928
* @return a {@link ResolvableType} for the specified class
929929
* @see #forClass(Class, Class)
930930
* @see #forClassWithGenerics(Class, Class...)
@@ -939,7 +939,7 @@ public static ResolvableType forClass(Class<?> clazz) {
939939
* {@link Class#isAssignableFrom}, which this serves as a wrapper for.
940940
* For example: {@code ResolvableType.forRawClass(List.class)}.
941941
* @param clazz the class to introspect ({@code null} is semantically
942-
* equivalent to {@code Object.class} for typical use cases here}
942+
* equivalent to {@code Object.class} for typical use cases here)
943943
* @return a {@link ResolvableType} for the specified class
944944
* @since 4.2
945945
* @see #forClass(Class)
@@ -1284,7 +1284,7 @@ private static ResolvableType[] forTypes(Type[] types, VariableResolver owner) {
12841284

12851285
/**
12861286
* Return a {@link ResolvableType} for the specified {@link Type}.
1287-
* Note: The resulting {@link ResolvableType} may not be {@link Serializable}.
1287+
* <p>Note: The resulting {@link ResolvableType} instance may not be {@link Serializable}.
12881288
* @param type the source type (potentially {@code null})
12891289
* @return a {@link ResolvableType} for the specified {@link Type}
12901290
* @see #forType(Type, ResolvableType)
@@ -1295,7 +1295,8 @@ public static ResolvableType forType(Type type) {
12951295

12961296
/**
12971297
* Return a {@link ResolvableType} for the specified {@link Type} backed by the given
1298-
* owner type. Note: The resulting {@link ResolvableType} may not be {@link Serializable}.
1298+
* owner type.
1299+
* <p>Note: The resulting {@link ResolvableType} instance may not be {@link Serializable}.
12991300
* @param type the source type or {@code null}
13001301
* @param owner the owner type used to resolve variables
13011302
* @return a {@link ResolvableType} for the specified {@link Type} and owner
@@ -1312,7 +1313,7 @@ public static ResolvableType forType(Type type, ResolvableType owner) {
13121313

13131314
/**
13141315
* Return a {@link ResolvableType} for the specified {@link ParameterizedTypeReference}.
1315-
* Note: The resulting {@link ResolvableType} may not be {@link Serializable}.
1316+
* <p>Note: The resulting {@link ResolvableType} instance may not be {@link Serializable}.
13161317
* @param typeReference the reference to obtain the source type from
13171318
* @return a {@link ResolvableType} for the specified {@link ParameterizedTypeReference}
13181319
* @since 4.3.12

spring-core/src/test/java/org/springframework/core/ResolvableTypeTests.java

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -414,12 +414,8 @@ public void getInterfaces() throws Exception {
414414
interfaces.add(interfaceType.toString());
415415
}
416416
assertThat(interfaces.toString(), equalTo(
417-
"["
418-
+ "java.io.Serializable, "
419-
+ "java.lang.Cloneable, "
420-
+ "java.util.List<java.lang.CharSequence>, "
421-
+ "java.util.RandomAccess"
422-
+ "]"));
417+
"[java.io.Serializable, java.lang.Cloneable, " +
418+
"java.util.List<java.lang.CharSequence>, java.util.RandomAccess]"));
423419
}
424420

425421
@Test
@@ -659,7 +655,7 @@ public void doesResolveFromOuterOwner() throws Exception {
659655

660656
@Test
661657
public void resolveBoundedTypeVariableResult() throws Exception {
662-
ResolvableType type = ResolvableType.forMethodReturnType(Methods.class.getMethod("boundedTypeVaraibleResult"));
658+
ResolvableType type = ResolvableType.forMethodReturnType(Methods.class.getMethod("boundedTypeVariableResult"));
663659
assertThat(type.resolve(), equalTo((Class) CharSequence.class));
664660
}
665661

@@ -670,42 +666,29 @@ public void resolveVariableNotFound() throws Exception {
670666
}
671667

672668
@Test
673-
public void resolveTypeVaraibleFromMethodReturn() throws Exception {
674-
ResolvableType type = ResolvableType.forMethodReturnType(Methods.class.getMethod("typedReturn"));
675-
assertThat(type.resolve(), nullValue());
676-
}
677-
678-
@Test
679-
public void resolveTypeVaraibleFromMethodReturnWithInstanceClass() throws Exception {
680-
ResolvableType type = ResolvableType.forMethodReturnType(
681-
Methods.class.getMethod("typedReturn"), TypedMethods.class);
682-
assertThat(type.resolve(), equalTo((Class) String.class));
683-
}
684-
685-
@Test
686-
public void resolveTypeVaraibleFromSimpleInterfaceType() {
669+
public void resolveTypeVariableFromSimpleInterfaceType() {
687670
ResolvableType type = ResolvableType.forClass(
688671
MySimpleInterfaceType.class).as(MyInterfaceType.class);
689672
assertThat(type.resolveGeneric(), equalTo((Class) String.class));
690673
}
691674

692675
@Test
693-
public void resolveTypeVaraibleFromSimpleCollectionInterfaceType() {
676+
public void resolveTypeVariableFromSimpleCollectionInterfaceType() {
694677
ResolvableType type = ResolvableType.forClass(
695678
MyCollectionInterfaceType.class).as(MyInterfaceType.class);
696679
assertThat(type.resolveGeneric(), equalTo((Class) Collection.class));
697680
assertThat(type.resolveGeneric(0, 0), equalTo((Class) String.class));
698681
}
699682

700683
@Test
701-
public void resolveTypeVaraibleFromSimpleSuperclassType() {
684+
public void resolveTypeVariableFromSimpleSuperclassType() {
702685
ResolvableType type = ResolvableType.forClass(
703686
MySimpleSuperclassType.class).as(MySuperclassType.class);
704687
assertThat(type.resolveGeneric(), equalTo((Class) String.class));
705688
}
706689

707690
@Test
708-
public void resolveTypeVaraibleFromSimpleCollectionSuperclassType() {
691+
public void resolveTypeVariableFromSimpleCollectionSuperclassType() {
709692
ResolvableType type = ResolvableType.forClass(
710693
MyCollectionSuperclassType.class).as(MySuperclassType.class);
711694
assertThat(type.resolveGeneric(), equalTo((Class) Collection.class));
@@ -1426,7 +1409,7 @@ interface Methods<T> {
14261409

14271410
void charSequenceParameter(List<CharSequence> cs);
14281411

1429-
<R extends CharSequence & Serializable> R boundedTypeVaraibleResult();
1412+
<R extends CharSequence & Serializable> R boundedTypeVariableResult();
14301413

14311414
void nested(Map<Map<String, Integer>, Map<Byte, Long>> p);
14321415

0 commit comments

Comments
 (0)