You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/10/15 22:24:33 UTC

svn commit: r825636 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java

Author: gerdogdu
Date: Thu Oct 15 20:24:32 2009
New Revision: 825636

URL: http://svn.apache.org/viewvc?rev=825636&view=rev
Log:
[OWB-142] If an injection point declares no qualifier, then @Default should be assumed. Thanks to Joe Bergmark

Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=825636&r1=825635&r2=825636&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java Thu Oct 15 20:24:32 2009
@@ -32,6 +32,7 @@
 import javax.inject.Qualifier;
 import javax.interceptor.InterceptorBinding;
 
+import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.plugins.OpenWebBeansPlugin;
 import org.apache.webbeans.plugins.PluginLoader;
@@ -509,6 +510,13 @@
                 set.add(annot);
             }
         }
+        
+        //Add the default qualifier if no others exist.  Section 3.10, OWB-142///
+        if(set.size() == 0)
+        {
+        	set.add(new DefaultLiteral());
+        }
+        ////////////////////////////////////////////////////////////////////////
 
         Annotation[] a = new Annotation[set.size()];
         a = set.toArray(a);



Re: svn commit: r825636 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java

Posted by David Blevins <da...@visi.com>.
On Oct 16, 2009, at 12:27 AM, Mark Struberg wrote:

> yups, you are right. With @Inject this pain has gone away.
>
> The question is: is there still a reason for having the @Default  
> annotation at all?

No reason I know.  Sent Gavin a note.

It's actually kind of a pain to have to either add to all places (or  
remove it from all places) when doing matching just so things that  
didn't use @Default and things that imply default still match.

-David


> ----- Original Message ----
>> From: David Blevins <da...@visi.com>
>> To: openwebbeans-dev@incubator.apache.org
>> Sent: Thu, October 15, 2009 11:42:25 PM
>> Subject: Re: svn commit: r825636 - /incubator/openwebbeans/trunk/ 
>> webbeans-impl/src/main/java/org/apache/webbeans/util/ 
>> AnnotationUtil.java
>>
>> What Mark mentions used to be the case.  Before there was no  
>> @Inject annotation
>> so you didn't explicitly know if a field was a target for  
>> dependency injection
>> and therefore in the absence of an explicit qualifier you had to  
>> assume it was
>> not.
>>
>> Now with @Inject as a required annotation, you know definitively  
>> and can assume
>> @Default.  And really, the @Default annotation is simply not needed  
>> anymore and
>> could very well be removed -- as far as I can see anyway.
>>
>> -David
>>
>> On Oct 15, 2009, at 2:30 PM, Joseph Bergmark wrote:
>>
>>> Where is that mentioned?  I seems like in 3.10 it is saying  
>>> @Default is
>>> assumed for all InjectionPoints.  It even gives an example that  
>>> looks like
>>> field injection at the very bottom of that section.
>>>
>>> Sincerely,
>>>
>>> Joe Bergmark
>>>
>>> On Thu, Oct 15, 2009 at 4:37 PM, Mark Struberg wrote:
>>>
>>>> I hope we did take care that this rule must not be applied for  
>>>> field
>>>> InjectionPoints?
>>>>
>>>> I know the spec is a bit cryptic for this case, but for fields,  
>>>> @Default is
>>>> not assumed if no other annotation exists.
>>>>
>>>> just to make sure...
>>>>
>>>> LieGrue,
>>>> strub
>>>>
>>>>
>>>>
>>>> ----- Original Message ----
>>>>> From: "gerdogdu@apache.org"
>>>>> To: openwebbeans-commits@incubator.apache.org
>>>>> Sent: Thu, October 15, 2009 10:24:33 PM
>>>>> Subject: svn commit: r825636 -
>>>>
>> /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/ 
>> apache/webbeans/util/AnnotationUtil.java
>>>>>
>>>>> Author: gerdogdu
>>>>> Date: Thu Oct 15 20:24:32 2009
>>>>> New Revision: 825636
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=825636&view=rev
>>>>> Log:
>>>>> [OWB-142] If an injection point declares no qualifier, then  
>>>>> @Default
>>>> should be
>>>>> assumed. Thanks to Joe Bergmark
>>>>>
>>>>> Modified:
>>>>>
>>>>>
>>>>
>> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/ 
>> webbeans/util/AnnotationUtil.java
>>>>>
>>>>> Modified:
>>>>>
>>>>
>> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/ 
>> webbeans/util/AnnotationUtil.java
>>>>> URL:
>>>>>
>>>>
>> http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=825636&r1=825635&r2=825636&view=diff
>>>>>
>>>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>>>>> ---
>>>>>
>>>>
>> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/ 
>> webbeans/util/AnnotationUtil.java
>>>>> (original)
>>>>> +++
>>>>>
>>>>
>> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/ 
>> webbeans/util/AnnotationUtil.java
>>>>> Thu Oct 15 20:24:32 2009
>>>>> @@ -32,6 +32,7 @@
>>>>> import javax.inject.Qualifier;
>>>>> import javax.interceptor.InterceptorBinding;
>>>>>
>>>>> +import org.apache.webbeans.annotation.DefaultLiteral;
>>>>> import  
>>>>> org.apache.webbeans.exception.WebBeansConfigurationException;
>>>>> import org.apache.webbeans.plugins.OpenWebBeansPlugin;
>>>>> import org.apache.webbeans.plugins.PluginLoader;
>>>>> @@ -509,6 +510,13 @@
>>>>>                set.add(annot);
>>>>>            }
>>>>>        }
>>>>> +
>>>>> +        //Add the default qualifier if no others exist.   
>>>>> Section 3.10,
>>>>> OWB-142///
>>>>> +        if(set.size() == 0)
>>>>> +        {
>>>>> +            set.add(new DefaultLiteral());
>>>>> +        }
>>>>> +
>>>>> ////////////////////////////////////////////////////////////////////////
>>>>>
>>>>>        Annotation[] a = new Annotation[set.size()];
>>>>>        a = set.toArray(a);
>>>>
>>>>
>>>>
>>>>
>>>>
>
>
>
>
>


Re: svn commit: r825636 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java

Posted by Mark Struberg <st...@yahoo.de>.
yups, you are right. With @Inject this pain has gone away.

The question is: is there still a reason for having the @Default annotation at all?

If not we should ask Gavin.

LieGrue,
strub



----- Original Message ----
> From: David Blevins <da...@visi.com>
> To: openwebbeans-dev@incubator.apache.org
> Sent: Thu, October 15, 2009 11:42:25 PM
> Subject: Re: svn commit: r825636 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> 
> What Mark mentions used to be the case.  Before there was no @Inject annotation 
> so you didn't explicitly know if a field was a target for dependency injection 
> and therefore in the absence of an explicit qualifier you had to assume it was 
> not.
> 
> Now with @Inject as a required annotation, you know definitively and can assume 
> @Default.  And really, the @Default annotation is simply not needed anymore and 
> could very well be removed -- as far as I can see anyway.
> 
> -David
> 
> On Oct 15, 2009, at 2:30 PM, Joseph Bergmark wrote:
> 
> > Where is that mentioned?  I seems like in 3.10 it is saying @Default is
> > assumed for all InjectionPoints.  It even gives an example that looks like
> > field injection at the very bottom of that section.
> > 
> > Sincerely,
> > 
> > Joe Bergmark
> > 
> > On Thu, Oct 15, 2009 at 4:37 PM, Mark Struberg wrote:
> > 
> >> I hope we did take care that this rule must not be applied for field
> >> InjectionPoints?
> >> 
> >> I know the spec is a bit cryptic for this case, but for fields, @Default is
> >> not assumed if no other annotation exists.
> >> 
> >> just to make sure...
> >> 
> >> LieGrue,
> >> strub
> >> 
> >> 
> >> 
> >> ----- Original Message ----
> >>> From: "gerdogdu@apache.org" 
> >>> To: openwebbeans-commits@incubator.apache.org
> >>> Sent: Thu, October 15, 2009 10:24:33 PM
> >>> Subject: svn commit: r825636 -
> >> 
> /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> >>> 
> >>> Author: gerdogdu
> >>> Date: Thu Oct 15 20:24:32 2009
> >>> New Revision: 825636
> >>> 
> >>> URL: http://svn.apache.org/viewvc?rev=825636&view=rev
> >>> Log:
> >>> [OWB-142] If an injection point declares no qualifier, then @Default
> >> should be
> >>> assumed. Thanks to Joe Bergmark
> >>> 
> >>> Modified:
> >>> 
> >>> 
> >> 
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> >>> 
> >>> Modified:
> >>> 
> >> 
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> >>> URL:
> >>> 
> >> 
> http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=825636&r1=825635&r2=825636&view=diff
> >>> 
> >> 
> ==============================================================================
> >>> ---
> >>> 
> >> 
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> >>> (original)
> >>> +++
> >>> 
> >> 
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> >>> Thu Oct 15 20:24:32 2009
> >>> @@ -32,6 +32,7 @@
> >>> import javax.inject.Qualifier;
> >>> import javax.interceptor.InterceptorBinding;
> >>> 
> >>> +import org.apache.webbeans.annotation.DefaultLiteral;
> >>> import org.apache.webbeans.exception.WebBeansConfigurationException;
> >>> import org.apache.webbeans.plugins.OpenWebBeansPlugin;
> >>> import org.apache.webbeans.plugins.PluginLoader;
> >>> @@ -509,6 +510,13 @@
> >>>                 set.add(annot);
> >>>             }
> >>>         }
> >>> +
> >>> +        //Add the default qualifier if no others exist.  Section 3.10,
> >>> OWB-142///
> >>> +        if(set.size() == 0)
> >>> +        {
> >>> +            set.add(new DefaultLiteral());
> >>> +        }
> >>> +
> >>> ////////////////////////////////////////////////////////////////////////
> >>> 
> >>>         Annotation[] a = new Annotation[set.size()];
> >>>         a = set.toArray(a);
> >> 
> >> 
> >> 
> >> 
> >> 



      

Re: svn commit: r825636 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java

Posted by David Blevins <da...@visi.com>.
What Mark mentions used to be the case.  Before there was no @Inject  
annotation so you didn't explicitly know if a field was a target for  
dependency injection and therefore in the absence of an explicit  
qualifier you had to assume it was not.

Now with @Inject as a required annotation, you know definitively and  
can assume @Default.  And really, the @Default annotation is simply  
not needed anymore and could very well be removed -- as far as I can  
see anyway.

-David

On Oct 15, 2009, at 2:30 PM, Joseph Bergmark wrote:

> Where is that mentioned?  I seems like in 3.10 it is saying @Default  
> is
> assumed for all InjectionPoints.  It even gives an example that  
> looks like
> field injection at the very bottom of that section.
>
> Sincerely,
>
> Joe Bergmark
>
> On Thu, Oct 15, 2009 at 4:37 PM, Mark Struberg <st...@yahoo.de>  
> wrote:
>
>> I hope we did take care that this rule must not be applied for field
>> InjectionPoints?
>>
>> I know the spec is a bit cryptic for this case, but for fields,  
>> @Default is
>> not assumed if no other annotation exists.
>>
>> just to make sure...
>>
>> LieGrue,
>> strub
>>
>>
>>
>> ----- Original Message ----
>>> From: "gerdogdu@apache.org" <ge...@apache.org>
>>> To: openwebbeans-commits@incubator.apache.org
>>> Sent: Thu, October 15, 2009 10:24:33 PM
>>> Subject: svn commit: r825636 -
>> /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/ 
>> apache/webbeans/util/AnnotationUtil.java
>>>
>>> Author: gerdogdu
>>> Date: Thu Oct 15 20:24:32 2009
>>> New Revision: 825636
>>>
>>> URL: http://svn.apache.org/viewvc?rev=825636&view=rev
>>> Log:
>>> [OWB-142] If an injection point declares no qualifier, then @Default
>> should be
>>> assumed. Thanks to Joe Bergmark
>>>
>>> Modified:
>>>
>>>
>> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/ 
>> webbeans/util/AnnotationUtil.java
>>>
>>> Modified:
>>>
>> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/ 
>> webbeans/util/AnnotationUtil.java
>>> URL:
>>>
>> http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=825636&r1=825635&r2=825636&view=diff
>>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>>> ---
>>>
>> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/ 
>> webbeans/util/AnnotationUtil.java
>>> (original)
>>> +++
>>>
>> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/ 
>> webbeans/util/AnnotationUtil.java
>>> Thu Oct 15 20:24:32 2009
>>> @@ -32,6 +32,7 @@
>>> import javax.inject.Qualifier;
>>> import javax.interceptor.InterceptorBinding;
>>>
>>> +import org.apache.webbeans.annotation.DefaultLiteral;
>>> import org.apache.webbeans.exception.WebBeansConfigurationException;
>>> import org.apache.webbeans.plugins.OpenWebBeansPlugin;
>>> import org.apache.webbeans.plugins.PluginLoader;
>>> @@ -509,6 +510,13 @@
>>>                 set.add(annot);
>>>             }
>>>         }
>>> +
>>> +        //Add the default qualifier if no others exist.  Section  
>>> 3.10,
>>> OWB-142///
>>> +        if(set.size() == 0)
>>> +        {
>>> +            set.add(new DefaultLiteral());
>>> +        }
>>> +
>>> ////////////////////////////////////////////////////////////////////////
>>>
>>>         Annotation[] a = new Annotation[set.size()];
>>>         a = set.toArray(a);
>>
>>
>>
>>
>>


