Skip to content

Commit

Permalink
ClientProxyGenerator - fix app class test for producers
Browse files Browse the repository at this point in the history
- and use the produced type to test the app class
- follows up on quarkusio#22828
  • Loading branch information
mkouba authored and aloubyansky committed Feb 13, 2022
1 parent d585928 commit 7a11fcb
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ public ClientProxyGenerator(Predicate<DotName> applicationClassPredicate, boolea
Collection<Resource> generate(BeanInfo bean, String beanClassName,
Consumer<BytecodeTransformer> bytecodeTransformerConsumer, boolean transformUnproxyableClasses) {

DotName testedName;
// For producers we need to test the produced type
if (bean.isProducerField()) {
testedName = bean.getTarget().get().asField().type().name();
} else if (bean.isProducerMethod()) {
testedName = bean.getTarget().get().asMethod().returnType().name();
} else {
testedName = bean.getBeanClass();
}

ProviderType providerType = new ProviderType(bean.getProviderType());
ClassInfo providerClass = getClassByName(bean.getDeployment().getBeanArchiveIndex(), providerType.name());
String baseName = getBaseName(bean, beanClassName);
Expand All @@ -87,7 +97,7 @@ Collection<Resource> generate(BeanInfo bean, String beanClassName,
return Collections.emptyList();
}

ResourceClassOutput classOutput = new ResourceClassOutput(applicationClassPredicate.test(bean.getBeanClass()),
ResourceClassOutput classOutput = new ResourceClassOutput(applicationClassPredicate.test(testedName),
name -> name.equals(generatedName) ? SpecialType.CLIENT_PROXY : null, generateSources);

// Foo_ClientProxy extends Foo implements ClientProxy
Expand Down

0 comments on commit 7a11fcb

Please sign in to comment.