File tree Expand file tree Collapse file tree 3 files changed +28
-8
lines changed
main/java/org/hibernate/models/internal
test/java/org/hibernate/models/generics Expand file tree Collapse file tree 3 files changed +28
-8
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Hibernate, Relational Persistence for Idiomatic Java
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ * Copyright: Red Hat Inc. and Hibernate Authors
6+ */
7+ package org .hibernate .models .internal ;
8+
9+ import java .util .Objects ;
10+
11+ import org .hibernate .models .spi .ClassDetails ;
12+ import org .hibernate .models .spi .ClassTypeDetails ;
13+ import org .hibernate .models .spi .SourceModelBuildingContext ;
14+
15+ public class IsBoundTypeSwitch extends IsResolvedTypeSwitch {
16+ public static final IsBoundTypeSwitch IS_BOUND_SWITCH = new IsBoundTypeSwitch ();
17+
18+ @ Override
19+ public Boolean caseClass (ClassTypeDetails classType , SourceModelBuildingContext buildingContext ) {
20+ // not completely kosher, but works for our needs
21+ return !Objects .equals ( classType .getClassDetails (), ClassDetails .OBJECT_CLASS_DETAILS );
22+ }
23+ }
Original file line number Diff line number Diff line change 2323import org .hibernate .models .spi .VoidTypeDetails ;
2424import org .hibernate .models .spi .WildcardTypeDetails ;
2525
26+ import static org .hibernate .models .internal .IsBoundTypeSwitch .IS_BOUND_SWITCH ;
27+
2628/**
2729 * TypeDetailsSwitch implementation checking whether a type is resolved (all of its bounds are known)
2830 *
3133public class IsResolvedTypeSwitch implements TypeDetailsSwitch <Boolean > {
3234 public static final IsResolvedTypeSwitch IS_RESOLVED_SWITCH = new IsResolvedTypeSwitch ();
3335
34- public static boolean isBound (TypeDetails typeDetails , SourceModelBuildingContext buildingContext ) {
35- return TypeDetailsSwitch .switchType ( typeDetails , IS_RESOLVED_SWITCH , buildingContext );
36+ private static boolean isBound (TypeDetails typeDetails , SourceModelBuildingContext buildingContext ) {
37+ return TypeDetailsSwitch .switchType ( typeDetails , IS_BOUND_SWITCH , buildingContext );
3638 }
3739
3840 @ Override
3941 public Boolean caseClass (ClassTypeDetails classType , SourceModelBuildingContext buildingContext ) {
40- // not completely kosher, but works for our needs
41- //noinspection RedundantIfStatement
42- if ( Objects .equals ( classType .getClassDetails (), ClassDetails .OBJECT_CLASS_DETAILS ) ) {
43- return false ;
44- }
4542 return true ;
4643 }
4744
Original file line number Diff line number Diff line change @@ -72,8 +72,8 @@ void testParameterizedHierarchy(Index index) {
7272 assertThat ( bound .asClassType ().getClassDetails ().toJavaClass () ).isEqualTo ( Object .class );
7373
7474 final ClassBasedTypeDetails resolvedClassType = idField .resolveRelativeClassType ( rootClassDetails );
75+ assertThat ( idField .getType ().isResolved () ).isFalse ();
7576 assertThat ( resolvedClassType .getClassDetails ().toJavaClass () ).isEqualTo ( Object .class );
76- assertThat ( resolvedClassType .isResolved () ).isFalse ();
7777 }
7878
7979 {
You can’t perform that action at this time.
0 commit comments