-
Notifications
You must be signed in to change notification settings - Fork 26
Description
I'm encountering an issue with the deepl-java library version 1.8.0 as distributed on Maven Central. The DeepLClient class in this version appears to only contain the deprecated constructor:
public DeepLClient(String authKey, TranslatorOptions options) throws IllegalArgumentException
This is problematic because the recommended and more modern way to initialize the DeepLClient (and the way documented on the GitHub repository) is with the constructor that takes only the authentication key:
public DeepLClient(String authKey) throws IllegalArgumentException
This constructor is missing from the 1.8.0 version available on Maven Central. This forces us to use the TranslatorOptions constructor, even when default options are sufficient. TranslatorOptions also appears to be deprecated, which differs from the TranslatorOptions source code.
Steps to Reproduce:
<dependency>
<groupId>com.deepl.api</groupId>
<artifactId>deepl-java</artifactId>
<version>1.8.0</version>
</dependency>
Attempt to create a DeepLClient:
String apiKey = "YOUR_API_KEY";
DeepLClient client = new DeepLClient(apiKey); // This will result in a compile error
Expected Behavior:
The DeepLClient(String authKey) constructor should be available in version 1.8.0, as it is in the source code on the GitHub repository: DeepLClient. Should be able to create a DeepLClient without needing to use the deprecated TranslatorOptions.
Actual Behavior:
The DeepLClient(String authKey) constructor is missing. The only available constructor is the deprecated DeepLClient(String authKey, TranslatorOptions options).
Workaround:
Using the deprecated constructor with default TranslatorOptions works:
String apiKey = "YOUR_API_KEY";
TranslatorOptions options = new TranslatorOptions();
DeepLClient client = new DeepLClient(apiKey, options);
However, this workaround is not ideal as it relies on deprecated code.
Environment:
Java version: 17
Build tool: Maven
deepl-java version: 1.8.0 (from Maven Central)
I believe there's a discrepancy between the 1.8.0 version on Maven Central and the source code on GitHub. Could this be investigated and corrected? Thanks.