2121import org .hibernate .models .spi .VoidTypeDetails ;
2222import org .hibernate .models .spi .WildcardTypeDetails ;
2323
24- import static org .hibernate .models .internal .IsBoundTypeSwitch .IS_BOUND_SWITCH ;
25-
2624/**
2725 * TypeDetailsSwitch implementation checking whether a type is resolved (all of its bounds are known)
2826 *
3129public class IsResolvedTypeSwitch implements TypeDetailsSwitch <Boolean > {
3230 public static final IsResolvedTypeSwitch IS_RESOLVED_SWITCH = new IsResolvedTypeSwitch ();
3331
34- private static boolean isBound (TypeDetails typeDetails , SourceModelBuildingContext buildingContext ) {
35- return TypeDetailsSwitch .switchType ( typeDetails , IS_BOUND_SWITCH , buildingContext );
36- }
37-
3832 @ Override
3933 public Boolean caseClass (ClassTypeDetails classType , SourceModelBuildingContext buildingContext ) {
4034 return true ;
@@ -52,7 +46,7 @@ public Boolean caseVoid(VoidTypeDetails voidType, SourceModelBuildingContext bui
5246
5347 @ Override
5448 public Boolean caseArrayType (ArrayTypeDetails arrayType , SourceModelBuildingContext buildingContext ) {
55- return isBound ( arrayType .getConstituentType (), buildingContext );
49+ return arrayType .getConstituentType (). isResolved ( );
5650 }
5751
5852 @ Override
@@ -71,24 +65,19 @@ public Boolean caseParameterizedType(
7165 @ Override
7266 public Boolean caseWildcardType (WildcardTypeDetails wildcardType , SourceModelBuildingContext buildingContext ) {
7367 final TypeDetails bound = wildcardType .getBound ();
74- return bound != null && ( bound .getTypeKind () == TypeDetails . Kind . CLASS || isBound ( bound , buildingContext ) );
68+ return bound != null && bound .isResolved ( );
7569 }
7670
7771 @ Override
7872 public Boolean caseTypeVariable (TypeVariableDetails typeVariable , SourceModelBuildingContext buildingContext ) {
79- for ( TypeDetails bound : typeVariable .getBounds () ) {
80- if ( !isBound ( bound , buildingContext ) ) {
81- return false ;
82- }
83- }
84- return true ;
73+ return false ;
8574 }
8675
8776 @ Override
8877 public Boolean caseTypeVariableReference (
8978 TypeVariableReferenceDetails typeVariableReference ,
9079 SourceModelBuildingContext buildingContext ) {
91- return true ;
80+ return false ;
9281 }
9382
9483 @ Override
0 commit comments