@@ -222,14 +222,25 @@ public void attach(int index, @Nonnull final DetectionStore<R, T, S, P> detectio
222
222
}
223
223
224
224
void addValue (int index , @ Nonnull final IValue <T > iValue ) {
225
- this .detectionValues .compute (
225
+ addValue (this , index , iValue );
226
+ }
227
+
228
+ void addValue (
229
+ @ Nonnull DetectionStore <R , T , S , P > detectionStore ,
230
+ int index ,
231
+ @ Nonnull final IValue <T > iValue ) {
232
+ detectionStore .detectionValues .compute (
226
233
index ,
227
234
(i , list ) -> {
228
235
if (list == null ) {
236
+ // If the list is null, create a new ArrayList
237
+ // with the iValue and return it
229
238
final List <IValue <T >> values = new ArrayList <>();
230
239
values .add (iValue );
231
240
return values ;
232
241
} else {
242
+ // If the list is not null, add the iValue to it
243
+ // and return the modified list
233
244
list .add (iValue );
234
245
return list ;
235
246
}
@@ -289,7 +300,7 @@ public void onReceivingNewDetection(@Nonnull IDetection<T> detection) {
289
300
final Optional <Integer > positionMove = detectableParameter .getShouldBeMovedUnder ();
290
301
// Check if the parameter should be moved under
291
302
if (positionMove .isPresent ()) {
292
- final Integer id = positionMove .get ();
303
+ final int id = positionMove .get ();
293
304
// Get the iValue to be detected and store it in a variable
294
305
valueDetection
295
306
.toValue (valueDetection .detectableParameter ().getiValueFactory ())
@@ -304,30 +315,15 @@ public void onReceivingNewDetection(@Nonnull IDetection<T> detection) {
304
315
handler ,
305
316
statusReporting );
306
317
// Compute the detection values for the given id
307
- detectionStore .detectionValues .compute (
308
- id ,
309
- (i , list ) -> {
310
- if (list == null ) {
311
- // If the list is null, create a new ArrayList
312
- // with the iValue and return it
313
- final List <IValue <T >> values =
314
- new ArrayList <>();
315
- values .add (iValue );
316
- return values ;
317
- } else {
318
- // If the list is not null, add the iValue to it
319
- // and return the modified list
320
- list .add (iValue );
321
- return list ;
322
- }
323
- });
318
+ addValue (detectionStore , id , iValue );
324
319
// Attach the detection store to the given id
325
320
this .attach (id , detectionStore );
326
321
});
327
322
} else {
328
323
valueDetection
329
324
.toValue (valueDetection .detectableParameter ().getiValueFactory ())
330
- .ifPresent (iValue -> addValue (detectableParameter .getIndex (), iValue ));
325
+ .ifPresent (
326
+ iValue -> addValue (this , detectableParameter .getIndex (), iValue ));
331
327
}
332
328
333
329
// follow method parameter related detection rules
@@ -350,7 +346,13 @@ public void onReceivingNewDetection(@Nonnull IDetection<T> detection) {
350
346
// follow invoked object (object where the method was executed on) related detection
351
347
// rules
352
348
final TraceSymbol <S > traceSymbol = getAssignedTraceSymbol (valueDetection .expression ());
353
- final List <IDetectionRule <T >> nextDetectionRules = detectionRule .nextDetectionRules ();
349
+
350
+ final List <IDetectionRule <T >> nextDetectionRules ;
351
+ if (positionMove .isPresent ()) {
352
+ nextDetectionRules = List .of ();
353
+ } else {
354
+ nextDetectionRules = detectionRule .nextDetectionRules ();
355
+ }
354
356
this .statusReporting .addAdditionalExpectedRuleVisits (nextDetectionRules .size ());
355
357
handler .getLanguageSupport ()
356
358
.getEnclosingMethod (detection .expression ())
0 commit comments