@@ -215,30 +215,40 @@ else if ( typeDetails.getTypeKind() == TypeDetails.Kind.TYPE_VARIABLE ) {
215215
216216 /**
217217 * Given a type, resolve the underlying ClassDetails
218+ *
219+ * @see TypeDetails#determineRawClass()
218220 */
219- public static ClassDetails resolveRawClass (
220- TypeDetails typeDetails ,
221- @ SuppressWarnings ("unused" ) SourceModelBuildingContext buildingContext ) {
221+ public static ClassDetails resolveRawClass (TypeDetails typeDetails ) {
222222 switch ( typeDetails .getTypeKind () ) {
223223 case CLASS , PRIMITIVE , VOID , ARRAY -> {
224224 return ( (ClassBasedTypeDetails ) typeDetails ).getClassDetails ();
225225 }
226226 case TYPE_VARIABLE -> {
227227 final TypeVariableDetails resolvedTypeVariable = typeDetails .asTypeVariable ();
228228 if ( CollectionHelper .size ( resolvedTypeVariable .getBounds () ) == 1 ) {
229- // and assume the bound is a class
230- return resolvedTypeVariable .getBounds ().get ( 0 ).asClassType ().getClassDetails ();
229+ return resolvedTypeVariable .getBounds ().get ( 0 ).determineRawClass ();
231230 }
232231 return ClassDetails .OBJECT_CLASS_DETAILS ;
233232 }
234233 case PARAMETERIZED_TYPE -> {
235234 final ParameterizedTypeDetails parameterizedType = typeDetails .asParameterizedType ();
236235 if ( CollectionHelper .size ( parameterizedType .getArguments () ) == 1 ) {
237- // and assume the bound is a class
238- return parameterizedType .getArguments ().get ( 0 ).asClassType ().getClassDetails ();
236+ return parameterizedType .getArguments ().get ( 0 ).determineRawClass ();
239237 }
240238 return ClassDetails .OBJECT_CLASS_DETAILS ;
241239 }
240+ case WILDCARD_TYPE -> {
241+ final WildcardTypeDetails wildcardType = typeDetails .asWildcardType ();
242+ if ( wildcardType .getBound () != null ) {
243+ return wildcardType .getBound ().determineRawClass ();
244+ }
245+ return ClassDetails .OBJECT_CLASS_DETAILS ;
246+ }
247+ case TYPE_VARIABLE_REFERENCE -> {
248+ final String identifier = typeDetails .asTypeVariableReference ().getIdentifier ();
249+ final TypeDetails identifiedTypeDetails = typeDetails .resolveTypeVariable ( identifier );
250+ return identifiedTypeDetails .determineRawClass ();
251+ }
242252 }
243253 return ClassDetails .OBJECT_CLASS_DETAILS ;
244254 }
@@ -256,7 +266,7 @@ public static ArrayTypeDetails arrayOf(TypeDetails constituentType, SourceModelB
256266 .resolveClassDetails ( "[" + primitiveKind .getJavaTypeChar () );
257267 }
258268 else {
259- final ClassDetails rawComponentType = TypeDetailsHelper . resolveRawClass ( constituentType , buildingContext );
269+ final ClassDetails rawComponentType = constituentType . determineRawClass ( );
260270 final String arrayClassName = "[L" + rawComponentType .getName ().replace ( '.' , '/' ) + ";" ;
261271 arrayClassDetails = buildingContext
262272 .getClassDetailsRegistry ()
0 commit comments