[jira] [Commented] (OWB-1164) Third Party Beans do not include Any qualifier if not included in bean impl

2016-12-29 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15785938#comment-15785938
 ] 

Mark Struberg commented on OWB-1164:


Indeed, if we end up having 2 'Any' annotations then there is a bug with 
equals/hashCode with one of the 2. 
Nonetheless checking for existence and only adding the annotation if missing is 
a good thing in terms of performance. 
Will do another perf tweak.

> Third Party Beans do not include Any qualifier if not included in bean impl
> ---
>
> Key: OWB-1164
> URL: https://issues.apache.org/jira/browse/OWB-1164
> Project: OpenWebBeans
>  Issue Type: Bug
>Affects Versions: 1.7.0
>Reporter: John D. Ament
> Fix For: 1.7.1
>
> Attachments: 
> 0001-OWB-1164-Introduce-ThirdpartyBeanAttributes-to-calcu.patch
>
>
> Section 2.3.1 of CDI 1.2 spec indicates that custom beans should include the 
> any qualifier even if not specified by the bean impl.  OWB does not honor 
> this, instead only the original qualifiers are included in the bean.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OWB-1164) Third Party Beans do not include Any qualifier if not included in bean impl

2016-12-29 Thread Romain Manni-Bucau (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15785532#comment-15785532
 ] 

Romain Manni-Bucau commented on OWB-1164:
-

Looks like your Any doesn't respect hashcode and equals of Annotation so sounds 
fine to me.

> Third Party Beans do not include Any qualifier if not included in bean impl
> ---
>
> Key: OWB-1164
> URL: https://issues.apache.org/jira/browse/OWB-1164
> Project: OpenWebBeans
>  Issue Type: Bug
>Affects Versions: 1.7.0
>Reporter: John D. Ament
> Fix For: 1.7.1
>
> Attachments: 
> 0001-OWB-1164-Introduce-ThirdpartyBeanAttributes-to-calcu.patch
>
>
> Section 2.3.1 of CDI 1.2 spec indicates that custom beans should include the 
> any qualifier even if not specified by the bean impl.  OWB does not honor 
> this, instead only the original qualifiers are included in the bean.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OWB-1164) Third Party Beans do not include Any qualifier if not included in bean impl

2016-12-29 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15785470#comment-15785470
 ] 

John D. Ament commented on OWB-1164:


[~rmannibucau] I see you made some changes on top of my patch.  There is one 
gotcha now.  If I change my bean to use this:

{code:java}
@Override
public Set getQualifiers()
{
Set qualifiers = new HashSet<>();
qualifiers.add(new AnyLiteral());
return qualifiers;
}
{code}

Where {{AnyLiteral}} is defined as:

{code:java}
public static class AnyLiteral implements Any
{
@Override
public Class annotationType() {
return Any.class;
}
}
{code}

I'll point out that the use of {{AnnotationLiteral}} is meant as a convenience. 
 OWB and Weld both support direct annotation subclassing like I used here.  
With your logic in place, then the bean ends up with two any qualifiers, which 
is strictly prohibited in CDI 1.2.  Using this logic gives some of the clean up 
you did but retains the check for classes.

{code:java}
private Set calculateQualifiers(final BeanAttributes 
beanAttributes)
{
final Set originalQualifiers = 
beanAttributes.getQualifiers() == null ?
Collections.emptySet() : 
beanAttributes.getQualifiers();
for(Annotation a : originalQualifiers)
{
if(a instanceof Any)
{
return originalQualifiers;
}
}
final Set newQualifiers = new HashSet<>(originalQualifiers);
newQualifiers.add(AnyLiteral.INSTANCE);
return newQualifiers;
}
{code}

> Third Party Beans do not include Any qualifier if not included in bean impl
> ---
>
> Key: OWB-1164
> URL: https://issues.apache.org/jira/browse/OWB-1164
> Project: OpenWebBeans
>  Issue Type: Bug
>Affects Versions: 1.7.0
>Reporter: John D. Ament
> Fix For: 1.7.1
>
> Attachments: 
> 0001-OWB-1164-Introduce-ThirdpartyBeanAttributes-to-calcu.patch
>
>
> Section 2.3.1 of CDI 1.2 spec indicates that custom beans should include the 
> any qualifier even if not specified by the bean impl.  OWB does not honor 
> this, instead only the original qualifiers are included in the bean.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)