Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 137b5b6

Browse files
committed
Removes redundant casts
1 parent 0929f15 commit 137b5b6

File tree

66 files changed

+95
-348
lines changed

Some content is hidden

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

66 files changed

+95
-348
lines changed

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
213213
}
214214
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
215215
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
216-
if (!(itemInstance instanceof Object)) {
217-
throw new InvalidTypeException("Invalid instantiated value");
218-
}
219-
items.add((@Nullable Object) itemInstance);
216+
items.add(itemInstance);
220217
i += 1;
221218
}
222219
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
200200
}
201201
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
202202
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
203-
if (!(itemInstance instanceof Object)) {
204-
throw new InvalidTypeException("Invalid instantiated value");
205-
}
206-
items.add((@Nullable Object) itemInstance);
203+
items.add(itemInstance);
207204
i += 1;
208205
}
209206
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -421,10 +418,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
421418
}
422419
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
423420
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
424-
if (!(itemInstance instanceof Object)) {
425-
throw new InvalidTypeException("Invalid instantiated value");
426-
}
427-
items.add((@Nullable Object) itemInstance);
421+
items.add(itemInstance);
428422
i += 1;
429423
}
430424
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java

+3-12
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
194194
}
195195
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
196196
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
197-
if (!(itemInstance instanceof Object)) {
198-
throw new InvalidTypeException("Invalid instantiated value");
199-
}
200-
items.add((@Nullable Object) itemInstance);
197+
items.add(itemInstance);
201198
i += 1;
202199
}
203200
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -429,10 +426,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
429426
}
430427
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
431428
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
432-
if (!(itemInstance instanceof Object)) {
433-
throw new InvalidTypeException("Invalid instantiated value");
434-
}
435-
items.add((@Nullable Object) itemInstance);
429+
items.add(itemInstance);
436430
i += 1;
437431
}
438432
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -626,10 +620,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
626620
}
627621
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
628622
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
629-
if (!(itemInstance instanceof Object)) {
630-
throw new InvalidTypeException("Invalid instantiated value");
631-
}
632-
items.add((@Nullable Object) itemInstance);
623+
items.add(itemInstance);
633624
i += 1;
634625
}
635626
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java

+4-16
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
145145
}
146146
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
147147
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
148-
if (!(itemInstance instanceof Object)) {
149-
throw new InvalidTypeException("Invalid instantiated value");
150-
}
151-
items.add((@Nullable Object) itemInstance);
148+
items.add(itemInstance);
152149
i += 1;
153150
}
154151
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -333,10 +330,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
333330
}
334331
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
335332
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
336-
if (!(itemInstance instanceof Object)) {
337-
throw new InvalidTypeException("Invalid instantiated value");
338-
}
339-
items.add((@Nullable Object) itemInstance);
333+
items.add(itemInstance);
340334
i += 1;
341335
}
342336
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -521,10 +515,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
521515
}
522516
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
523517
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
524-
if (!(itemInstance instanceof Object)) {
525-
throw new InvalidTypeException("Invalid instantiated value");
526-
}
527-
items.add((@Nullable Object) itemInstance);
518+
items.add(itemInstance);
528519
i += 1;
529520
}
530521
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -723,10 +714,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
723714
}
724715
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
725716
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
726-
if (!(itemInstance instanceof Object)) {
727-
throw new InvalidTypeException("Invalid instantiated value");
728-
}
729-
items.add((@Nullable Object) itemInstance);
717+
items.add(itemInstance);
730718
i += 1;
731719
}
732720
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java

+3-12
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
144144
}
145145
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
146146
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
147-
if (!(itemInstance instanceof Object)) {
148-
throw new InvalidTypeException("Invalid instantiated value");
149-
}
150-
items.add((@Nullable Object) itemInstance);
147+
items.add(itemInstance);
151148
i += 1;
152149
}
153150
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -332,10 +329,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
332329
}
333330
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
334331
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
335-
if (!(itemInstance instanceof Object)) {
336-
throw new InvalidTypeException("Invalid instantiated value");
337-
}
338-
items.add((@Nullable Object) itemInstance);
332+
items.add(itemInstance);
339333
i += 1;
340334
}
341335
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -529,10 +523,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
529523
}
530524
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
531525
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
532-
if (!(itemInstance instanceof Object)) {
533-
throw new InvalidTypeException("Invalid instantiated value");
534-
}
535-
items.add((@Nullable Object) itemInstance);
526+
items.add(itemInstance);
536527
i += 1;
537528
}
538529
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java

