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 extension seems to have problem with kotlin #5413

Closed
ia3andy opened this issue Nov 12, 2019 · 6 comments
Closed

Rest Client extension seems to have problem with kotlin #5413

ia3andy opened this issue Nov 12, 2019 · 6 comments
Labels
area/kotlin area/rest-client kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant triage/upstream Used for issues which are caused by issues in upstream projects/dependency

Comments

@ia3andy
Copy link
Contributor

ia3andy commented Nov 12, 2019

Describe the bug
I've tried to reproduce the doc tutorial using a kotlin environment https://quarkus.io/guides/rest-client. It won't instanciate the rest client:

org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [org.acme.ExampleResourceTest]: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.acme.CountriesService and qualifiers [@Default]
	- java member: org.acme.ExampleResource#countriesService
	- declared on CLASS bean [types=[org.acme.ExampleResource], qualifiers=[@Default, @Any], target=org.acme.ExampleResource]
	at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:850)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:220)
	at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:106)
	at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:251)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.acme.CountriesService and qualifiers [@Default]
	- java member: org.acme.ExampleResource#countriesService
	- declared on CLASS bean [types=[org.acme.ExampleResource], qualifiers=[@Default, @Any], target=org.acme.ExampleResource]
	at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:472)
	at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:404)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:212)
	... 14 more

Expected behavior
It should instanciate it and work

Actual behavior
We get an exception

To Reproduce
Steps to reproduce the behavior:

  1. https://code.quarkus.io/api/download?g=org.acme&a=code-with-quarkus&v=1.0.0-SNAPSHOT&b=MAVEN&c=org.acme.ExampleResource&e=io.quarkus%3Aquarkus-resteasy-jsonb&e=io.quarkus%3Aquarkus-rest-client&e=io.quarkus%3Aquarkus-kotlin
  2. Add a service:
package org.acme

import org.eclipse.microprofile.rest.client.inject.RegisterRestClient

import javax.ws.rs.GET
import javax.ws.rs.Path
import javax.ws.rs.Produces

@Path("/v2")
@RegisterRestClient(baseUri = "https://andy/")
interface CountriesService {

    @GET
    @Path("/get")
    @Produces("application/json")
    fun get(): Set<String>
}
  1. Inject it:
...
@Path("/hello")
class ExampleResource {

    @Inject
    @RestClient
    lateinit var countriesService: CountriesService
...
  1. run the test
@ia3andy ia3andy added the kind/bug Something isn't working label Nov 12, 2019
@ia3andy
Copy link
Contributor Author

ia3andy commented Nov 12, 2019

@ia3andy ia3andy closed this as completed Nov 12, 2019
@loicmathieu
Copy link
Contributor

@ia3andy maybe we can raise this issue on the MP RestClient side ? As I understand it, adding an @Target on the @RestClient annotation may help Kotlin.

@ia3andy
Copy link
Contributor Author

ia3andy commented Nov 13, 2019

@loicmathieu yeah, that would be great. I don't see why a developer should have to do something special to make it work.

@kenfinnigan
Copy link
Member

Raised eclipse/microprofile-rest-client#232

@gsmet gsmet reopened this Nov 15, 2019
@gsmet
Copy link
Member

gsmet commented Nov 15, 2019

I'm reopening this one. Let's close it when we upgrade MP Rest Client.

@gsmet gsmet added triage/upstream Used for issues which are caused by issues in upstream projects/dependency area/rest-client labels Nov 15, 2019
@geoand geoand added this to Todo in Kotlin roadmap via automation Jun 30, 2020
@emmanuelbernard
Copy link
Member

This is fixed AFAIK

@emmanuelbernard emmanuelbernard moved this from Todo to Done in Kotlin roadmap Jun 30, 2020
@gsmet gsmet added the triage/out-of-date This issue/PR is no longer valid or relevant label Jul 2, 2020
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/out-of-date This issue/PR is no longer valid or relevant triage/upstream Used for issues which are caused by issues in upstream projects/dependency
Projects
Development

No branches or pull requests

5 participants