You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Java `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.
625
+
626
+
### Why do you represent fields using `JsonField<T>` instead of just plain `T`?
627
+
628
+
Using `JsonField<T>` enables a few features:
629
+
630
+
- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)
631
+
- Lazily [validating the API response against the expected shape](#response-validation)
632
+
- Representing absent vs explicitly null values
633
+
634
+
### Why don't you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?
635
+
636
+
It is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don't want to introduce a breaking change every time we add a field to a class.
637
+
638
+
### Why don't you use checked exceptions?
639
+
640
+
Checked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.
641
+
642
+
Checked exceptions:
643
+
644
+
- Are verbose to handle
645
+
- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error
646
+
- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)
647
+
- Don't play well with lambdas (also due to the function coloring problem)
648
+
620
649
## Semantic versioning
621
650
622
651
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
0 commit comments