12
12
import java .util .List ;
13
13
import java .util .Map ;
14
14
15
+ import org .hibernate .models .ModelsException ;
15
16
import org .hibernate .models .spi .AnnotationDescriptor ;
16
17
import org .hibernate .models .spi .AttributeDescriptor ;
17
18
import org .hibernate .models .spi .MutableAnnotationDescriptor ;
@@ -116,7 +117,7 @@ private static <A extends Annotation, C extends A> MethodHandle resolveConstruct
116
117
return MethodHandles .publicLookup ().findConstructor ( concreteClass , methodType );
117
118
}
118
119
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 );
120
121
}
121
122
}
122
123
@@ -131,7 +132,7 @@ public C createUsage(SourceModelBuildingContext context) {
131
132
return (C ) constructor .invoke ( context );
132
133
}
133
134
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 );
135
136
}
136
137
}
137
138
}
@@ -152,7 +153,7 @@ private static <A extends Annotation, C extends A> MethodHandle resolveConstruct
152
153
return MethodHandles .publicLookup ().findConstructor ( concreteClass , methodType );
153
154
}
154
155
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 );
156
157
}
157
158
}
158
159
@@ -167,7 +168,7 @@ public C createUsage(A jdkAnnotation, SourceModelBuildingContext context) {
167
168
return (C ) constructor .invoke ( jdkAnnotation , context );
168
169
}
169
170
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 );
171
172
}
172
173
}
173
174
}
@@ -182,11 +183,11 @@ public DeTypedCreator(Class<A> annotationType, Class<C> concreteClass) {
182
183
183
184
private static <A extends Annotation , C extends A > MethodHandle resolveConstructor (Class <C > concreteClass ) {
184
185
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 );
186
187
return MethodHandles .publicLookup ().findConstructor ( concreteClass , methodType );
187
188
}
188
189
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 );
190
191
}
191
192
}
192
193
@@ -201,7 +202,7 @@ public C createUsage(Map<String,?> attributeValues, SourceModelBuildingContext c
201
202
return (C ) constructor .invoke ( attributeValues , context );
202
203
}
203
204
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 );
205
206
}
206
207
}
207
208
}
0 commit comments