Re: svn commit: r825636 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java

Posted by Joseph Bergmark <be...@gmail.com>.
Where is that mentioned?  I seems like in 3.10 it is saying @Default is
assumed for all InjectionPoints.  It even gives an example that looks like
field injection at the very bottom of that section.

Sincerely,

Joe Bergmark

On Thu, Oct 15, 2009 at 4:37 PM, Mark Struberg <st...@yahoo.de> wrote:

> I hope we did take care that this rule must not be applied for field
> InjectionPoints?
>
> I know the spec is a bit cryptic for this case, but for fields, @Default is
> not assumed if no other annotation exists.
>
> just to make sure...
>
> LieGrue,
> strub
>
>
>
> ----- Original Message ----
> > From: "gerdogdu@apache.org" <ge...@apache.org>
> > To: openwebbeans-commits@incubator.apache.org
> > Sent: Thu, October 15, 2009 10:24:33 PM
> > Subject: svn commit: r825636 -
> /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> >
> > Author: gerdogdu
> > Date: Thu Oct 15 20:24:32 2009
> > New Revision: 825636
> >
> > URL: http://svn.apache.org/viewvc?rev=825636&view=rev
> > Log:
> > [OWB-142] If an injection point declares no qualifier, then @Default
> should be
> > assumed. Thanks to Joe Bergmark
> >
> > Modified:
> >
> >
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> >
> > Modified:
> >
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> > URL:
> >
> http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=825636&r1=825635&r2=825636&view=diff
> >
> ==============================================================================
> > ---
> >
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> > (original)
> > +++
> >
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> > Thu Oct 15 20:24:32 2009
> > @@ -32,6 +32,7 @@
> > import javax.inject.Qualifier;
> > import javax.interceptor.InterceptorBinding;
> >
> > +import org.apache.webbeans.annotation.DefaultLiteral;
> > import org.apache.webbeans.exception.WebBeansConfigurationException;
> > import org.apache.webbeans.plugins.OpenWebBeansPlugin;
> > import org.apache.webbeans.plugins.PluginLoader;
> > @@ -509,6 +510,13 @@
> >                  set.add(annot);
> >              }
> >          }
> > +
> > +        //Add the default qualifier if no others exist.  Section 3.10,
> > OWB-142///
> > +        if(set.size() == 0)
> > +        {
> > +            set.add(new DefaultLiteral());
> > +        }
> > +
> > ////////////////////////////////////////////////////////////////////////
> >
> >          Annotation[] a = new Annotation[set.size()];
> >          a = set.toArray(a);
>
>
>
>
>

Re: svn commit: r825636 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java

Posted by Mark Struberg <st...@yahoo.de>.
I hope we did take care that this rule must not be applied for field InjectionPoints?

I know the spec is a bit cryptic for this case, but for fields, @Default is not assumed if no other annotation exists.

just to make sure...

LieGrue,
strub



----- Original Message ----
> From: "gerdogdu@apache.org" <ge...@apache.org>
> To: openwebbeans-commits@incubator.apache.org
> Sent: Thu, October 15, 2009 10:24:33 PM
> Subject: svn commit: r825636 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> 
> Author: gerdogdu
> Date: Thu Oct 15 20:24:32 2009
> New Revision: 825636
> 
> URL: http://svn.apache.org/viewvc?rev=825636&view=rev
> Log:
> [OWB-142] If an injection point declares no qualifier, then @Default should be 
> assumed. Thanks to Joe Bergmark
> 
> Modified:
>     
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> 
> Modified: 
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
> URL: 
> http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=825636&r1=825635&r2=825636&view=diff
> ==============================================================================
> --- 
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java 
> (original)
> +++ 
> incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java 
> Thu Oct 15 20:24:32 2009
> @@ -32,6 +32,7 @@
> import javax.inject.Qualifier;
> import javax.interceptor.InterceptorBinding;
> 
> +import org.apache.webbeans.annotation.DefaultLiteral;
> import org.apache.webbeans.exception.WebBeansConfigurationException;
> import org.apache.webbeans.plugins.OpenWebBeansPlugin;
> import org.apache.webbeans.plugins.PluginLoader;
> @@ -509,6 +510,13 @@
>                  set.add(annot);
>              }
>          }
> +        
> +        //Add the default qualifier if no others exist.  Section 3.10, 
> OWB-142///
> +        if(set.size() == 0)
> +        {
> +            set.add(new DefaultLiteral());
> +        }
> +        
> ////////////////////////////////////////////////////////////////////////
> 
>          Annotation[] a = new Annotation[set.size()];
>          a = set.toArray(a);