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

Fix ClientProxyGenerator #29705

Merged
merged 1 commit into from Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -205,7 +205,12 @@ Collection<Resource> generate(BeanInfo bean, String beanClassName,
// Always use invokevirtual and the original descriptor for java.lang.Object#toString()
ret = forward.invokeVirtualMethod(originalMethodDescriptor, delegate, params);
} else if (isInterface) {
ret = forward.invokeInterfaceMethod(method, delegate, params);
// make sure we invoke the method upon the provider type, i.e. don't use the original method descriptor
MethodDescriptor virtualMethod = MethodDescriptor.ofMethod(providerType.className(),
originalMethodDescriptor.getName(),
originalMethodDescriptor.getReturnType(),
originalMethodDescriptor.getParameterTypes());
ret = forward.invokeInterfaceMethod(virtualMethod, delegate, params);
} else if (isReflectionFallbackNeeded(method, targetPackage)) {
// Reflection fallback
ResultHandle paramTypesArray = forward.newArray(Class.class, forward.load(method.parametersCount()));
Expand Down
@@ -0,0 +1,7 @@
package io.quarkus.arc.test.clientproxy.packageprivate;

// this interface is intentionally package-private
interface BaseInterface {

String ping();
}
@@ -0,0 +1,5 @@
package io.quarkus.arc.test.clientproxy.packageprivate;

public interface MyInterface extends BaseInterface {

}
@@ -0,0 +1,24 @@
package io.quarkus.arc.test.clientproxy.packageprivate;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.arc.Arc;
import io.quarkus.arc.test.ArcTestContainer;
import io.quarkus.arc.test.clientproxy.packageprivate.foo.MyInterface2;
import io.quarkus.arc.test.clientproxy.packageprivate.foo.Producer;

public class PackagePrivateInterfaceInHierarchyTest {

@RegisterExtension
public ArcTestContainer container = new ArcTestContainer(BaseInterface.class, MyInterface.class, MyInterface2.class,
Producer.class);

@Test
public void testProducer() {
assertEquals("quarkus", Arc.container().instance(MyInterface2.class).get().ping());
}

}
@@ -0,0 +1,7 @@
package io.quarkus.arc.test.clientproxy.packageprivate.foo;

import io.quarkus.arc.test.clientproxy.packageprivate.MyInterface;

public interface MyInterface2 extends MyInterface {

}
@@ -0,0 +1,20 @@
package io.quarkus.arc.test.clientproxy.packageprivate.foo;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;

@ApplicationScoped
public class Producer {

@Produces
@ApplicationScoped
public MyInterface2 myInterface2() {
return new MyInterface2() {
@Override
public String ping() {
return "quarkus";
}
};
}

}