The Java SDK is officially released as of v1.0.0. This official release comes with several changes:
- The package is now com.mypurecloud:platform-client-v2. The v2 in the package name refers to the Platform API major version, not the SDK version.
- New repository for source code and releases: https://github.com/MyPureCloud/platform-client-sdk-java
- New documentation URL: https://developer.mypurecloud.com/api/rest/client-libraries/java/
-
ApiClient
now implements a builder pattern for any usage other than the default constructor
- All request methods now accept a request object that implement a builder pattern
- Models now implement the
PagedResource<T>
interface if the model is conformant
- The SDK supports your choice of Apache (default, sync), Ning (async), or OkHTTP (sync) client connectors
- General improvements to the SDK
- Some method names on the API classes have changed. The purpose of this change was to generally make the method names more consise. There is a source code upgrade script available that will attempt to upgrade method names from the old method names to the new method names. More information can be found at https://github.com/MyPureCloud/sdk-upgrade-script
- As of SDK version 5.0.1, the Java SDK may be used in Android applications built with Android Studio 2.4 Preview 6 or later.
Note: The old package, com.mypurecloud:platform-client, will continue to be available on maven central, but will not recieve any updates.
Does the SDK have a dependency on Java8?
There were a handful of builds that targeted Java 8, but the build target was changed back to Java 7 for Android compatibility (5.0.1+).
I am trying version 8.0.0 of platform-client-v2 and getting the following error when trying to call the Organization API. It seem to be rely on putIfAbsent method which is only available in Java8?
Any ideas?
2017-05-18 14:51:46,957 TRACE EXCP:ExceptionOccured
2017-05-18 14:51:46,958 TRACE java.lang.RuntimeException: java.lang.NoSuchMethodError: java.util.Map.putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
at com.mypurecloud.sdk.v2.api.OrganizationApi.getOrganizationsMe(OrganizationApi.java:185)
at com.mypurecloud.sdk.v2.api.OrganizationApi.getOrganizationsMeWithHttpInfo(OrganizationApi.java:138)
Hm, I think that's coming from here in ApiClient. Can you confirm that's where the inner exception is coming from in your case?
That object is just a plain HashMap<String, String>
, so it shouldn't be relying on Java 8 functionality. I'll take a look and see if I can figure out why that's being thrown. I've opened API-2594 to investigate.
Yes, the exception is coming from ApiClient (the line you mentioned).
@tim.smith is this now confirmed as a bug? Either way, would you have an idea on timescales on when this is likely to be fixed?
I've found that the SDK is still actually being compiled using the 1.8 JRE even though the compile target is 1.7. I'm trying to see if I can get it to compile under the 1.7 JRE. If that doesn't work for some reason, it's unlikely that further backporting work will occur; Java 7 is already more than 2 years out of support.
@tim.smith have you had the chance to review this further?
The Java 8 language constructs have been removed as of 8.0.2.