File tree Expand file tree Collapse file tree 3 files changed +17
-18
lines changed
jsonb-generator/src/main/java/io/avaje/jsonb/generator
jsonb/src/main/java/io/avaje/jsonb/stream Expand file tree Collapse file tree 3 files changed +17
-18
lines changed Original file line number Diff line number Diff line change 12
12
import java .util .List ;
13
13
import java .util .Map ;
14
14
import java .util .Optional ;
15
- import java .util .concurrent .atomic .AtomicBoolean ;
16
15
17
16
import javax .annotation .processing .ProcessingEnvironment ;
18
17
import javax .lang .model .element .Element ;
@@ -86,26 +85,22 @@ static void validateModule(String fqn) {
86
85
87
86
try (var reader = getModuleInfoReader ()) {
88
87
89
- AtomicBoolean noInjectPlugin = new AtomicBoolean (injectPresent );
88
+ var moduleInfo = new ModuleInfoReader (module , reader );
89
+
90
+ boolean noInjectPlugin =
91
+ injectPresent && !moduleInfo .containsOnModulePath ("io.avaje.jsonb.plugin" );
92
+
90
93
var noProvides =
91
- reader
92
- .lines ()
93
- .map (
94
- s -> {
95
- if (injectPresent
96
- && (s .contains ("io.avaje.jsonb.plugin" ) || s .contains ("io.avaje.nima" ))) {
97
- noInjectPlugin .set (false );
98
- }
99
- return s ;
100
- })
94
+ moduleInfo .provides ().stream ()
95
+ .flatMap (s -> s .implementations ().stream ())
101
96
.noneMatch (s -> s .contains (fqn ));
102
97
103
98
if (noProvides ) {
104
99
logError (
105
100
module , "Missing `provides io.avaje.jsonb.Jsonb.GeneratedComponent with %s;`" , fqn );
106
101
}
107
102
108
- if (noInjectPlugin . get () ) {
103
+ if (noInjectPlugin ) {
109
104
logWarn (
110
105
module ,
111
106
"`requires io.avaje.jsonb.plugin` must be explicity added or else avaje-inject may fail to detect and wire the default Jsonb instance" ,
Original file line number Diff line number Diff line change 14
14
import javax .lang .model .util .ElementFilter ;
15
15
16
16
import io .avaje .prism .GenerateAPContext ;
17
+ import io .avaje .prism .GenerateModuleInfoReader ;
17
18
18
19
import java .io .IOException ;
19
20
import java .util .*;
20
21
import java .util .function .Predicate ;
21
22
22
23
@ GenerateAPContext
24
+ @ GenerateModuleInfoReader
23
25
@ SupportedAnnotationTypes ({
24
26
CustomAdapterPrism .PRISM_TYPE ,
25
27
JSON ,
Original file line number Diff line number Diff line change 2
2
3
3
import java .util .function .Supplier ;
4
4
5
- /**
6
- * Strategy for recycling buffers used in parsing and generation.
7
- */
5
+ /** Strategy for recycling buffers used in parsing and generation. */
8
6
public enum BufferRecycleStrategy {
9
7
10
- HYBRID_POOL ( BufferRecycler :: hybrid ),
8
+ /** Do not perform any sort of recycling. */
11
9
NO_RECYCLING (BufferRecycler ::nonRecyclingPool ),
10
+ /** A lock free implementation designed for virtual thread use */
12
11
LOCK_FREE (BufferRecycler ::lockFreePool ),
13
- THREAD_LOCAL (BufferRecycler ::threadLocalPool );
12
+ /** Use Thread Locals for recycling buffers */
13
+ THREAD_LOCAL (BufferRecycler ::threadLocalPool ),
14
+ /** Use 2 recyclers and switch between them depending on the nature of thread (virtual or not) */
15
+ HYBRID_POOL (BufferRecycler ::hybrid );
14
16
15
17
private final Supplier <BufferRecycler > supplier ;
16
18
You can’t perform that action at this time.
0 commit comments