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

Rest Client Reactive default methods fail with Kotlin #22231

Closed
kdubb opened this issue Dec 15, 2021 · 5 comments
Closed

Rest Client Reactive default methods fail with Kotlin #22231

kdubb opened this issue Dec 15, 2021 · 5 comments
Labels
area/kotlin area/rest-client kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@kdubb
Copy link
Contributor

kdubb commented Dec 15, 2021

Describe the bug

Using a default method in a Kotlin interface defining a REST client results in an AbstractMethodError being thrown.

Expected behavior

Default methods should be usable in REST client methods. This is expected behavior according to #19226 (comment)

Actual behavior

AbstractMethodError is thrown for any defined default methods.

How to Reproduce?

  1. Run the Quarkus application
  2. Use curl -v http://localhost:8080/todos/block to see failure in a blocking method.
  3. Use curl -v http://localhost:8080/todos/co to see failure in a Kotlin coroutine.

code-with-quarkus.zip

Output of uname -a or ver

macOS 12.0.1

Output of java -version

17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.6.0.CR1

Build tool (ie. output of mvnw --version or gradlew --version)

gradle

Additional information

No response

@kdubb kdubb added the kind/bug Something isn't working label Dec 15, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 15, 2021

/cc @evanchooly, @michalszynkiewicz

@geoand
Copy link
Contributor

geoand commented Dec 15, 2021

I don't think we should fix this on our side actually, because it's very easy to work around the problem by adding:

          <args>
            <arg>-Xjvm-default=all</arg>
          </args>

in the configuration section of the kotlin-maven-plugin. See this for more details.

@michalszynkiewicz, @evanchooly do you agree?

@kdubb
Copy link
Contributor Author

kdubb commented Dec 15, 2021

The only issue I have with this is that it is infectious, you have to remember to add this to all projects. When it fails it's pretty easy to miss that it's the default methods that are causing it. It would be nice for it to "just work" or to have a warning/error generated.

That being said it seems like this is basically a Kotlin issue.

@kdubb
Copy link
Contributor Author

kdubb commented Dec 15, 2021

@geoand FYI, I did not know about this option previously. Thank you for the fix workaround.

@evanchooly
Copy link
Member

evanchooly commented Dec 15, 2021

I agree. That flag seems to fix it so we should go with that until that proves insufficient. Anything we try to do would be susceptible to variations in kotlin compiler changes which has already bitten us with panache.

@geoand geoand closed this as completed Dec 15, 2021
@geoand geoand added the triage/invalid This doesn't seem right label Dec 15, 2021
geoand added a commit that referenced this issue Dec 16, 2021
Add note about default Kotlin interface methods in REST Client docs
geoand added a commit to geoand/quarkus that referenced this issue Dec 16, 2021
michalszynkiewicz added a commit that referenced this issue Jan 4, 2022
Prohibit the use of legacy Kotlin interface default methods on Reactive REST Client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kotlin area/rest-client kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants