FasterXML / FasterXML/jackson3-dev

Change `JsonNode.asXxx()` methods with no defaults to throw exception; add in `TreeNode`

Abierto
#6 0 comentarios 0 reacciones 0 asignados Ver en GitHub
functionality-change
Lenguaje dominante
Sin datos de lenguaje
Estrellas
6
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Currently various `asXxx()` methods (like, say, `asInt()`) return default value (like `0` for `int`) in case where no conversion is possible. But it would usually be better to instead throw an exception since there are already variants that allow passing of default value to return in invalid case.
Throwing exception instead would allow caller to avoid potentially odd and unhelpful coercions into default value. Given existence of alternatives with defaults no functionality would be removed.

In addition to this change it would make sense to add (demote) these methods in `TreeNode`, esp. since we can use Java 8 default methods for interfaces.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.