Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[JAVA] [Feign] Add support for Feign 13 #12524

Open
lucasls opened this issue Feb 21, 2025 · 0 comments
Open

[JAVA] [Feign] Add support for Feign 13 #12524

lucasls opened this issue Feb 21, 2025 · 0 comments

Comments

@lucasls
Copy link

lucasls commented Feb 21, 2025

Description

Compilation fails for the Java/Feign generator when Feign 13 and above are used. The reason is version 13 adds an overload to the RetryableException constructor with type Long instead of Date, and the value is passed as null causing the compiler to fail to with following message:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project swagger-petstore-feign: Compilation failure
[ERROR] /Users/lucas.santos/work/code/swagger-codegen/samples/client/petstore/java/feign/src/main/java/io/swagger/client/auth/OAuth.java:[96,19] reference to RetryableException is ambiguous
[ERROR]   both constructor RetryableException(int,java.lang.String,feign.Request.HttpMethod,java.lang.Throwable,java.lang.Long,feign.Request) in feign.RetryableException and constructor RetryableException(int,java.lang.String,feign.Request.HttpMethod,java.lang.Throwable,java.util.Date,feign.Request) in feign.RetryableException match

Description

The solution is simple, in this line:

throw new RetryableException(400, e.getMessage(), template.request().httpMethod(), e, null, template.request());

the type of the 5th parameter must be explicitly specified:

throw new RetryableException(400, e.getMessage(), template.request().httpMethod(), e, (Date) null, template.request());

This solution continues to use the deprecated version but keeps the generator compatible with versions that were already previously supported.

I'll submit a Merge Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant