Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strong typed API for synchronous TDLib method execution in Java inter…
…face `Client.execute` in Java interface is now strongly typed: returned TDLib object type depends on the return type defined in the corresponding Function class. When TDLib error is occurred, method now throws `Client.ExecutionError`. This change adds compile-time protection against return type change and allows using this pattern: ``` try { TdApi.SpecificReturnType result = Client.execute(function); // work with strongly typed resultl without casting and type checks } catch (Client.ExecutionError error) { // Handle error } ```
- Loading branch information
This breaks java Example compilation.
The following code :
now fails to compile with an error: