Closed Katsute closed 1 year ago
https://github.com/KatsuteDev/Mal4J/blob/bf3dcd641afbba5ec5c4937d20c4ffd808c3c00e/src/main/java/dev/katsute/mal4j/Json.java#L276-L299
Return null instead of throwing a NPE.
Use .valueOf rather than .parse, try catch on NFE.
.valueOf
.parse
https://github.com/KatsuteDev/Mal4J/blob/bf3dcd641afbba5ec5c4937d20c4ffd808c3c00e/src/main/java/dev/katsute/mal4j/Json.java#L301-L303
Return an empty JsonObject if null, this will protect against chained nulls.
JsonObject
https://github.com/KatsuteDev/Mal4J/blob/bf3dcd641afbba5ec5c4937d20c4ffd808c3c00e/src/main/java/dev/katsute/mal4j/Json.java#L313-L319
Return an empty array if null, this will protect against null loops.
Various as methods need to be rewritten to return null if null object.
as
These changes should remove the need for requireNonNull.
requireNonNull
@mashiro-san create a branch optimization
@Katsute I have created a new branch optimization@bf3dcd6
optimization@bf3dcd6
https://github.com/KatsuteDev/Mal4J/blob/bf3dcd641afbba5ec5c4937d20c4ffd808c3c00e/src/main/java/dev/katsute/mal4j/Json.java#L276-L299
Return null instead of throwing a NPE.
Use
.valueOf
rather than.parse
, try catch on NFE.https://github.com/KatsuteDev/Mal4J/blob/bf3dcd641afbba5ec5c4937d20c4ffd808c3c00e/src/main/java/dev/katsute/mal4j/Json.java#L301-L303
Return an empty
JsonObject
if null, this will protect against chained nulls.https://github.com/KatsuteDev/Mal4J/blob/bf3dcd641afbba5ec5c4937d20c4ffd808c3c00e/src/main/java/dev/katsute/mal4j/Json.java#L313-L319
Return an empty array if null, this will protect against null loops.
Various
as
methods need to be rewritten to return null if null object.These changes should remove the need for
requireNonNull
.