File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed
main/java/org/springframework/data/util
test/java/org/springframework/data/util Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ public class ClassTypeInformation<S> extends TypeDiscoverer<S> {
6161
6262 private final Class <S > type ;
6363
64+ ClassTypeInformation (Class <?> type ) {
65+ this (ResolvableType .forType (type ));
66+ }
67+
6468 ClassTypeInformation (ResolvableType type ) {
6569 super (type );
6670 this .type = (Class <S >) type .resolve (Object .class );
Original file line number Diff line number Diff line change 4242@ SuppressWarnings ({ "deprecation" , "rawtypes" })
4343public interface TypeInformation <S > {
4444
45- TypeInformation <Collection > COLLECTION = ClassTypeInformation . COLLECTION ;
46- TypeInformation <List > LIST = ClassTypeInformation . LIST ;
47- TypeInformation <Set > SET = ClassTypeInformation . SET ;
48- TypeInformation <Map > MAP = ClassTypeInformation . MAP ;
49- TypeInformation <Object > OBJECT = ClassTypeInformation . OBJECT ;
45+ TypeInformation <Collection > COLLECTION = new ClassTypeInformation ( Collection . class ) ;
46+ TypeInformation <List > LIST = new ClassTypeInformation ( List . class ) ;
47+ TypeInformation <Set > SET = new ClassTypeInformation ( Set . class ) ;
48+ TypeInformation <Map > MAP = new ClassTypeInformation ( Map . class ) ;
49+ TypeInformation <Object > OBJECT = new ClassTypeInformation ( Object . class ) ;
5050
5151 /**
5252 * Creates a new {@link TypeInformation} from the given {@link ResolvableType}.
Original file line number Diff line number Diff line change 4545 */
4646public class ClassTypeInformationUnitTests {
4747
48+ @ Test // GH-3340
49+ void typeInformationConstantsShouldNotBeNull () {
50+
51+ assertThat (ClassTypeInformation .COLLECTION ).isNotNull ();
52+ assertThat (TypeInformation .COLLECTION ).isNotNull ();
53+ assertThat (TypeInformation .LIST ).isNotNull ();
54+ assertThat (TypeInformation .SET ).isNotNull ();
55+ assertThat (TypeInformation .MAP ).isNotNull ();
56+ assertThat (TypeInformation .OBJECT ).isNotNull ();
57+ assertThat (ClassTypeInformation .OBJECT ).isNotNull ();
58+
59+ assertThat (TypeInformation .COLLECTION ).isEqualTo (ClassTypeInformation .COLLECTION );
60+ assertThat (TypeInformation .LIST ).isEqualTo (ClassTypeInformation .LIST );
61+ assertThat (TypeInformation .SET ).isEqualTo (ClassTypeInformation .SET );
62+ assertThat (TypeInformation .MAP ).isEqualTo (ClassTypeInformation .MAP );
63+ assertThat (TypeInformation .OBJECT ).isEqualTo (ClassTypeInformation .OBJECT );
64+ }
65+
4866 @ Test
4967 public void discoversTypeForSimpleGenericField () {
5068
You can’t perform that action at this time.
0 commit comments