@@ -61,11 +61,7 @@ public class MethodReader {
61
61
private final PathSegments pathSegments ;
62
62
private final boolean hasValid ;
63
63
64
- MethodReader (
65
- ControllerReader bean ,
66
- ExecutableElement element ,
67
- ExecutableType actualExecutable ,
68
- ProcessingContext ctx ) {
64
+ MethodReader (ControllerReader bean , ExecutableElement element , ExecutableType actualExecutable , ProcessingContext ctx ) {
69
65
this .ctx = ctx ;
70
66
this .bean = bean ;
71
67
this .element = element ;
@@ -78,25 +74,25 @@ public class MethodReader {
78
74
this .apiResponses = getApiResponses ();
79
75
initWebMethodViaAnnotation ();
80
76
if (isWebMethod ()) {
81
-
82
- Annotation jakarta = null ;
77
+ Annotation jakartaValidAnnotation = null ;
83
78
try {
84
- final var anno =
85
- (Class <Annotation >)
86
- Class .forName (Valid .class .getCanonicalName ().replace ("javax" , "jakarta" ));
87
- jakarta = findAnnotation (anno );
79
+ jakartaValidAnnotation = findAnnotation (jakartaValidAnnotation ());
88
80
} catch (final ClassNotFoundException e ) {
89
-
81
+ // ignore
90
82
}
91
-
92
- this .hasValid = findAnnotation (Valid .class ) != null || jakarta != null ;
83
+ this .hasValid = findAnnotation (Valid .class ) != null || jakartaValidAnnotation != null ;
93
84
this .pathSegments = PathSegments .parse (Util .combinePath (bean .path (), webMethodPath ));
94
85
} else {
95
86
this .hasValid = false ;
96
87
this .pathSegments = null ;
97
88
}
98
89
}
99
90
91
+ @ SuppressWarnings ("unchecked" )
92
+ private static Class <Annotation > jakartaValidAnnotation () throws ClassNotFoundException {
93
+ return (Class <Annotation >) Class .forName (Valid .class .getCanonicalName ().replace ("javax" , "jakarta" ));
94
+ }
95
+
100
96
@ Override
101
97
public String toString () {
102
98
return element .toString ();
0 commit comments