Skip to content

Commit 848aecc

Browse files
wing328pkernevez
andauthored
fix: [JAVA][SPRING] Nullaways warn with JSpecify => add missing annotation to parameter of method toIndentedString (#22685)
* fix: add annotation to method parameter * fix: all impacted samples --------- Co-authored-by: Philippe Kernevez <[email protected]>
1 parent e8faf7c commit 848aecc

File tree

1,198 files changed

+1198
-1197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,198 files changed

+1198
-1197
lines changed

modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}
349349
* Convert the given object to string with each line indented by 4 spaces
350350
* (except the first line).
351351
*/
352-
private String toIndentedString(Object o) {
352+
private String toIndentedString({{>nullableAnnotation}}Object o) {
353353
if (o == null) {
354354
return "null";
355355
}

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,6 +5117,7 @@ public void testCollectionTypesWithDefaults_issue_18102() throws IOException {
51175117
.fileContains("@Nullable Set<String> stringSet")
51185118
.fileContains("private Set<String> stringDefaultSet = new LinkedHashSet<>(Arrays.asList(\"A\", \"B\"));")
51195119
.fileContains("private Set<String> stringEmptyDefaultSet = new LinkedHashSet<>();")
5120+
.fileContains("private String toIndentedString(@Nullable Object o)")
51205121
.fileDoesNotContain("private List<@Valid TagDto> tags = new ArrayList<>()")
51215122
.fileDoesNotContain("private Set<@Valid TagDto> tagsUnique = new LinkedHashSet<>()")
51225123
.fileDoesNotContain("private List<String> stringList = new ArrayList<>()")

samples/client/petstore/spring-cloud-date-time/src/main/java/org/openapitools/model/Pet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public String toString() {
212212
* Convert the given object to string with each line indented by 4 spaces
213213
* (except the first line).
214214
*/
215-
private String toIndentedString(Object o) {
215+
private String toIndentedString(@Nullable Object o) {
216216
if (o == null) {
217217
return "null";
218218
}

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Category.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public String toString() {
9999
* Convert the given object to string with each line indented by 4 spaces
100100
* (except the first line).
101101
*/
102-
private String toIndentedString(Object o) {
102+
private String toIndentedString(@Nullable Object o) {
103103
if (o == null) {
104104
return "null";
105105
}

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/ModelApiResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public String toString() {
125125
* Convert the given object to string with each line indented by 4 spaces
126126
* (except the first line).
127127
*/
128-
private String toIndentedString(Object o) {
128+
private String toIndentedString(@Nullable Object o) {
129129
if (o == null) {
130130
return "null";
131131
}

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public String toString() {
238238
* Convert the given object to string with each line indented by 4 spaces
239239
* (except the first line).
240240
*/
241-
private String toIndentedString(Object o) {
241+
private String toIndentedString(@Nullable Object o) {
242242
if (o == null) {
243243
return "null";
244244
}

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public String toString() {
275275
* Convert the given object to string with each line indented by 4 spaces
276276
* (except the first line).
277277
*/
278-
private String toIndentedString(Object o) {
278+
private String toIndentedString(@Nullable Object o) {
279279
if (o == null) {
280280
return "null";
281281
}

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Tag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public String toString() {
9999
* Convert the given object to string with each line indented by 4 spaces
100100
* (except the first line).
101101
*/
102-
private String toIndentedString(Object o) {
102+
private String toIndentedString(@Nullable Object o) {
103103
if (o == null) {
104104
return "null";
105105
}

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/User.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public String toString() {
243243
* Convert the given object to string with each line indented by 4 spaces
244244
* (except the first line).
245245
*/
246-
private String toIndentedString(Object o) {
246+
private String toIndentedString(@Nullable Object o) {
247247
if (o == null) {
248248
return "null";
249249
}

samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/model/Category.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public String toString() {
100100
* Convert the given object to string with each line indented by 4 spaces
101101
* (except the first line).
102102
*/
103-
private String toIndentedString(Object o) {
103+
private String toIndentedString(@Nullable Object o) {
104104
if (o == null) {
105105
return "null";
106106
}

0 commit comments

Comments
 (0)