in webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanBuilder.java [49:102]
protected void validateNoDisposerWithoutProducer(Set<AnnotatedMethod<? super T>> annotatedMethods,
Set<ProducerMethodBean<?>> producerBeans,
Set<ProducerFieldBean<?>> producerFields,
Collection<AnnotatedMethod<?>> ignoredProducers)
{
for (AnnotatedMethod<?> annotatedMethod : annotatedMethods)
{
for (AnnotatedParameter<?> param : annotatedMethod.getParameters())
{
if (param.isAnnotationPresent(Disposes.class))
{
boolean found = false;
for (ProducerMethodBean<?> producer : producerBeans)
{
if (GenericsUtil.satisfiesDependency(false, true, producer.getCreatorMethod().getGenericReturnType(), param.getBaseType(), new HashMap<>()))
{
found = true;
break;
}
}
if (!found)
{
for (ProducerFieldBean<?> field : producerFields)
{
if (GenericsUtil.satisfiesDependency(false, true, field.getCreatorField().getType(), param.getBaseType(), new HashMap<>()))
{
found = true;
break;
}
}
if (!found)
{
// see if @Disposes should just be ignored as well - no inheritance
for (AnnotatedMethod<?> producer : ignoredProducers)
{
if (GenericsUtil.satisfiesDependency(false, true, producer.getJavaMember().getGenericReturnType(), param.getBaseType(), new HashMap<>()))
{
found = true;
break;
}
}
}
if (!found)
{
throw new WebBeansConfigurationException("@Disposes without @Produces " + annotatedMethod.getJavaMember());
}
}
break;
}
}
}
}