1212import java .util .List ;
1313import java .util .Map ;
1414
15+ import org .hibernate .models .ModelsException ;
1516import org .hibernate .models .spi .AnnotationDescriptor ;
1617import org .hibernate .models .spi .AttributeDescriptor ;
1718import org .hibernate .models .spi .MutableAnnotationDescriptor ;
@@ -116,7 +117,7 @@ private static <A extends Annotation, C extends A> MethodHandle resolveConstruct
116117 return MethodHandles .publicLookup ().findConstructor ( concreteClass , methodType );
117118 }
118119 catch (Exception e ) {
119- throw new MethodResolutionException ( "Unable to locate default-variant constructor for `" + concreteClass .getName () + "`" , e );
120+ throw new ModelsException ( "Unable to locate default-variant constructor for `" + concreteClass .getName () + "`" , e );
120121 }
121122 }
122123
@@ -131,7 +132,7 @@ public C createUsage(SourceModelBuildingContext context) {
131132 return (C ) constructor .invoke ( context );
132133 }
133134 catch (Throwable e ) {
134- throw new MethodInvocationException ( "Unable to invoke default-variant constructor for `" + concreteClass .getName () + "`" , e );
135+ throw new ModelsException ( "Unable to invoke default-variant constructor for `" + concreteClass .getName () + "`" , e );
135136 }
136137 }
137138 }
@@ -152,7 +153,7 @@ private static <A extends Annotation, C extends A> MethodHandle resolveConstruct
152153 return MethodHandles .publicLookup ().findConstructor ( concreteClass , methodType );
153154 }
154155 catch (Exception e ) {
155- throw new MethodResolutionException ( "Unable to locate JDK-variant constructor for `" + concreteClass .getName () + "`" , e );
156+ throw new ModelsException ( "Unable to locate JDK-variant constructor for `" + concreteClass .getName () + "`" , e );
156157 }
157158 }
158159
@@ -167,7 +168,7 @@ public C createUsage(A jdkAnnotation, SourceModelBuildingContext context) {
167168 return (C ) constructor .invoke ( jdkAnnotation , context );
168169 }
169170 catch (Throwable e ) {
170- throw new MethodInvocationException ( "Unable to invoke JDK-variant constructor for `" + concreteClass .getName () + "`" , e );
171+ throw new ModelsException ( "Unable to invoke JDK-variant constructor for `" + concreteClass .getName () + "`" , e );
171172 }
172173 }
173174 }
@@ -182,11 +183,11 @@ public DeTypedCreator(Class<A> annotationType, Class<C> concreteClass) {
182183
183184 private static <A extends Annotation , C extends A > MethodHandle resolveConstructor (Class <C > concreteClass ) {
184185 try {
185- final MethodType methodType = MethodType .methodType ( void .class , AnnotationInstance .class , SourceModelBuildingContext .class );
186+ final MethodType methodType = MethodType .methodType ( void .class , Map .class , SourceModelBuildingContext .class );
186187 return MethodHandles .publicLookup ().findConstructor ( concreteClass , methodType );
187188 }
188189 catch (Exception e ) {
189- throw new MethodResolutionException ( "Unable to locate Jandex-variant constructor for `" + concreteClass .getName () + "`" , e );
190+ throw new ModelsException ( "Unable to locate Jandex-variant constructor for `" + concreteClass .getName () + "`" , e );
190191 }
191192 }
192193
@@ -201,7 +202,7 @@ public C createUsage(Map<String,?> attributeValues, SourceModelBuildingContext c
201202 return (C ) constructor .invoke ( attributeValues , context );
202203 }
203204 catch (Throwable e ) {
204- throw new MethodInvocationException ( "Unable to invoke Jandex-variant constructor for `" + concreteClass .getName () + "`" , e );
205+ throw new ModelsException ( "Unable to invoke Jandex-variant constructor for `" + concreteClass .getName () + "`" , e );
205206 }
206207 }
207208 }
0 commit comments