1 | package com.github.dakusui.osynth.core; | |
2 | ||
3 | import java.lang.reflect.Method; | |
4 | ||
5 | import static java.util.Objects.requireNonNull; | |
6 | ||
7 | public interface InvocationContext { | |
8 | ThreadLocal<InvocationContext> CONTEXT_THREAD_LOCAL = new ThreadLocal<>(); | |
9 | ||
10 | Method invokedMethod(); | |
11 | ||
12 | static InvocationContext forCurrentThread() { | |
13 |
1
1. forCurrentThread : replaced return value with null for com/github/dakusui/osynth/core/InvocationContext::forCurrentThread → KILLED |
return requireNonNull(CONTEXT_THREAD_LOCAL.get()); |
14 | } | |
15 | ||
16 | class Impl implements InvocationContext { | |
17 | private static void forCurrentThreadOrNewOneWith(Method invokedMethod) { | |
18 |
1
1. forCurrentThreadOrNewOneWith : removed call to com/github/dakusui/osynth/core/InvocationContext$Impl::invokedMethod → KILLED |
createContextIfNotYet().invokedMethod(invokedMethod); |
19 | } | |
20 | ||
21 | static void contextWith(Method invokedMethod) { | |
22 |
1
1. contextWith : removed call to com/github/dakusui/osynth/core/InvocationContext$Impl::forCurrentThreadOrNewOneWith → KILLED |
Impl.forCurrentThreadOrNewOneWith(invokedMethod); |
23 | } | |
24 | ||
25 | private static Impl createContextIfNotYet() { | |
26 | Impl ret = (Impl) CONTEXT_THREAD_LOCAL.get(); | |
27 |
1
1. createContextIfNotYet : negated conditional → KILLED |
if (ret == null) { |
28 | ret = new Impl(); | |
29 |
1
1. createContextIfNotYet : removed call to java/lang/ThreadLocal::set → SURVIVED |
CONTEXT_THREAD_LOCAL.set(ret); |
30 | } | |
31 |
1
1. createContextIfNotYet : replaced return value with null for com/github/dakusui/osynth/core/InvocationContext$Impl::createContextIfNotYet → KILLED |
return ret; |
32 | } | |
33 | ||
34 | private Method invokedMethod; | |
35 | ||
36 | void invokedMethod(Method invokedMethod) { | |
37 | this.invokedMethod = invokedMethod; | |
38 | } | |
39 | ||
40 | @Override | |
41 | public Method invokedMethod() { | |
42 |
1
1. invokedMethod : replaced return value with null for com/github/dakusui/osynth/core/InvocationContext$Impl::invokedMethod → KILLED |
return this.invokedMethod; |
43 | } | |
44 | } | |
45 | } | |
Mutations | ||
13 |
1.1 |
|
18 |
1.1 |
|
22 |
1.1 |
|
27 |
1.1 |
|
29 |
1.1 |
|
31 |
1.1 |
|
42 |
1.1 |