[java] Detect every lombok annotation in a space-separated additionalModelTypeAnnotations entry
Fixes #18868. Related: #17793.
additionalModelTypeAnnotations is split on ; and newlines only, so @lombok.Builder @lombok.NoArgsConstructor @lombok.AllArgsConstructor ends up as a single entry. The lombok detection in AbstractJavaCodegen.postProcessModels only called matcher.find() once per entry, so only Builder was recognised. The Spring generator then didn't know about NoArgsConstructor/AllArgsConstructor and emitted its own constructors next to Lombok's, which doesn't compile.
The fix loops over all matches in each entry. I also escaped the literal dot in @lombok..
Behaviour change: if you wrote space-separated entries, they now get the same lombok handling as the documented ; form. For example, @lombok.Getter @lombok.Data used to only register Getter. Now Data is detected too, so the model goes through the same template path as @lombok.Data on its own, including the @Data expansion from #25359. Templates themselves are unchanged.
Added SpringCodegenTest#testLombokAnnotationsSeparatedBySpace using the config from the issue. It fails on master ("Found constructor with parameter(s) []") and passes with the change. SpringCodegenTest and JavaClientCodegenTest are green (810 tests). The existing sample configs use ;, so no samples change.
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples (no sample changes)
- If your PR is targeting a particular programming language, @mention the technical committee members: @cachescrubber @welshm @MelleD @atextor @manedev79 @javisst @borsch @banlevente @Zomzog @martin-mfg @KannaKim
Summary by cubic
Fixes #18868 by detecting every Lombok annotation in a space-separated additionalModelTypeAnnotations entry instead of only the first, and escaping the literal dot in the @lombok. pattern.
Behavior change
- Space-separated entries now get the same Lombok handling as the documented
;-separated form. For example,@lombok.Getter @lombok.Datapreviously only registeredGetter; nowDatais detected too, so the model goes through thelombok.Datatemplate path (field-level validation/Jackson annotations from #22544, no generated getters/setters), meaning the remaining gaps from #17793 now apply to these configs as well. - Templates are unchanged and no sample configs change (existing ones use
;). Adds a regression test for the issue config that fails on master.