FasterXML / FasterXML/jackson3-dev

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

Đang mở
#6 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
functionality-change
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
6
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.