21
21
import org .hibernate .models .spi .VoidTypeDetails ;
22
22
import org .hibernate .models .spi .WildcardTypeDetails ;
23
23
24
- import static org .hibernate .models .internal .IsBoundTypeSwitch .IS_BOUND_SWITCH ;
25
-
26
24
/**
27
25
* TypeDetailsSwitch implementation checking whether a type is resolved (all of its bounds are known)
28
26
*
31
29
public class IsResolvedTypeSwitch implements TypeDetailsSwitch <Boolean > {
32
30
public static final IsResolvedTypeSwitch IS_RESOLVED_SWITCH = new IsResolvedTypeSwitch ();
33
31
34
- private static boolean isBound (TypeDetails typeDetails , SourceModelBuildingContext buildingContext ) {
35
- return TypeDetailsSwitch .switchType ( typeDetails , IS_BOUND_SWITCH , buildingContext );
36
- }
37
-
38
32
@ Override
39
33
public Boolean caseClass (ClassTypeDetails classType , SourceModelBuildingContext buildingContext ) {
40
34
return true ;
@@ -52,7 +46,7 @@ public Boolean caseVoid(VoidTypeDetails voidType, SourceModelBuildingContext bui
52
46
53
47
@ Override
54
48
public Boolean caseArrayType (ArrayTypeDetails arrayType , SourceModelBuildingContext buildingContext ) {
55
- return isBound ( arrayType .getConstituentType (), buildingContext );
49
+ return arrayType .getConstituentType (). isResolved ( );
56
50
}
57
51
58
52
@ Override
@@ -71,24 +65,19 @@ public Boolean caseParameterizedType(
71
65
@ Override
72
66
public Boolean caseWildcardType (WildcardTypeDetails wildcardType , SourceModelBuildingContext buildingContext ) {
73
67
final TypeDetails bound = wildcardType .getBound ();
74
- return bound != null && ( bound .getTypeKind () == TypeDetails . Kind . CLASS || isBound ( bound , buildingContext ) );
68
+ return bound != null && bound .isResolved ( );
75
69
}
76
70
77
71
@ Override
78
72
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 ;
85
74
}
86
75
87
76
@ Override
88
77
public Boolean caseTypeVariableReference (
89
78
TypeVariableReferenceDetails typeVariableReference ,
90
79
SourceModelBuildingContext buildingContext ) {
91
- return true ;
80
+ return false ;
92
81
}
93
82
94
83
@ Override
0 commit comments