@@ -805,10 +805,10 @@ protected JavaType _fromClass(Class<?> clz, TypeBindings context)
805
805
} else {
806
806
// 28-Apr-2015, tatu: New class of types, referential...
807
807
if (AtomicReference .class .isAssignableFrom (clz )) {
808
+
808
809
JavaType [] pts = findTypeParameters (clz , AtomicReference .class );
809
810
JavaType rt = (pts == null || pts .length != 1 ) ? unknownType () : pts [0 ];
810
811
result = constructReferenceType (clz , rt );
811
-
812
812
// 29-Sep-2014, tatu: We may want to pre-resolve well-known generic types
813
813
} else if (Map .Entry .class .isAssignableFrom (clz )) {
814
814
JavaType [] pts = findTypeParameters (clz , Map .Entry .class );
@@ -894,7 +894,7 @@ protected JavaType _fromParamType(ParameterizedType type, TypeBindings context)
894
894
895
895
// Ok: Map or Collection?
896
896
if (Map .class .isAssignableFrom (rawType )) {
897
- // 19-Mar-2015, tatu: Looks like 2nd arg ough to be Map.class, but that causes fails
897
+ // 19-Mar-2015, tatu: Looks like 2nd arg ought to be Map.class, but that causes fails
898
898
JavaType subtype = constructSimpleType (rawType , rawType , pt );
899
899
JavaType [] mapParams = findTypeParameters (subtype , Map .class );
900
900
if (mapParams .length != 2 ) {
@@ -903,21 +903,56 @@ protected JavaType _fromParamType(ParameterizedType type, TypeBindings context)
903
903
return MapType .construct (rawType , mapParams [0 ], mapParams [1 ]);
904
904
}
905
905
if (Collection .class .isAssignableFrom (rawType )) {
906
- // 19-Mar-2015, tatu: Looks like 2nd arg ough to be Collection.class, but that causes fails
906
+ // 19-Mar-2015, tatu: Looks like 2nd arg ought to be Collection.class, but that causes fails
907
907
JavaType subtype = constructSimpleType (rawType , rawType , pt );
908
908
JavaType [] collectionParams = findTypeParameters (subtype , Collection .class );
909
909
if (collectionParams .length != 1 ) {
910
910
throw new IllegalArgumentException ("Could not find 1 type parameter for Collection class " +rawType .getName ()+" (found " +collectionParams .length +")" );
911
911
}
912
912
return CollectionType .construct (rawType , collectionParams [0 ]);
913
913
}
914
+ // 28-Apr-2015, tatu: New class of types, referential...
915
+ if (AtomicReference .class .isAssignableFrom (rawType )) {
916
+ JavaType rt = null ;
917
+
918
+ if (rawType == AtomicReference .class ) {
919
+ if (paramCount == 1 ) {
920
+ rt = pt [0 ];
921
+ }
922
+ } else {
923
+ JavaType [] pts = findTypeParameters (rawType , AtomicReference .class );
924
+ if (pts != null && pts .length != 1 ) {
925
+ rt = pts [0 ];
926
+ }
927
+ }
928
+ return constructReferenceType (rawType , (rt == null ) ? unknownType () : rt );
929
+ }
930
+ if (Map .Entry .class .isAssignableFrom (rawType )) {
931
+ JavaType kt = null , vt = null ;
932
+
933
+ if (rawType == Map .Entry .class ) {
934
+ if (paramCount == 2 ) {
935
+ kt = pt [0 ];
936
+ vt = pt [1 ];
937
+ }
938
+ } else {
939
+ JavaType [] pts = findTypeParameters (rawType , Map .Entry .class );
940
+ if (pts != null && pts .length != 2 ) {
941
+ kt = pts [0 ];
942
+ vt = pts [1 ];
943
+ }
944
+ }
945
+ return constructSimpleType (rawType , Map .Entry .class , new JavaType [] {
946
+ (kt == null ) ? unknownType () : kt ,
947
+ (vt == null ) ? unknownType () : vt });
948
+ }
949
+
914
950
if (paramCount == 0 ) { // no generics
915
951
return new SimpleType (rawType );
916
952
}
917
953
return constructSimpleType (rawType , pt );
918
954
}
919
955
920
-
921
956
protected JavaType _fromArrayType (GenericArrayType type , TypeBindings context )
922
957
{
923
958
JavaType compType = _constructType (type .getGenericComponentType (), context );
0 commit comments