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 <[email protected]> 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: "[email protected]" <[email protected]>
To: [email protected]
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);






Reply via email to