Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Language Translator] InaccessibleObjectException when fetching supported languages with JDK 16 #1171

Closed
dominicfeliton opened this issue Jun 7, 2021 · 3 comments

Comments

@dominicfeliton
Copy link

dominicfeliton commented Jun 7, 2021

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:

/* 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
Capture

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

@kevinkowa
Copy link
Contributor

Thanks, we will look into this!

@stale
Copy link

stale bot commented Oct 2, 2021

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.

@stale stale bot added the wontfix label Oct 2, 2021
@kevinkowa
Copy link
Contributor

Closing this issue since the core team is debugging it. Latest version of the core is using a newer version of gson, try it out with v9.3.1

@stale stale bot removed the wontfix label Dec 15, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

2 participants