Skip to content

Commit 0ff9625

Browse files
authored
[Java] [Spring] Remove findBugs if useJspecify=true (#23492)
* Remove findBugs if useJspecify=true * Add unit tests * Improve formatting * Test spring-boot 2, 3 and 4
1 parent 1f18499 commit 0ff9625

File tree

23 files changed

+67
-46
lines changed

23 files changed

+67
-46
lines changed

modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ dependencies {
110110
{{#swagger2AnnotationLibrary}}
111111
implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version"
112112
{{/swagger2AnnotationLibrary}}
113+
{{^useJspecify}}
113114
implementation "com.google.code.findbugs:jsr305:3.0.2"
115+
{{/useJspecify}}
114116
{{^useJackson3}}
115117
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
116118
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"

modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,15 @@
263263
<!-- Note: jackson-datatype-jsr310 is included in jackson-databind for Jackson 3 -->
264264
<!-- Note: jackson-databind-nullable is not yet available for Jackson 3 -->
265265
{{/useJackson3}}
266+
{{^useJspecify}}
266267
267268
<!-- @Nullable annotation -->
268269
<dependency>
269270
<groupId>com.google.code.findbugs</groupId>
270271
<artifactId>jsr305</artifactId>
271272
<version>3.0.2</version>
272273
</dependency>
274+
{{/useJspecify}}
273275
<dependency>
274276
<groupId>jakarta.annotation</groupId>
275277
<artifactId>jakarta.annotation-api</artifactId>

modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ dependencies {
153153
{{#swagger2AnnotationLibrary}}
154154
implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version"
155155
{{/swagger2AnnotationLibrary}}
156+
{{^useJspecify}}
156157
implementation "com.google.code.findbugs:jsr305:3.0.2"
158+
{{/useJspecify}}
157159
implementation "org.springframework:spring-web:$spring_web_version"
158160
implementation "org.springframework:spring-context:$spring_web_version"
159161
implementation "{{jacksonPackage}}.core:jackson-core:$jackson_version"

modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@
237237
<version>${swagger-annotations-version}</version>
238238
</dependency>
239239
{{/swagger2AnnotationLibrary}}
240+
{{^useJspecify}}
240241

241242
<!-- @Nullable annotation -->
242243
<dependency>
@@ -245,6 +246,7 @@
245246
<version>3.0.2</version>
246247
</dependency>
247248

249+
{{/useJspecify}}
248250
<!-- HTTP client: Spring RestTemplate -->
249251
<dependency>
250252
<groupId>org.springframework</groupId>

modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ dependencies {
177177
{{#swagger2AnnotationLibrary}}
178178
implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version"
179179
{{/swagger2AnnotationLibrary}}
180+
{{^useJspecify}}
180181
implementation "com.google.code.findbugs:jsr305:3.0.2"
182+
{{/useJspecify}}
181183
implementation "io.projectreactor:reactor-core:$reactor_version"
182184
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
183185
implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version"

modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<version>${swagger-annotations-version}</version>
8787
</dependency>
8888
{{/swagger2AnnotationLibrary}}
89+
{{^useJspecify}}
8990

9091
<!-- @Nullable annotation -->
9192
<dependency>
@@ -94,6 +95,7 @@
9495
<version>3.0.2</version>
9596
</dependency>
9697

98+
{{/useJspecify}}
9799
<dependency>
98100
<groupId>io.projectreactor</groupId>
99101
<artifactId>reactor-core</artifactId>

modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb3.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,14 @@
158158
</dependency>
159159
{{/swagger2AnnotationLibrary}}
160160
{{/springDocDocumentationProvider}}
161+
{{^useJspecify}}
161162
<!-- @Nullable annotation -->
162163
<dependency>
163164
<groupId>com.google.code.findbugs</groupId>
164165
<artifactId>jsr305</artifactId>
165166
<version>3.0.2</version>
166167
</dependency>
168+
{{/useJspecify}}
167169
{{#withXml}}
168170
<!-- XML processing: Jackson -->
169171
<dependency>

modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,14 @@
162162
</dependency>
163163
{{/swagger2AnnotationLibrary}}
164164
{{/springDocDocumentationProvider}}
165+
{{^useJspecify}}
165166
<!-- @Nullable annotation -->
166167
<dependency>
167168
<groupId>com.google.code.findbugs</groupId>
168169
<artifactId>jsr305</artifactId>
169170
<version>3.0.2</version>
170171
</dependency>
172+
{{/useJspecify}}
171173
{{#withXml}}
172174
<!-- XML processing: Jackson -->
173175
<dependency>

modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,14 @@
173173
</dependency>
174174
{{/swagger2AnnotationLibrary}}
175175
{{/springDocDocumentationProvider}}
176+
{{^useJspecify}}
176177
<!-- @Nullable annotation -->
177178
<dependency>
178179
<groupId>com.google.code.findbugs</groupId>
179180
<artifactId>jsr305</artifactId>
180181
<version>3.0.2</version>
181182
</dependency>
183+
{{/useJspecify}}
182184
{{#withXml}}
183185
<!-- XML processing: Jackson -->
184186
<dependency>

modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
</dependency>
8585
{{/swagger2AnnotationLibrary}}
8686
{{/springDocDocumentationProvider}}
87+
{{^useJspecify}}
8788
<!-- @Nullable annotation -->
8889
<dependency>
8990
<groupId>com.google.code.findbugs</groupId>
@@ -92,6 +93,7 @@
9293
<version>3.0.2</version>
9394
{{/parentOverridden}}
9495
</dependency>
96+
{{/useJspecify}}
9597
<dependency>
9698
<groupId>org.springframework.cloud</groupId>
9799
<artifactId>spring-cloud-starter-openfeign</artifactId>

0 commit comments

Comments
 (0)