Skip to content

Commit

Permalink
Simplify name of generated exception mappers
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Nov 11, 2024
1 parent 7a6b0ee commit 5a71def
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.jboss.jandex.ParameterizedType;
import org.jboss.jandex.Type;
import org.jboss.resteasy.reactive.RestResponse;
import org.jboss.resteasy.reactive.common.processor.HashUtil;
import org.jboss.resteasy.reactive.server.SimpleResourceInfo;
import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext;
import org.jboss.resteasy.reactive.server.exceptionmappers.AsyncExceptionMappingUtil;
Expand Down Expand Up @@ -86,7 +87,7 @@ private ServerExceptionMapperGenerator() {
* <pre>
* &#64;Singleton
* &#64;Unremovable
* public class GreetingResource$GeneratedExceptionHandlerFor$IllegalArgumentException$OfMethod$perClassMapper
* public class GreetingResource$ExceptionMapper$123456
* implements ResteasyReactiveExceptionMapper {
*
* public Response toResponse(IllegalArgumentException e, ServerRequestContext ctx) {
Expand All @@ -101,7 +102,7 @@ private ServerExceptionMapperGenerator() {
* <pre>
* &#64;Singleton
* &#64;Unremovable
* public class GreetingResource$GeneratedExceptionHandlerFor$IllegalArgumentException$OfMethod$perClassMapper
* public class GreetingResource$ExceptionMapper$123456
* implements ResteasyReactiveAsyncExceptionMapper {
*
* public void asyncResponse(IllegalArgumentException e, AsyncExceptionMapperContext ctx) {
Expand Down Expand Up @@ -199,12 +200,12 @@ public static Map<String, String> generatePerClassMapper(MethodInfo targetMethod
*
* &#64;Singleton
* &#64;Unremovable
* public class CustomExceptionMapper$GeneratedExceptionHandlerFor$IllegalArgumentException$OfMethod$handle
* public class CustomExceptionMapper$ExceptionMapper$123456
* implements ResteasyReactiveExceptionMapper {
* private final CustomExceptionMapper delegate;
*
* &#64;Inject
* public CustomExceptionMapper$GeneratedExceptionHandlerFor$IllegalArgumentException$OfMethod$handle(
* public CustomExceptionMapper$ExceptionMapper$123456(
* CustomExceptionMapper var1) {
* this.delegate = var1;
* }
Expand All @@ -222,12 +223,12 @@ public static Map<String, String> generatePerClassMapper(MethodInfo targetMethod
*
* &#64;Singleton
* &#64;Unremovable
* public class CustomExceptionMapper$GeneratedExceptionHandlerFor$IllegalArgumentException$OfMethod$handle
* public class CustomExceptionMapper$ExceptionMapper$123456
* implements ResteasyReactiveAsyncExceptionMapper {
* private final CustomExceptionMapper delegate;
*
* &#64;Inject
* public CustomExceptionMapper$GeneratedExceptionHandlerFor$IllegalArgumentException$OfMethod$handle(
* public CustomExceptionMapper$ExceptionMapper$123456(
* CustomExceptionMapper var1) {
* this.delegate = var1;
* }
Expand Down Expand Up @@ -645,9 +646,8 @@ private static void checkModifiers(MethodInfo info) {
}

private static String getGeneratedClassName(MethodInfo targetMethod, Type handledExceptionType) {
return targetMethod.declaringClass().name() + "$GeneratedExceptionHandlerFor$"
+ handledExceptionType.name().withoutPackagePrefix()
+ "$OfMethod$" + targetMethod.name();
return targetMethod.declaringClass().name() + "$ExceptionMapper$"
+ HashUtil.sha1(targetMethod.name() + handledExceptionType.name().toString());
}

private enum ReturnType {
Expand Down

0 comments on commit 5a71def

Please sign in to comment.