8
8
import lombok .RequiredArgsConstructor ;
9
9
import org .slf4j .Logger ;
10
10
11
+ @ SuppressWarnings ({"unchecked" , "rawtypes" , "PMD.LoggerIsNotStaticFinal" })
11
12
@ RequiredArgsConstructor
12
13
class HookSupport {
13
14
14
15
private final Logger log ;
15
16
16
- @ SuppressWarnings ({"unchecked" , "rawtypes" })
17
17
public void errorHooks (FlagValueType flagValueType , HookContext hookCtx , Exception e , List <Hook > hooks , Map <String , Object > hints ) {
18
18
executeHooks (flagValueType , hooks , "error" , hook -> hook .error (hookCtx , e , hints ));
19
19
}
20
20
21
- @ SuppressWarnings ({"unchecked" , "rawtypes" })
22
21
public void afterAllHooks (FlagValueType flagValueType , HookContext hookCtx , List <Hook > hooks , Map <String , Object > hints ) {
23
22
executeHooks (flagValueType , hooks , "finally" , hook -> hook .finallyAfter (hookCtx , hints ));
24
23
}
25
24
26
- @ SuppressWarnings ({"unchecked" , "rawtypes" })
27
25
public void afterHooks (FlagValueType flagValueType , HookContext hookContext , FlagEvaluationDetails details , List <Hook > hooks , Map <String , Object > hints ) {
28
26
executeHooksUnchecked (flagValueType , hooks , hook -> hook .after (hookContext , details , hints ));
29
27
}
30
28
31
- @ SuppressWarnings ({"unchecked" , "rawtypes" })
32
29
private <T > void executeHooks (
33
30
FlagValueType flagValueType , List <Hook > hooks ,
34
31
String hookMethod ,
@@ -40,7 +37,6 @@ private <T> void executeHooks(
40
37
.forEach (hook -> executeChecked (hook , hookCode , hookMethod ));
41
38
}
42
39
43
- @ SuppressWarnings ("rawtypes" )
44
40
private <T > void executeHooksUnchecked (
45
41
FlagValueType flagValueType , List <Hook > hooks ,
46
42
Consumer <Hook <T >> hookCode
@@ -59,13 +55,11 @@ private <T> void executeChecked(Hook<T> hook, Consumer<Hook<T>> hookCode, String
59
55
}
60
56
}
61
57
62
- @ SuppressWarnings ("rawtypes" )
63
58
public EvaluationContext beforeHooks (FlagValueType flagValueType , HookContext hookCtx , List <Hook > hooks , Map <String , Object > hints ) {
64
59
var result = callBeforeHooks (flagValueType , hookCtx , hooks , hints );
65
60
return EvaluationContext .merge (hookCtx .getCtx (), collectContexts (result ));
66
61
}
67
62
68
- @ SuppressWarnings ({"unchecked" , "rawtypes" })
69
63
private Stream <EvaluationContext > callBeforeHooks (FlagValueType flagValueType , HookContext hookCtx , List <Hook > hooks , Map <String , Object > hints ) {
70
64
// These traverse backwards from normal.
71
65
return Lists
0 commit comments