+3-12
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
195195
}
196196
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
197197
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
198-
if (!(itemInstance instanceof Object)) {
199-
throw new InvalidTypeException("Invalid instantiated value");
200-
}
201-
items.add((@Nullable Object) itemInstance);
198+
items.add(itemInstance);
202199
i += 1;
203200
}
204201
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -430,10 +427,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
430427
}
431428
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
432429
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
433-
if (!(itemInstance instanceof Object)) {
434-
throw new InvalidTypeException("Invalid instantiated value");
435-
}
436-
items.add((@Nullable Object) itemInstance);
430+
items.add(itemInstance);
437431
i += 1;
438432
}
439433
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -675,10 +669,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
675669
}
676670
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
677671
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
678-
if (!(itemInstance instanceof Object)) {
679-
throw new InvalidTypeException("Invalid instantiated value");
680-
}
681-
items.add((@Nullable Object) itemInstance);
672+
items.add(itemInstance);
682673
i += 1;
683674
}
684675
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
164164
}
165165
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
166166
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
167-
if (!(itemInstance instanceof Object)) {
168-
throw new InvalidTypeException("Invalid instantiated value");
169-
}
170-
items.add((@Nullable Object) itemInstance);
167+
items.add(itemInstance);
171168
i += 1;
172169
}
173170
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
177177
}
178178
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
179179
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
180-
if (!(itemInstance instanceof Object)) {
181-
throw new InvalidTypeException("Invalid instantiated value");
182-
}
183-
items.add((@Nullable Object) itemInstance);
180+
items.add(itemInstance);
184181
i += 1;
185182
}
186183
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
177177
}
178178
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
179179
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
180-
if (!(itemInstance instanceof Object)) {
181-
throw new InvalidTypeException("Invalid instantiated value");
182-
}
183-
items.add((@Nullable Object) itemInstance);
180+
items.add(itemInstance);
184181
i += 1;
185182
}
186183
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
176176
}
177177
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
178178
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
179-
if (!(itemInstance instanceof Object)) {
180-
throw new InvalidTypeException("Invalid instantiated value");
181-
}
182-
items.add((@Nullable Object) itemInstance);
179+
items.add(itemInstance);
183180
i += 1;
184181
}
185182
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
156156
}
157157
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
158158
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
159-
if (!(itemInstance instanceof Object)) {
160-
throw new InvalidTypeException("Invalid instantiated value");
161-
}
162-
items.add((@Nullable Object) itemInstance);
159+
items.add(itemInstance);
163160
i += 1;
164161
}
165162
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -353,10 +350,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
353350
}
354351
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
355352
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
356-
if (!(itemInstance instanceof Object)) {
357-
throw new InvalidTypeException("Invalid instantiated value");
358-
}
359-
items.add((@Nullable Object) itemInstance);
353+
items.add(itemInstance);
360354
i += 1;
361355
}
362356
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java

+3-12
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
194194
}
195195
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
196196
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
197-
if (!(itemInstance instanceof Object)) {
198-
throw new InvalidTypeException("Invalid instantiated value");
199-
}
200-
items.add((@Nullable Object) itemInstance);
197+
items.add(itemInstance);
201198
i += 1;
202199
}
203200
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -429,10 +426,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
429426
}
430427
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
431428
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
432-
if (!(itemInstance instanceof Object)) {
433-
throw new InvalidTypeException("Invalid instantiated value");
434-
}
435-
items.add((@Nullable Object) itemInstance);
429+
items.add(itemInstance);
436430
i += 1;
437431
}
438432
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -626,10 +620,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
626620
}
627621
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
628622
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
629-
if (!(itemInstance instanceof Object)) {
630-
throw new InvalidTypeException("Invalid instantiated value");
631-
}
632-
items.add((@Nullable Object) itemInstance);
623+
items.add(itemInstance);
633624
i += 1;
634625
}
635626
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
144144
}
145145
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
146146
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
147-
if (!(itemInstance instanceof Object)) {
148-
throw new InvalidTypeException("Invalid instantiated value");
149-
}
150-
items.add((@Nullable Object) itemInstance);
147+
items.add(itemInstance);
151148
i += 1;
152149
}
153150
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);
@@ -332,10 +329,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
332329
}
333330
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
334331
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
335-
if (!(itemInstance instanceof Object)) {
336-
throw new InvalidTypeException("Invalid instantiated value");
337-
}
338-
items.add((@Nullable Object) itemInstance);
332+
items.add(itemInstance);
339333
i += 1;
340334
}
341335
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid
177177
}
178178
JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey();
179179
@Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas);
180-
if (!(itemInstance instanceof Object)) {
181-
throw new InvalidTypeException("Invalid instantiated value");
182-
}
183-
items.add((@Nullable Object) itemInstance);
180+
items.add(itemInstance);
184181
i += 1;
185182
}
186183
FrozenList<@Nullable Object> newInstanceItems = new FrozenList<>(items);

0 commit comments

Comments
 (0)