5757import static org .hibernate .internal .util .StringHelper .root ;
5858import static org .hibernate .internal .util .StringHelper .split ;
5959import static org .hibernate .internal .util .StringHelper .unroot ;
60- import static org .hibernate .metamodel .model .domain .internal .JpaMetamodelImpl .addAllowedEnumLiteralsToEnumTypesMap ;
6160import static org .hibernate .processor .util .Constants .JAVA_OBJECT ;
6261
6362/**
@@ -90,7 +89,7 @@ public static MockSessionFactory create(
9089 private final Types typeUtil ;
9190 private final Filer filer ;
9291 private final Map <String , String > entityNameMappings ;
93- private final Map <String , Set <String >> allowedEnumLiteralsToEnumTypeNames ;
92+ private final Map <String , Set <String >> enumTypesByValue ;
9493
9594 public ProcessorSessionFactory (
9695 ProcessingEnvironment processingEnvironment ,
@@ -100,23 +99,7 @@ public ProcessorSessionFactory(
10099 typeUtil = processingEnvironment .getTypeUtils ();
101100 filer = processingEnvironment .getFiler ();
102101 this .entityNameMappings = entityNameMappings ;
103- final Map <String , Set <String >> allowedEnumLiteralsToEnumTypeNames = new HashMap <>( enumTypesByValue .size () << 2 );
104- for ( Map .Entry <String , Set <String >> entry : enumTypesByValue .entrySet () ) {
105- final String enumConstantName = entry .getKey ();
106- for ( String enumClassName : entry .getValue () ) {
107- final TypeElement enumTypeElement = elementUtil .getTypeElement ( enumClassName );
108- if ( enumTypeElement != null ) {
109- addAllowedEnumLiteralsToEnumTypesMap (
110- allowedEnumLiteralsToEnumTypeNames ,
111- enumConstantName ,
112- enumTypeElement .getSimpleName ().toString (),
113- elementUtil .getBinaryName ( enumTypeElement ).toString (),
114- enumClassName
115- );
116- }
117- }
118- }
119- this .allowedEnumLiteralsToEnumTypeNames = allowedEnumLiteralsToEnumTypeNames ;
102+ this .enumTypesByValue = enumTypesByValue ;
120103 }
121104
122105 @ Override
@@ -233,7 +216,7 @@ private static JdbcType enumJdbcType(Element member) {
233216
234217 @ Override @ Nullable
235218 Set <String > getEnumTypesForValue (String value ) {
236- final Set <String > result = allowedEnumLiteralsToEnumTypeNames .get ( value );
219+ final Set <String > result = enumTypesByValue .get (value );
237220 if ( result != null ) {
238221 return result ;
239222 }
0 commit comments