50
50
import java .nio .file .Files ;
51
51
import java .nio .file .NoSuchFileException ;
52
52
import java .nio .file .Path ;
53
- import java .util .ArrayList ;
54
53
import java .util .Arrays ;
55
54
import java .util .Objects ;
56
55
import java .util .Set ;
57
- import java .util .TreeMap ;
58
- import java .util .List ;
59
56
import java .util .Map ;
60
57
import java .util .concurrent .ConcurrentHashMap ;
58
+ import java .util .concurrent .ConcurrentLinkedQueue ;
61
59
import java .util .concurrent .ConcurrentSkipListMap ;
62
60
import java .util .stream .Collectors ;
63
61
import java .util .stream .Stream ;
@@ -75,7 +73,7 @@ public final class DynamicAccessDetectionFeature implements InternalFeature {
75
73
76
74
private record MethodsByAccessKind (Map <DynamicAccessDetectionPhase .DynamicAccessKind , CallLocationsByMethod > methodsByAccessKind ) {
77
75
MethodsByAccessKind () {
78
- this (new TreeMap <>());
76
+ this (new ConcurrentSkipListMap <>());
79
77
}
80
78
81
79
public Set <DynamicAccessDetectionPhase .DynamicAccessKind > getAccessKinds () {
@@ -87,17 +85,17 @@ public CallLocationsByMethod getCallLocationsByMethod(DynamicAccessDetectionPhas
87
85
}
88
86
}
89
87
90
- private record CallLocationsByMethod (Map <String , List <String >> callLocationsByMethod ) {
88
+ private record CallLocationsByMethod (Map <String , ConcurrentLinkedQueue <String >> callLocationsByMethod ) {
91
89
CallLocationsByMethod () {
92
- this (new TreeMap <>());
90
+ this (new ConcurrentSkipListMap <>());
93
91
}
94
92
95
93
public Set <String > getMethods () {
96
94
return callLocationsByMethod .keySet ();
97
95
}
98
96
99
- public List <String > getMethodCallLocations (String methodName ) {
100
- return callLocationsByMethod .getOrDefault (methodName , new ArrayList <>());
97
+ public ConcurrentLinkedQueue <String > getMethodCallLocations (String methodName ) {
98
+ return callLocationsByMethod .getOrDefault (methodName , new ConcurrentLinkedQueue <>());
101
99
}
102
100
}
103
101
@@ -136,12 +134,12 @@ public static DynamicAccessDetectionFeature instance() {
136
134
public void addCall (String entry , DynamicAccessDetectionPhase .DynamicAccessKind accessKind , String call , String callLocation ) {
137
135
MethodsByAccessKind entryContent = callsBySourceEntry .computeIfAbsent (entry , k -> new MethodsByAccessKind ());
138
136
CallLocationsByMethod methodCallLocations = entryContent .methodsByAccessKind ().computeIfAbsent (accessKind , k -> new CallLocationsByMethod ());
139
- List <String > callLocations = methodCallLocations .callLocationsByMethod ().computeIfAbsent (call , k -> new ArrayList <>());
137
+ ConcurrentLinkedQueue <String > callLocations = methodCallLocations .callLocationsByMethod ().computeIfAbsent (call , k -> new ConcurrentLinkedQueue <>());
140
138
callLocations .add (callLocation );
141
139
}
142
140
143
141
public MethodsByAccessKind getMethodsByAccessKind (String entry ) {
144
- return callsBySourceEntry .getOrDefault (entry , new MethodsByAccessKind ());
142
+ return callsBySourceEntry .computeIfAbsent (entry , k -> new MethodsByAccessKind ());
145
143
}
146
144
147
145
public UnmodifiableEconomicSet <String > getSourceEntries () {
0 commit comments