@@ -206,33 +206,40 @@ private List<Class<?>> detectMethodParameters(
206206 }
207207 List <Class <?>> result = new ArrayList <>();
208208 for (Class <?> changedClass : changedClasses ) {
209- Method [] declaredMethods = changedClass .getDeclaredMethods ();
210209 boolean addClass = true ;
211- // capping scanning of methods to 100 to avoid generated class with thousand of methods
212- // assuming that in those first 100 methods there is at least one with at least one parameter
213- for (int methodIdx = 0 ; methodIdx < declaredMethods .length && methodIdx < 100 ; methodIdx ++) {
214- Method method = declaredMethods [methodIdx ];
215- Parameter [] parameters = method .getParameters ();
216- if (parameters .length == 0 ) {
217- continue ;
218- }
219- if (parameters [0 ].isNamePresent ()) {
220- if (!SpringHelper .isSpringUsingOnlyMethodParameters (instrumentation )) {
221- return changedClasses ;
210+ try {
211+ Method [] declaredMethods = changedClass .getDeclaredMethods ();
212+ // capping scanning of methods to 100 to avoid generated class with thousand of methods
213+ // assuming that in those first 100 methods there is at least one with at least one
214+ // parameter
215+ for (int methodIdx = 0 ;
216+ methodIdx < declaredMethods .length && methodIdx < 100 ;
217+ methodIdx ++) {
218+ Method method = declaredMethods [methodIdx ];
219+ Parameter [] parameters = method .getParameters ();
220+ if (parameters .length == 0 ) {
221+ continue ;
222+ }
223+ if (parameters [0 ].isNamePresent ()) {
224+ if (!SpringHelper .isSpringUsingOnlyMethodParameters (instrumentation )) {
225+ return changedClasses ;
226+ }
227+ LOGGER .debug (
228+ "Detecting method parameter: method={} param={}, Skipping retransforming this class" ,
229+ method .getName (),
230+ parameters [0 ].getName ());
231+ // skip the class: compiled with -parameters
232+ reportError (
233+ changes ,
234+ "Method Parameters detected, instrumentation not supported for "
235+ + changedClass .getTypeName ());
236+ addClass = false ;
222237 }
223- LOGGER .debug (
224- "Detecting method parameter: method={} param={}, Skipping retransforming this class" ,
225- method .getName (),
226- parameters [0 ].getName ());
227- // skip the class: compiled with -parameters
228- reportError (
229- changes ,
230- "Method Parameters detected, instrumentation not supported for "
231- + changedClass .getTypeName ());
232- addClass = false ;
238+ // we found at leat a method with one parameter if name is not present we can stop there
239+ break ;
233240 }
234- // we found at leat a method with one parameter if name is not present we can stop there
235- break ;
241+ } catch ( Exception e ) {
242+ LOGGER . debug ( "Exception scanning method parameters" , e ) ;
236243 }
237244 if (addClass ) {
238245 result .add (changedClass );
0 commit comments