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
Overview
Using the newly released JDK 16, attempting to get a list of all supported languages with LanguageTranslator.listLanguages() throws an InaccessibleObjectException. Before JDK 16, a reflection access warning would be printed to the console instead, but now it throws an exception and fails to get all supported languages. This seems to be due to the way that Gson is used, as this is also an issue here.
Expected behavior
LanguageTranslator outputs a list of all languages supported by Watson.
Actual behavior
An InaccessibleObjectException is thrown, and the operation fails.
How to reproduce
Make sure you are running JDK 16 or above.
Use the LanguageTranslator class to fetch the languages it supports, such as with the following code:
/* Init credentials */
IamAuthenticator authenticator = new IamAuthenticator.Builder().apikey(System.getProperty("WATSON_API_KEY")).build();
LanguageTranslator translatorService = new LanguageTranslator("2018-05-01", authenticator);
translatorService.setServiceUrl(System.getProperty("WATSON_SERVICE_URL"));
/* Get languages */
Languages allLanguages = translatorService.listLanguages().execute().getResult();
This code will succeed on older JDKs, but fail on 16. The authentication lines throw an InaccessibleObjectException, which can be seen in the screenshots below.
Screenshots
SDK Version
9.2.0 (Latest)
Additional information:
OS: Ubuntu 21.04
Java 16.0.1 2021-04-20 (64-Bit Build 16.0.1+9-24)
Additional context
N/A
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Check service status
No current service issues.
Overview
Using the newly released JDK 16, attempting to get a list of all supported languages with LanguageTranslator.listLanguages() throws an InaccessibleObjectException. Before JDK 16, a reflection access warning would be printed to the console instead, but now it throws an exception and fails to get all supported languages. This seems to be due to the way that Gson is used, as this is also an issue here.
Expected behavior
LanguageTranslator outputs a list of all languages supported by Watson.
Actual behavior
An InaccessibleObjectException is thrown, and the operation fails.
How to reproduce
Make sure you are running JDK 16 or above.
Use the LanguageTranslator class to fetch the languages it supports, such as with the following code:
This code will succeed on older JDKs, but fail on 16. The authentication lines throw an InaccessibleObjectException, which can be seen in the screenshots below.
Screenshots
SDK Version
9.2.0 (Latest)
Additional information:
Additional context
N/A
The text was updated successfully, but these errors were encountered: