You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by db...@apache.org on 2011/01/06 10:35:32 UTC

svn commit: r1055805 [1/2] - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/corespi/ main/java/org/apache/...

Author: dblevins
Date: Thu Jan  6 09:35:31 2011
New Revision: 1055805

URL: http://svn.apache.org/viewvc?rev=1055805&view=rev
Log:
Moved AnnotationUtil code that operated	on the WebBeansContext into an new AnnotationManager class that	now also lives in the WebBeansContext
Retained but deprecated	  all the	affected methods of AnnotationUtil.
Consolidated repeated calls made in the same method (either in code or loops) to WebBeansContext.getInstance().getAnnotationManager()

OWB-503 status: 568 code uses
Total of 165069 static synchronized accesses and 232559 hashed calls in 340 tests
Average of 485 static synchronized accesses and 683 hashed calls per test

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java   (with props)
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java?rev=1055805&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java Thu Jan  6 09:35:31 2011
@@ -0,0 +1,457 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.annotation;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.ArrayUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.SecurityUtil;
+import org.apache.webbeans.xml.XMLAnnotationTypeManager;
+
+import javax.enterprise.inject.Stereotype;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Manages annotation usage by classes in this application.
+ */
+public final class AnnotationManager
+{
+    public static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
+
+    public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
+    private final XMLAnnotationTypeManager manager;
+
+    private final BeanManagerImpl beanManagerImpl;
+
+    // No instantiate
+
+    public AnnotationManager(WebBeansContext context)
+    {
+        manager = context.getxMLAnnotationTypeManager();
+        beanManagerImpl = context.getBeanManagerImpl();
+    }
+
+
+    /**
+     * Returns true if the annotation is defined in xml or annotated with
+     * {@link javax.interceptor.InterceptorBinding} false otherwise.
+     *
+     * @param clazz type of the annotation
+     * @return true if the annotation is defined in xml or annotated with
+     *         {@link javax.interceptor.InterceptorBinding} false otherwise
+     */
+    public boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        if (manager.hasInterceptorBindingType(clazz))
+        {
+            return true;
+        }
+        else if (clazz.isAnnotationPresent(InterceptorBinding.class))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * If any Annotations in the input is an interceptor binding annotation type then return
+     * true, false otherwise.
+     *
+     * @param anns array of Annotations to check
+     * @return true if one or moe of the input annotations are an interceptor binding annotation
+     *         type false otherwise
+     */
+    public boolean hasInterceptorBindingMetaAnnotation(Annotation[] anns)
+    {
+        Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+        for (Annotation ann : anns)
+        {
+            if (isInterceptorBindingAnnotation(ann.annotationType()))
+            {
+                return true;
+            }
+            else
+            {
+                continue;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Collect the interceptor bindings from an array of annotations, including
+     * transitively defined interceptor bindings.
+     * @param anns An array of annotations
+     * @return an array of interceptor binding annotations, including the input and any transitively declared annotations
+     */
+    public Annotation[] getInterceptorBindingMetaAnnotations(Annotation[] anns)
+    {
+        Asserts.assertNotNull(anns, "anns parameter can not be null");
+        List<Annotation> interAnns = new ArrayList<Annotation>();
+
+        for (Annotation ann : anns)
+        {
+            if (isInterceptorBindingAnnotation(ann.annotationType()))
+            {
+                interAnns.add(ann);
+
+                //check for transitive
+                Annotation[] transitives = getTransitiveInterceptorBindings(ann.annotationType().getDeclaredAnnotations());
+
+                for(Annotation transitive : transitives)
+                {
+                    interAnns.add(transitive);
+                }
+
+            }
+        }
+
+        Annotation[] ret = new Annotation[interAnns.size()];
+        ret = interAnns.toArray(ret);
+
+        return ret;
+    }
+
+    private Annotation[] getTransitiveInterceptorBindings(Annotation[] anns)
+    {
+        return getInterceptorBindingMetaAnnotations(anns);
+    }
+
+    /**
+     * Returns true if the annotation is defined in xml or annotated with
+     * {@link javax.inject.Qualifier} false otherwise.
+     *
+     * @param clazz type of the annotation
+     * @return true if the annotation is defined in xml or annotated with
+     *         {@link javax.inject.Qualifier} false otherwise
+     */
+    public boolean isQualifierAnnotation(Class<? extends Annotation> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        if (manager.hasBindingType(clazz))
+        {
+            return true;
+        }
+        else if (clazz.isAnnotationPresent(Qualifier.class))
+        {
+            return true;
+        }
+        else if(beanManagerImpl.getAdditionalQualifiers().contains(clazz))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    public <X> Annotation[] getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(
+            AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
+    {
+        Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
+        Asserts.nullCheckForClass(clazz);
+
+        List<Annotation> list = new ArrayList<Annotation>();
+        List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
+        for(AnnotatedParameter<X> parameter : parameters)
+        {
+            if(parameter.isAnnotationPresent(clazz))
+            {
+                Annotation[] anns = AnnotationUtil.getAnnotationsFromSet(parameter.getAnnotations());
+                for(Annotation ann : anns)
+                {
+                    if(isQualifierAnnotation(ann.annotationType()))
+                    {
+                        list.add(ann);
+                    }
+                }
+            }
+        }
+
+        Annotation[] finalAnns = new Annotation[list.size()];
+        finalAnns = list.toArray(finalAnns);
+
+        return finalAnns;
+    }
+
+
+    /**
+     * Gets the method first found parameter qualifiers.
+     *
+     * @param method method
+     * @param clazz checking annotation
+     * @return annotation array
+     */
+    public Annotation[] getMethodFirstParameterQualifierWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)
+    {
+        Asserts.assertNotNull(method, "Method argument can not be null");
+        Asserts.nullCheckForClass(clazz);
+
+        Annotation[][] parameterAnns = method.getParameterAnnotations();
+        List<Annotation> list = new ArrayList<Annotation>();
+        Annotation[] result;
+
+        for (Annotation[] parameters : parameterAnns)
+        {
+            boolean found = false;
+            for (Annotation param : parameters)
+            {
+                Class<? extends Annotation> btype = param.annotationType();
+                if (btype.equals(clazz))
+                {
+                    found = true;
+                    continue;
+                }
+
+                if (isQualifierAnnotation(btype))
+                {
+                    list.add(param);
+                }
+
+            }
+
+            if (found)
+            {
+                result = new Annotation[list.size()];
+                result = list.toArray(result);
+                return result;
+            }
+        }
+        result = new Annotation[0];
+        return result;
+    }
+
+    /**
+     * Gets the array of qualifier annotations on the given array.
+     *
+     * @param annotations annotation array
+     * @return array containing qualifier anns
+     */
+    public Annotation[] getQualifierAnnotations(Annotation... annotations)
+    {
+        Asserts.assertNotNull(annotations, "Annotations argument can not be null");
+
+        Set<Annotation> set = new HashSet<Annotation>();
+
+        for (Annotation annot : annotations)
+        {
+            if (isQualifierAnnotation(annot.annotationType()))
+            {
+                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);
+
+        return a;
+    }
+
+
+    /**
+     * If the bean extends generic class via Realizes
+     * annotation, realized based producer methods, fields and observer
+     * methods qualifier is
+     *
+     * <ul>
+     *  <li>Qualifiers on the definitions</li>
+     *  <li>Plus class qualifiers</li>
+     *  <li>Minus generic class qualifiers</li>
+     * </ul>
+     *
+     * @param clazz realized definition class
+     * @param anns binding annotations array
+     */
+    public Annotation[] getRealizesGenericAnnotations(Class<?> clazz, Annotation[] anns)
+    {
+       Set<Annotation> setAnnots = new HashSet<Annotation>();
+
+        for(Annotation definedAnn : anns)
+        {
+            setAnnots.add(definedAnn);
+        }
+
+        Annotation[] genericReliazesAnns = getQualifierAnnotations(clazz.getSuperclass().getDeclaredAnnotations());
+
+        for(Annotation generic : genericReliazesAnns)
+        {
+            setAnnots.remove(generic);
+        }
+
+        genericReliazesAnns = getQualifierAnnotations(clazz.getDeclaredAnnotations());
+
+        for(Annotation generic : genericReliazesAnns)
+        {
+            setAnnots.add(generic);
+        }
+
+        Annotation[] annots = new Annotation[setAnnots.size()];
+        annots = setAnnots.toArray(annots);
+
+        return annots;
+    }
+
+    public void checkQualifierConditions(Annotation... qualifierAnnots)
+    {
+        Set<Annotation> annSet = ArrayUtil.asSet(qualifierAnnots);
+
+        //check for duplicate annotations
+        if (qualifierAnnots.length != annSet.size())
+        {
+            throw new IllegalArgumentException("Qualifier annotations can not contain duplicate qualifiers:" + qualifierAnnots);
+        }
+
+        checkQualifierConditions(annSet);
+    }
+
+    /**
+     * This function obviously cannot check for duplicate annotations.
+     * So this must have been done before!
+     * @param qualifierAnnots
+     */
+    public void checkQualifierConditions(Set<Annotation> qualifierAnnots)
+    {
+        for (Annotation ann : qualifierAnnots)
+        {
+            checkQualifierConditions(ann);
+        }
+    }
+
+    private void checkQualifierConditions(Annotation ann)
+    {
+        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(ann.annotationType());
+
+        for (Method method : methods)
+        {
+            Class<?> clazz = method.getReturnType();
+            if (clazz.isArray() || clazz.isAnnotation())
+            {
+                if (!AnnotationUtil.hasAnnotation(method.getDeclaredAnnotations(), Nonbinding.class))
+                {
+                    throw new WebBeansConfigurationException("@Qualifier : " + ann.annotationType().getName()
+                                                             + " must have @NonBinding valued members for its array-valued and annotation valued members");
+                }
+            }
+        }
+
+        if (!isQualifierAnnotation(ann.annotationType()))
+        {
+            throw new IllegalArgumentException("Qualifier annotations must be annotated with @Qualifier");
+        }
+    }
+
+    /**
+     * Returns true if the annotation is defined in xml or annotated with
+     * {@link javax.enterprise.inject.Stereotype} false otherwise.
+     *
+     * @param clazz type of the annotation
+     * @return true if the annotation is defined in xml or annotated with
+     *         {@link javax.enterprise.inject.Stereotype} false otherwise
+     */
+    public boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        if (manager.hasStereoType(clazz))
+        {
+            return true;
+        }
+        else if (clazz.isAnnotationPresent(Stereotype.class))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    public boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
+    {
+        Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+        for (Annotation ann : anns)
+        {
+            if (isStereoTypeAnnotation(ann.annotationType()))
+            {
+                return true;
+            }
+            else
+            {
+                continue;
+            }
+        }
+
+        return false;
+    }
+
+    public Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
+    {
+        Asserts.assertNotNull(anns, "anns parameter can not be null");
+        List<Annotation> interAnns = new ArrayList<Annotation>();
+
+        for (Annotation ann : anns)
+        {
+            if (isStereoTypeAnnotation(ann.annotationType()))
+            {
+                interAnns.add(ann);
+
+                //check for transitive
+                Annotation[] transitives = getTransitiveStereoTypes(ann.annotationType().getDeclaredAnnotations());
+
+                for(Annotation transitive : transitives)
+                {
+                    interAnns.add(transitive);
+                }
+            }
+        }
+
+        Annotation[] ret = new Annotation[interAnns.size()];
+        ret = interAnns.toArray(ret);
+
+        return ret;
+    }
+
+    private Annotation[] getTransitiveStereoTypes(Annotation[] anns)
+    {
+        return getStereotypeMetaAnnotations(anns);
+    }
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java Thu Jan  6 09:35:31 2011
@@ -39,6 +39,7 @@ import javax.enterprise.inject.spi.Injec
 import javax.enterprise.inject.spi.ProcessAnnotatedType;
 import javax.interceptor.Interceptor;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.component.AbstractProducerBean;
 import org.apache.webbeans.component.EnterpriseBeanMarker;
@@ -729,6 +730,8 @@ public class BeansDeployer
         logger.debug("Checking StereoType constraints has started.");
 
         addDefaultStereoTypes();
+
+        final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
         
         Set<Class<?>> beanClasses = scanner.getBeanClasses();
         if (beanClasses != null && beanClasses.size() > 0)
@@ -737,8 +740,8 @@ public class BeansDeployer
             {                
                 if(beanClass.isAnnotation())
                 {
-                    Class<? extends Annotation> stereoClass = (Class<? extends Annotation>) beanClass;                    
-                    if (AnnotationUtil.isStereoTypeAnnotation(stereoClass))
+                    Class<? extends Annotation> stereoClass = (Class<? extends Annotation>) beanClass;
+                    if (annotationManager.isStereoTypeAnnotation(stereoClass))
                     {
                         if (!webBeansContext.getxMLAnnotationTypeManager().hasStereoType(stereoClass))
                         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Thu Jan  6 09:35:31 2011
@@ -50,6 +50,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Scope;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.annotation.AnyLiteral;
 import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.annotation.DependentScopeLiteral;
@@ -219,12 +220,14 @@ public final class DefinitionUtil
      */
     public static <T> void defineQualifiers(AbstractOwbBean<T> component, Annotation[] annotations)
     {
+        final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+
         boolean find = false;
         for (Annotation annotation : annotations)
         {
             Class<? extends Annotation> type = annotation.annotationType();
 
-            if (AnnotationUtil.isQualifierAnnotation(type))
+            if (annotationManager.isQualifierAnnotation(type))
             {
                 Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(type);
 
@@ -390,9 +393,11 @@ public final class DefinitionUtil
 
     public static <T> void defineStereoTypes(OwbBean<?> component, Annotation[] anns)
     {
-        if (AnnotationUtil.hasStereoTypeMetaAnnotation(anns))
+        final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        if (annotationManager.hasStereoTypeMetaAnnotation(anns))
         {
-            Annotation[] steroAnns = AnnotationUtil.getStereotypeMetaAnnotations(anns);
+            Annotation[] steroAnns =
+                annotationManager.getStereotypeMetaAnnotations(anns);
 
             for (Annotation stereo : steroAnns)
             {
@@ -761,6 +766,8 @@ public final class DefinitionUtil
 
     private static <T> void createDisposalMethods(AbstractOwbBean<T> component, Method[] methods, Class<?> clazz)
     {
+        final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+
         ProducerMethodBean<?> previous = null;
         for (Method declaredMethod : methods)
         {
@@ -768,7 +775,7 @@ public final class DefinitionUtil
             WebBeansUtil.checkProducerMethodDisposal(declaredMethod, clazz.getName());
 
             Type type = AnnotationUtil.getMethodFirstParameterWithAnnotation(declaredMethod, Disposes.class);
-            Annotation[] annot = AnnotationUtil.getMethodFirstParameterQualifierWithGivenAnnotation(declaredMethod, Disposes.class);
+            Annotation[] annot = annotationManager.getMethodFirstParameterQualifierWithGivenAnnotation(declaredMethod, Disposes.class);
 
 
             Set<Bean<?>> set = InjectionResolver.getInstance().implResolveByType(type, annot);
@@ -850,6 +857,8 @@ public final class DefinitionUtil
     public static <T> void defineInternalInjectedFields(AbstractInjectionTargetBean<T> component, Class<T> clazz, boolean fromSuperClazz)
     {
 
+        final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+
         Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(clazz);
 
         if (fields.length != 0)
@@ -879,7 +888,7 @@ public final class DefinitionUtil
                     throw new WebBeansConfigurationException("Injection fields can not be annotated with @Produces");
                 }
 
-                Annotation[] qualifierAnns = AnnotationUtil.getQualifierAnnotations(anns);
+                Annotation[] qualifierAnns = annotationManager.getQualifierAnnotations(anns);
 
                 if (qualifierAnns.length > 0)
                 {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java Thu Jan  6 09:35:31 2011
@@ -24,6 +24,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.container.SerializableBeanVault;
 import org.apache.webbeans.context.creational.CreationalContextFactory;
@@ -53,7 +54,7 @@ import org.apache.webbeans.xml.XMLSpecia
 public class WebBeansContext
 {
 
-    private AlternativesManager alternativesManager = new AlternativesManager();
+    private AlternativesManager alternativesManager = new AlternativesManager(this);
     private AnnotatedElementFactory annotatedElementFactory = new AnnotatedElementFactory();
     private BeanManagerImpl beanManagerImpl = new BeanManagerImpl(this);
     private ConversationManager conversationManager = new ConversationManager();
@@ -70,8 +71,9 @@ public class WebBeansContext
     private PluginLoader pluginLoader = new PluginLoader();
     private SerializableBeanVault serializableBeanVault = new SerializableBeanVault();
     private StereoTypeManager stereoTypeManager = new StereoTypeManager();
-    private WebBeansNameSpaceContainer webBeansNameSpaceContainer = new WebBeansNameSpaceContainer();
     private XMLAnnotationTypeManager xmlAnnotationTypeManager = new XMLAnnotationTypeManager(this);
+    private AnnotationManager annotationManager = new AnnotationManager(this);
+    private WebBeansNameSpaceContainer webBeansNameSpaceContainer = new WebBeansNameSpaceContainer();
     private XMLSpecializesManager xmlSpecializesManager = new XMLSpecializesManager();
 
     private final Map<String, Object> managerMap = new HashMap<String, Object>();
@@ -107,10 +109,10 @@ public class WebBeansContext
     }
 
     @Deprecated
-    public static WebBeansContext getInstance() 
+    public static WebBeansContext getInstance()
     {
         WebBeansContext webBeansContext = (WebBeansContext) WebBeansFinder.getSingletonInstance(WebBeansContext.class.getName());
-        
+
         return webBeansContext;
     }
 
@@ -158,6 +160,11 @@ public class WebBeansContext
         return (T) WebBeansFinder.getSingletonInstance(implName);
     }
 
+    public AnnotationManager getAnnotationManager()
+    {
+        return annotationManager;
+    }
+
     public ConversationManager getConversationManager()
     {
         return conversationManager;
@@ -260,14 +267,14 @@ public class WebBeansContext
 
     public Object get(String singletonName)
     {
-//        util.Track.get(singletonName);
+        util.Track.get(singletonName);
         Object object = managerMap.get(singletonName);
 
         /* No singleton for this application, create one */
         if (object == null)
         {
             object = createInstance(singletonName);
-            
+
             //Save it
             managerMap.put(singletonName, object);
         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java Thu Jan  6 09:35:31 2011
@@ -694,9 +694,9 @@ public class BeanManagerImpl implements 
         {
             throw new IllegalArgumentException("Exception in getBeans method. Bean type can not be TypeVariable for bean type : " + beanType);
         }
-        
-        AnnotationUtil.checkQualifierConditions(bindings);
-        
+
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(bindings);
+
         return this.injectionResolver.implResolveByType(beanType, bindings);
         
     }
@@ -951,13 +951,13 @@ public class BeanManagerImpl implements 
     @Override
     public boolean isQualifier(Class<? extends Annotation> annotationType)
     {
-        return AnnotationUtil.isQualifierAnnotation(annotationType);
+        return webBeansContext.getAnnotationManager().isQualifierAnnotation(annotationType);
     }
 
     @Override
     public boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
     {
-        return AnnotationUtil.isInterceptorBindingAnnotation(annotationType);
+        return webBeansContext.getAnnotationManager().isInterceptorBindingAnnotation(annotationType);
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java Thu Jan  6 09:35:31 2011
@@ -27,7 +27,7 @@ import java.util.Set;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 
-import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -81,7 +81,7 @@ public final class ResolutionUtil
 
     public static void getInstanceByTypeConditions(Annotation[] qualifiers)
     {
-        AnnotationUtil.checkQualifierConditions(qualifiers);
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);
     }
 
     public static void checkResolvedBeans(Set<Bean<?>> resolvedSet, Class<?> type, Annotation[] qualifiers) 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java Thu Jan  6 09:35:31 2011
@@ -61,10 +61,10 @@ public class DefaultSingletonService imp
 
         synchronized (singletonMap)
         {
-//            util.Track.sync(singletonName);
+            util.Track.sync(singletonName);
             
             WebBeansContext managerMap = singletonMap.get(classLoader);
-//            util.Track.get(singletonName);
+            util.Track.get(singletonName);
 
             if (managerMap == null)
             {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java Thu Jan  6 09:35:31 2011
@@ -30,7 +30,9 @@ import javax.enterprise.inject.Typed;
 import javax.inject.Named;
 import javax.inject.Scope;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.logger.WebBeansLogger;
@@ -88,8 +90,9 @@ public class StereoTypeModel implements 
                 logger.warn(OWBLogConst.WARN_0016, clazz.getName());
             }            
         }
-        
-        Annotation[] qualifiers = AnnotationUtil.getQualifierAnnotations(annotations);
+
+        final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        Annotation[] qualifiers = annotationManager.getQualifierAnnotations(annotations);
         
         if(qualifiers != null)
         {
@@ -119,19 +122,21 @@ public class StereoTypeModel implements 
         {
             this.defaultScopeType = AnnotationUtil.getMetaAnnotations(annotations, Scope.class)[0];
         }
-        
-        if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(annotations))
+
+        if (annotationManager.hasInterceptorBindingMetaAnnotation(annotations))
         {
-            Annotation[] ibs = AnnotationUtil.getInterceptorBindingMetaAnnotations(annotations);
+            Annotation[] ibs =
+                annotationManager.getInterceptorBindingMetaAnnotations(annotations);
             for (Annotation ann : ibs)
             {
                 this.interceptorBindingTypes.add(ann);
             }
         }
 
-        if (AnnotationUtil.hasStereoTypeMetaAnnotation(annotations))
+        if (annotationManager.hasStereoTypeMetaAnnotation(annotations))
         {
-            Annotation[] isy = AnnotationUtil.getStereotypeMetaAnnotations(annotations);
+            Annotation[] isy =
+                annotationManager.getStereotypeMetaAnnotations(annotations);
 
             Target outerStereo = clazz.getAnnotation(Target.class);
             for (Annotation is : isy)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java Thu Jan  6 09:35:31 2011
@@ -28,11 +28,12 @@ import javax.enterprise.context.NormalSc
 import javax.inject.Named;
 import javax.inject.Scope;
 
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.definition.NonexistentTypeException;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
-import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.xml.XMLUtil;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -95,6 +96,7 @@ public class XMLStereoTypeModel implemen
             annClazz = (Class<? extends Annotation>) clazz;
             Annotation defaultAnn = JavassistProxyFactory.createNewAnnotationProxy(annClazz);
 
+            final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
             if (clazz.isAnnotationPresent(NormalScope.class) || clazz.isAnnotationPresent(Scope.class))
             {
                 if (scopeTypeFound)
@@ -105,7 +107,7 @@ public class XMLStereoTypeModel implemen
                 defaultScopeType = defaultAnn;
                 scopeTypeFound = true;
             }                
-            else if (AnnotationUtil.isInterceptorBindingAnnotation(annClazz))
+            else if (annotationManager.isInterceptorBindingAnnotation(annClazz))
             {
                 Target target = clazz.getAnnotation(Target.class);
                 ElementType[] type = target.value();
@@ -126,12 +128,12 @@ public class XMLStereoTypeModel implemen
                     throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @Named annotation with value");
                 }
             }
-            else if (AnnotationUtil.isQualifierAnnotation(annClazz))
+            else if (annotationManager.isQualifierAnnotation(annClazz))
             {
                 throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @Qualifier annotation");
             }
 
-            else if (AnnotationUtil.isStereoTypeAnnotation(annClazz))
+            else if (annotationManager.isStereoTypeAnnotation(annClazz))
             {
                 Target innerStereo = clazz.getAnnotation(Target.class);
                 Class<?> outerStereoClass = XMLUtil.getElementJavaType(stereoTypeDecleration);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java Thu Jan  6 09:35:31 2011
@@ -32,7 +32,6 @@ import javax.enterprise.util.TypeLiteral
 
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
-import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.OwbCustomObjectInputStream;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -85,8 +84,8 @@ public class EventImpl<T> implements Eve
      */
     private Annotation[] getEventBindings(Annotation... annotations)
     {
-        AnnotationUtil.checkQualifierConditions(annotations);
-        
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(annotations);
+
         Set<Annotation> eventBindings = new HashSet<Annotation>();
         
         for(Annotation ann : this.injectedBindings)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java Thu Jan  6 09:35:31 2011
@@ -35,6 +35,7 @@ import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.inject.Inject;
 
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
@@ -59,7 +60,7 @@ public final class EventUtil
 
     public static void checkEventBindings(Set<Annotation> annotations)
     {
-        AnnotationUtil.checkQualifierConditions(annotations);
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(annotations);
     }
 
     public static void checkEventBindings(Annotation... annotations)
@@ -75,8 +76,8 @@ public final class EventUtil
             }
             ///////////////////////////////////////////////////////
 
-        }        
-        AnnotationUtil.checkQualifierConditions(annotations);
+        }
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(annotations);
     }
 
     public static TransactionPhase getObserverMethodTransactionType(Method observerMethod)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java Thu Jan  6 09:35:31 2011
@@ -527,7 +527,9 @@ public final class NotificationManager
         }
         
         //Looking for qualifiers
-        Annotation[] observerQualifiers = AnnotationUtil.getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(annotatedMethod, Observes.class);
+        Annotation[] observerQualifiers =
+            WebBeansContext.getInstance().getAnnotationManager().getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(
+                annotatedMethod, Observes.class);
         
         //Getting observer event type
         Type type = AnnotationUtil.getAnnotatedMethodFirstParameterWithAnnotation(annotatedMethod, Observes.class);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java Thu Jan  6 09:35:31 2011
@@ -41,6 +41,7 @@ import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.ObserverMethod;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.component.AbstractOwbBean;
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
@@ -130,9 +131,11 @@ public class ObserverMethodImpl<T> imple
         this.bean = bean;
         this.observerMethod = observerMethod;
         this.ifExist = ifExist;
-        
-        Annotation[] qualifiers = AnnotationUtil.getMethodFirstParameterQualifierWithGivenAnnotation(observerMethod, Observes.class);
-        AnnotationUtil.checkQualifierConditions(qualifiers);
+
+        Annotation[] qualifiers =
+            WebBeansContext.getInstance().getAnnotationManager().getMethodFirstParameterQualifierWithGivenAnnotation(
+                observerMethod, Observes.class);
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);
         this.observedQualifiers = new HashSet<Annotation>(qualifiers.length);
         
         for (Annotation qualifier : qualifiers)
@@ -314,7 +317,9 @@ public class ObserverMethodImpl<T> imple
     @SuppressWarnings("unchecked")
     protected List<ObserverParams> getMethodArguments(Object event)
     {
-        AnnotatedElementFactory annotatedElementFactory = WebBeansContext.getInstance().getAnnotatedElementFactory();
+        WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        AnnotatedElementFactory annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
+        AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
 
         //Define annotated parameter
         AnnotatedType<T> annotatedType = (AnnotatedType<T>) annotatedElementFactory.newAnnotatedType(this.bean.getReturnType());
@@ -324,7 +329,7 @@ public class ObserverMethodImpl<T> imple
         Annotation[][] annots = this.observerMethod.getParameterAnnotations();
         List<ObserverParams> list = new ArrayList<ObserverParams>();
 
-        BeanManagerImpl manager = WebBeansContext.getInstance().getBeanManagerImpl();
+        BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
         ObserverParams param = null;
         if (types.length > 0)
         {
@@ -358,7 +363,7 @@ public class ObserverMethodImpl<T> imple
                 if (!observesAnnotation)
                 {
                     //Get parameter annotations
-                    Annotation[] bindingTypes = AnnotationUtil.getQualifierAnnotations(annot);
+                    Annotation[] bindingTypes = annotationManager.getQualifierAnnotations(annot);
                     
                     //Annotated parameter
                     AnnotatedParameter<T> annotatedParameter = annotatedMethod.getParameters().get(i);
@@ -403,7 +408,9 @@ public class ObserverMethodImpl<T> imple
      */
     protected List<ObserverParams> getAnnotatedMethodArguments(Object event)
     {
-        BeanManagerImpl manager = WebBeansContext.getInstance().getBeanManagerImpl();
+        final WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+        final BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
         List<ObserverParams> list = new ArrayList<ObserverParams>();
         List<AnnotatedParameter<T>> parameters = this.annotatedMethod.getParameters();
         ObserverParams param = null;
@@ -418,7 +425,8 @@ public class ObserverMethodImpl<T> imple
             else
             {
                 //Get parameter annotations
-                Annotation[] bindingTypes = AnnotationUtil.getQualifierAnnotations(AnnotationUtil.
+                Annotation[] bindingTypes =
+                    annotationManager.getQualifierAnnotations(AnnotationUtil.
                         getAnnotationsFromSet(parameter.getAnnotations()));
 
                 InjectionPoint point = InjectionPointFactory.getPartialInjectionPoint(this.bean, parameter.getBaseType(), 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java Thu Jan  6 09:35:31 2011
@@ -35,10 +35,13 @@ public class AlternativesManager
     private final Set<Class<?>> alternatives = new HashSet<Class<?>>();
     
     private final Set<Class<? extends Annotation>> stereoAlternatives = new HashSet<Class<? extends Annotation>>();
-    
-    public AlternativesManager()
+
+    private final WebBeansContext webBeansContext;
+
+    public AlternativesManager(WebBeansContext webBeansContext)
     {
-        
+
+        this.webBeansContext = webBeansContext;
     }
 
     @Deprecated
@@ -54,7 +57,7 @@ public class AlternativesManager
         {
             Class<? extends Annotation> stereo = (Class<? extends Annotation>)alternative;
             boolean ok = false;
-            if(AnnotationUtil.isStereoTypeAnnotation(stereo))
+            if(webBeansContext.getAnnotationManager().isStereoTypeAnnotation(stereo))
             {
                 if(AnnotationUtil.hasClassAnnotation(stereo, Alternative.class))
                 {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java Thu Jan  6 09:35:31 2011
@@ -38,6 +38,7 @@ import javax.enterprise.inject.spi.Injec
 import javax.inject.Inject;
 import javax.inject.Provider;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.component.EventBean;
 import org.apache.webbeans.component.InjectionPointBean;
 import org.apache.webbeans.component.InjectionTargetWrapper;
@@ -333,6 +334,7 @@ public final class OWBInjector implement
     public static void checkInjectionPointForInjectInjectionPoint(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
+        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
         Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(clazz);
         for(Field field : fields)
         {
@@ -340,7 +342,8 @@ public final class OWBInjector implement
             {
                 if(field.getType() == InjectionPoint.class)
                 {
-                    Annotation[] anns = AnnotationUtil.getQualifierAnnotations(field.getDeclaredAnnotations());
+                    Annotation[] anns = annotationManager.getQualifierAnnotations(
+                        field.getDeclaredAnnotations());
                     if (AnnotationUtil.hasAnnotation(anns, Default.class))
                     {
                         throw new WebBeansConfigurationException("Java EE Component class :  " + clazz + " can not inject InjectionPoint");

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java Thu Jan  6 09:35:31 2011
@@ -156,7 +156,8 @@ public class InjectionPointFactory
     {
         InjectionPointImpl injectionPoint = null;
 
-        Annotation[] qualifierAnnots = AnnotationUtil.getQualifierAnnotations(annots);
+        Annotation[] qualifierAnnots =
+            WebBeansContext.getInstance().getAnnotationManager().getQualifierAnnotations(annots);
         
         //@Named update for injection fields!
         if(member instanceof Field)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java Thu Jan  6 09:35:31 2011
@@ -35,7 +35,6 @@ import javax.enterprise.util.TypeLiteral
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.container.ResolutionUtil;
-import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.OwbCustomObjectInputStream;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -160,7 +159,7 @@ class InstanceImpl<T> implements Instanc
      */
     private Annotation[] getAdditionalQualifiers(Annotation[] qualifiers)
     {
-        AnnotationUtil.checkQualifierConditions(qualifiers);
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);
         Set<Annotation> newQualifiers = new HashSet<Annotation>(this.qualifierAnnotations);
 
         if (qualifiers != null && qualifiers.length > 0)
@@ -188,8 +187,8 @@ class InstanceImpl<T> implements Instanc
     @Override
     public <U extends T> Instance<U> select(Class<U> subtype, Annotation... qualifiers)
     {
-        AnnotationUtil.checkQualifierConditions(qualifiers);
-        
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);
+
         Type sub = subtype;
         
         if(sub == null)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java Thu Jan  6 09:35:31 2011
@@ -42,6 +42,7 @@ import javax.interceptor.ExcludeClassInt
 import javax.interceptor.Interceptors;
 import javax.interceptor.InvocationContext;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.component.InjectionTargetBean;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
@@ -309,7 +310,7 @@ public final class InterceptorUtil
         }
         
         Annotation[] anns = annotatedType.getAnnotations().toArray(new Annotation[0]);
-        if (!AnnotationUtil.hasInterceptorBindingMetaAnnotation(anns))
+        if (!WebBeansContext.getInstance().getAnnotationManager().hasInterceptorBindingMetaAnnotation(anns))
         {
             throw new WebBeansConfigurationException("Interceptor class : " + annotatedType.getJavaClass().getName()
                                                      + " must have at least one @InterceptorBinding annotation");
@@ -333,8 +334,9 @@ public final class InterceptorUtil
                                                          + method.getName());
             }
         }
-        
-        if (!AnnotationUtil.hasInterceptorBindingMetaAnnotation(clazz.getDeclaredAnnotations()))
+
+        if (!WebBeansContext.getInstance().getAnnotationManager().hasInterceptorBindingMetaAnnotation(
+            clazz.getDeclaredAnnotations()))
         {
             throw new WebBeansConfigurationException("WebBeans Interceptor class : " + clazz.getName()
                                                      + " must have at least one @InterceptorBinding annotation");
@@ -350,7 +352,8 @@ public final class InterceptorUtil
 
         if (isLifecycleMethodInterceptor(clazz) && !isBusinessMethodInterceptor(clazz))
         {
-            Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);
+            Annotation[] anns =
+                WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(annots);
 
             for (Annotation annotation : anns)
             {
@@ -370,7 +373,8 @@ public final class InterceptorUtil
     {
         if (isLifecycleMethodInterceptor(annotatedType) && !isBusinessMethodInterceptor(annotatedType))
         {
-            Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);
+            Annotation[] anns =
+                WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(annots);
 
             for (Annotation annotation : anns)
             {
@@ -393,16 +397,17 @@ public final class InterceptorUtil
         Annotation[] anns = clazz.getDeclaredAnnotations();
 
         boolean hasClassInterceptors = false;
-        if (AnnotationUtil.getInterceptorBindingMetaAnnotations(anns).length > 0)
+        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        if (annotationManager.getInterceptorBindingMetaAnnotations(anns).length > 0)
         {
             hasClassInterceptors = true;
         }
         else
         {
-            Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
+            Annotation[] stereoTypes = annotationManager.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
             for (Annotation stero : stereoTypes)
             {
-                if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))
+                if (annotationManager.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))
                 {
                     hasClassInterceptors = true;
                     break;
@@ -431,7 +436,8 @@ public final class InterceptorUtil
                 }
                 else
                 {
-                    if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(method.getDeclaredAnnotations()))
+                    if (annotationManager.hasInterceptorBindingMetaAnnotation(
+                        method.getDeclaredAnnotations()))
                     {
                         throw new WebBeansConfigurationException("Method : " + method.getName() + "in simple web bean class : "
                                                                  + clazz.getName()

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java Thu Jan  6 09:35:31 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.webbeans.intercept;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.component.AbstractOwbBean;
 import org.apache.webbeans.config.OWBLogConst;
@@ -162,9 +163,10 @@ public final class WebBeansInterceptorCo
         {
             typeAnns = clazz.getDeclaredAnnotations();
         }
-        if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(typeAnns))
+        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        if (annotationManager.hasInterceptorBindingMetaAnnotation(typeAnns))
         {
-            anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(typeAnns);
+            anns = annotationManager.getInterceptorBindingMetaAnnotations(typeAnns);
 
             for (Annotation ann : anns)
             {
@@ -174,12 +176,14 @@ public final class WebBeansInterceptorCo
 
         // check for stereotypes _explicitly_ declared on the bean class (not
         // inherited)
-        Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(typeAnns);
+        Annotation[] stereoTypes =
+            annotationManager.getStereotypeMetaAnnotations(typeAnns);
         for (Annotation stero : stereoTypes)
         {
-            if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))
+            if (annotationManager.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))
             {
-                Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());
+                Annotation[] steroInterceptorBindings = annotationManager.getInterceptorBindingMetaAnnotations(
+                        stero.annotationType().getDeclaredAnnotations());
 
                 for (Annotation ann : steroInterceptorBindings)
                 {
@@ -200,7 +204,7 @@ public final class WebBeansInterceptorCo
             {
                 Annotation[] inheritedAnns = new Annotation[inheritedBindingTypes.size()];
                 inheritedAnns = inheritedBindingTypes.toArray(inheritedAnns);
-                anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(inheritedAnns);
+                anns = annotationManager.getInterceptorBindingMetaAnnotations(inheritedAnns);
                 bindingTypeSet.addAll(Arrays.asList(anns));
             }
 
@@ -214,13 +218,14 @@ public final class WebBeansInterceptorCo
                 // of stereotypes we've found
                 Annotation[] inherited = new Annotation[inheritedStereotypes.size()];
                 inherited = inheritedStereotypes.toArray(inherited);
-                Annotation[] transitiveStereotypes = AnnotationUtil.getStereotypeMetaAnnotations(inherited);
+                Annotation[] transitiveStereotypes = annotationManager.getStereotypeMetaAnnotations(inherited);
 
                 for (Annotation stereo : transitiveStereotypes)
                 {
-                    if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(stereo.annotationType().getDeclaredAnnotations()))
+                    if (annotationManager.hasInterceptorBindingMetaAnnotation(stereo.annotationType().getDeclaredAnnotations()))
                     {
-                        Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stereo.annotationType().getDeclaredAnnotations());
+                        Annotation[] steroInterceptorBindings =
+                            annotationManager.getInterceptorBindingMetaAnnotations(stereo.annotationType().getDeclaredAnnotations());
                         for (Annotation ann : steroInterceptorBindings)
                         {
                             bindingTypeSet.add(ann);
@@ -354,6 +359,8 @@ public final class WebBeansInterceptorCo
     private static void addMethodInterceptors(Class<?> clazz, List<InterceptorData> stack, Set<Interceptor<?>> componentInterceptors,
                                               Set<Annotation> resolvedComponentInterceptorBindings)
     {
+        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+
         // All methods, not just those declared
         Method[] methods = clazz.getMethods();
         Set<Method> set = new HashSet<Method>();
@@ -375,9 +382,12 @@ public final class WebBeansInterceptorCo
         for (Method method : methods)
         {
             Set<Annotation> interceptorAnns = new HashSet<Annotation>();
-            if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(method.getDeclaredAnnotations()))
+            if (annotationManager.hasInterceptorBindingMetaAnnotation(
+                method.getDeclaredAnnotations()))
             {
-                Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(method.getAnnotations());
+                Annotation[] anns =
+                    annotationManager.getInterceptorBindingMetaAnnotations(
+                        method.getAnnotations());
                 for (Annotation ann : anns)
                 {
                     interceptorAnns.add(ann);
@@ -428,6 +438,7 @@ public final class WebBeansInterceptorCo
     private static <T> void addMethodInterceptors(AnnotatedType<T> annotatedType, List<InterceptorData> stack, Set<Interceptor<?>> componentInterceptors)
     {
 
+        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
         Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
         for(AnnotatedMethod<? super T> methodA : methods)
         {
@@ -436,10 +447,14 @@ public final class WebBeansInterceptorCo
             Set<Annotation> interceptorAnns = new HashSet<Annotation>();
             
             Annotation[] methodAnns = AnnotationUtil.getAnnotationsFromSet(methodB.getAnnotations());
-            if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(methodAnns))
-            {                
-                Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(methodAnns);
-                Annotation[] annsClazz = AnnotationUtil.getInterceptorBindingMetaAnnotations(AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));
+            if (annotationManager.hasInterceptorBindingMetaAnnotation(methodAnns))
+            {
+                Annotation[] anns =
+                    annotationManager.getInterceptorBindingMetaAnnotations(
+                        methodAnns);
+                Annotation[] annsClazz =
+                    annotationManager.getInterceptorBindingMetaAnnotations(
+                        AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));
 
                 for (Annotation ann : anns)
                 {
@@ -452,12 +467,17 @@ public final class WebBeansInterceptorCo
                 }
             }
 
-            Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));
+            Annotation[] stereoTypes =
+                annotationManager.getStereotypeMetaAnnotations(
+                    AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));
             for (Annotation stero : stereoTypes)
             {
-                if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))
+                if (annotationManager.hasInterceptorBindingMetaAnnotation(
+                    stero.annotationType().getDeclaredAnnotations()))
                 {
-                    Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());
+                    Annotation[] steroInterceptorBindings =
+                        annotationManager.getInterceptorBindingMetaAnnotations(
+                            stero.annotationType().getDeclaredAnnotations());
 
                     for (Annotation ann : steroInterceptorBindings)
                     {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java Thu Jan  6 09:35:31 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.webbeans.intercept.webbeans;
 
+import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.component.AbstractOwbBean;
 import org.apache.webbeans.component.ManagedBean;
@@ -187,6 +188,8 @@ public class WebBeansInterceptor<T> exte
 
         Set<Annotation> keys = getInterceptorBindings();
 
+        AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+
         for (Annotation key : keys)
         {
             Class<? extends Annotation> clazzAnnot = key.annotationType();
@@ -200,9 +203,9 @@ public class WebBeansInterceptor<T> exte
                 anns = declared.toArray(anns);
             }
 
-            else if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(clazzAnnot.getDeclaredAnnotations()))
+            else if (annotationManager.hasInterceptorBindingMetaAnnotation(clazzAnnot.getDeclaredAnnotations()))
             {
-                anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazzAnnot.getDeclaredAnnotations());
+                anns = annotationManager.getInterceptorBindingMetaAnnotations(clazzAnnot.getDeclaredAnnotations());
             }
 
             /*

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java Thu Jan  6 09:35:31 2011
@@ -18,20 +18,14 @@
  */
 package org.apache.webbeans.util;
 
-import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.WebBeansException;
-import org.apache.webbeans.xml.XMLAnnotationTypeManager;
 
 import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Stereotype;
 import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedParameter;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.util.Nonbinding;
-import javax.inject.Qualifier;
-import javax.interceptor.InterceptorBinding;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -41,7 +35,6 @@ import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -319,36 +312,13 @@ public final class AnnotationUtil
         
         return null;
     }
-    
+
+    @Deprecated
     public static <X> Annotation[] getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
     {
-        Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
-        Asserts.nullCheckForClass(clazz);
-        
-        List<Annotation> list = new ArrayList<Annotation>();
-        List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
-        for(AnnotatedParameter<X> parameter : parameters)
-        {
-            if(parameter.isAnnotationPresent(clazz))
-            {
-                Annotation[] anns = getAnnotationsFromSet(parameter.getAnnotations());
-                for(Annotation ann : anns)
-                {
-                    if(isQualifierAnnotation(ann.annotationType()))
-                    {
-                        list.add(ann);
-                    }
-                }
-            }
-        }
-        
-        Annotation[] finalAnns = new Annotation[list.size()];
-        finalAnns = list.toArray(finalAnns);
-        
-        return finalAnns;
+        return WebBeansContext.getInstance().getAnnotationManager().getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(annotatedMethod, clazz);
     }
     
-
     public static Class<?> getMethodFirstParameterTypeClazzWithAnnotation(Method method, Class<? extends Annotation> clazz)
     {
         Type type = getMethodFirstParameterWithAnnotation(method, clazz);
@@ -362,52 +332,18 @@ public final class AnnotationUtil
             return (Class<?>) type;
         }
     }
-        
-    
+
     /**
      * Gets the method first found parameter qualifiers.
-     * 
+     *
      * @param method method
      * @param clazz checking annotation
      * @return annotation array
      */
+    @Deprecated
     public static Annotation[] getMethodFirstParameterQualifierWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)
     {
-        Asserts.assertNotNull(method, "Method argument can not be null");
-        Asserts.nullCheckForClass(clazz);
-
-        Annotation[][] parameterAnns = method.getParameterAnnotations();
-        List<Annotation> list = new ArrayList<Annotation>();
-        Annotation[] result;
-
-        for (Annotation[] parameters : parameterAnns)
-        {
-            boolean found = false;
-            for (Annotation param : parameters)
-            {
-                Class<? extends Annotation> btype = param.annotationType();
-                if (btype.equals(clazz))
-                {
-                    found = true;
-                    continue;
-                }
-
-                if (AnnotationUtil.isQualifierAnnotation(btype))
-                {
-                    list.add(param);
-                }
-
-            }
-
-            if (found)
-            {
-                result = new Annotation[list.size()];
-                result = list.toArray(result);
-                return result;
-            }
-        }
-        result = new Annotation[0];
-        return result;
+        return WebBeansContext.getInstance().getAnnotationManager().getMethodFirstParameterQualifierWithGivenAnnotation(method, clazz);
     }
 
     /**
@@ -753,38 +689,16 @@ public final class AnnotationUtil
         return Collections.emptyList();
     }
 
-
     /**
      * Gets the array of qualifier annotations on the given array.
-     * 
+     *
      * @param annotations annotation array
      * @return array containing qualifier anns
      */
+    @Deprecated
     public static Annotation[] getQualifierAnnotations(Annotation... annotations)
     {
-        Asserts.assertNotNull(annotations, "Annotations argument can not be null");
-
-        Set<Annotation> set = new HashSet<Annotation>();
-
-        for (Annotation annot : annotations)
-        {
-            if (AnnotationUtil.isQualifierAnnotation(annot.annotationType()))
-            {
-                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);
-
-        return a;
+        return WebBeansContext.getInstance().getAnnotationManager().getQualifierAnnotations(annotations);
     }
 
 
@@ -973,17 +887,10 @@ public final class AnnotationUtil
         return fields;
     }
 
+    @Deprecated
     public static void checkQualifierConditions(Annotation... qualifierAnnots)
     {
-        Set<Annotation> annSet = ArrayUtil.asSet(qualifierAnnots);
-
-        //check for duplicate annotations
-        if (qualifierAnnots.length != annSet.size())
-        {
-            throw new IllegalArgumentException("Qualifier annotations can not contain duplicate qualifiers:" + qualifierAnnots);
-        }
-
-        checkQualifierConditions(annSet);
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifierAnnots);
     }
 
     /**
@@ -991,67 +898,26 @@ public final class AnnotationUtil
      * So this must have been done before!
      * @param qualifierAnnots
      */
+    @Deprecated
     public static void checkQualifierConditions(Set<Annotation> qualifierAnnots)
     {
-        for (Annotation ann : qualifierAnnots)
-        {
-            checkQualifierConditions(ann);
-        }
-    }
-
-    private static void checkQualifierConditions(Annotation ann)
-    {
-        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(ann.annotationType());
-
-        for (Method method : methods)
-        {
-            Class<?> clazz = method.getReturnType();
-            if (clazz.isArray() || clazz.isAnnotation())
-            {
-                if (!AnnotationUtil.hasAnnotation(method.getDeclaredAnnotations(), Nonbinding.class))
-                {
-                    throw new WebBeansConfigurationException("@Qualifier : " + ann.annotationType().getName()
-                                                             + " must have @NonBinding valued members for its array-valued and annotation valued members");
-                }
-            }
-        }
-        
-        
-        if (!AnnotationUtil.isQualifierAnnotation(ann.annotationType()))
-        {
-            throw new IllegalArgumentException("Qualifier annotations must be annotated with @Qualifier");
-        }
+        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifierAnnots);
     }
 
     /**
      * Returns true if the annotation is defined in xml or annotated with
      * {@link javax.inject.Qualifier} false otherwise.
-     * 
+     *
      * @param clazz type of the annotation
      * @return true if the annotation is defined in xml or annotated with
      *         {@link javax.inject.Qualifier} false otherwise
      */
+    @Deprecated
     public static boolean isQualifierAnnotation(Class<? extends Annotation> clazz)
     {
-        Asserts.nullCheckForClass(clazz);
-        XMLAnnotationTypeManager manager = WebBeansContext.getInstance().getxMLAnnotationTypeManager();
-        if (manager.hasBindingType(clazz))
-        {
-            return true;
-        }
-        else if (clazz.isAnnotationPresent(Qualifier.class))
-        {
-            return true;
-        }
-        else if(WebBeansContext.getInstance().getBeanManagerImpl().getAdditionalQualifiers().contains(clazz))
-        {
-            return true;
-        }
-
-        return false;
+        return WebBeansContext.getInstance().getAnnotationManager().isQualifierAnnotation(clazz);
     }
-    
-    
+
     /**
      * Returns true if any binding exist
      * 
@@ -1090,57 +956,33 @@ public final class AnnotationUtil
         
         return null;        
     }
-    
 
     /**
      * Returns true if the annotation is defined in xml or annotated with
      * {@link javax.interceptor.InterceptorBinding} false otherwise.
-     * 
+     *
      * @param clazz type of the annotation
      * @return true if the annotation is defined in xml or annotated with
      *         {@link javax.interceptor.InterceptorBinding} false otherwise
      */
+    @Deprecated
     public static boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz)
     {
-        Asserts.nullCheckForClass(clazz);
-        XMLAnnotationTypeManager manager = WebBeansContext.getInstance().getxMLAnnotationTypeManager();
-        if (manager.hasInterceptorBindingType(clazz))
-        {
-            return true;
-        }
-        else if (clazz.isAnnotationPresent(InterceptorBinding.class))
-        {
-            return true;
-        }
-
-        return false;
+        return WebBeansContext.getInstance().getAnnotationManager().isInterceptorBindingAnnotation(clazz);
     }
 
     /**
      * If any Annotations in the input is an interceptor binding annotation type then return
      * true, false otherwise.
-     * 
-     * @param anns array of Annotations to check 
+     *
+     * @param anns array of Annotations to check
      * @return true if one or moe of the input annotations are an interceptor binding annotation
      *         type false otherwise
      */
+    @Deprecated
     public static boolean hasInterceptorBindingMetaAnnotation(Annotation[] anns)
     {
-        Asserts.assertNotNull(anns, "anns parameter can not be null");
-
-        for (Annotation ann : anns)
-        {
-            if (isInterceptorBindingAnnotation(ann.annotationType()))
-            {
-                return true;
-            }
-            else
-            {
-                continue;
-            }
-        }
-
-        return false;
+        return WebBeansContext.getInstance().getAnnotationManager().hasInterceptorBindingMetaAnnotation(anns);
     }
 
     /**
@@ -1149,156 +991,56 @@ public final class AnnotationUtil
      * @param anns An array of annotations
      * @return an array of interceptor binding annotations, including the input and any transitively declared annotations
      */
+    @Deprecated
     public static Annotation[] getInterceptorBindingMetaAnnotations(Annotation[] anns)
     {
-        Asserts.assertNotNull(anns, "anns parameter can not be null");
-        List<Annotation> interAnns = new ArrayList<Annotation>();
-
-        for (Annotation ann : anns)
-        {
-            if (isInterceptorBindingAnnotation(ann.annotationType()))
-            {
-                interAnns.add(ann);
-                
-                //check for transitive
-                Annotation[] transitives = getTransitiveInterceptorBindings(ann.annotationType().getDeclaredAnnotations());
-                
-                for(Annotation transitive : transitives)
-                {
-                    interAnns.add(transitive);
-                }
-                
-            }
-        }
-
-        Annotation[] ret = new Annotation[interAnns.size()];
-        ret = interAnns.toArray(ret);
-
-        return ret;
-    }
-    
-    private static Annotation[] getTransitiveInterceptorBindings(Annotation[] anns)
-    {
-        return getInterceptorBindingMetaAnnotations(anns);
+        return WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(anns);
     }
- 
-    public static Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
-    {
-        Asserts.assertNotNull(anns, "anns parameter can not be null");
-        List<Annotation> interAnns = new ArrayList<Annotation>();
-
-        for (Annotation ann : anns)
-        {
-            if (isStereoTypeAnnotation(ann.annotationType()))
-            {
-                interAnns.add(ann);
-                
-                //check for transitive
-                Annotation[] transitives = getTransitiveStereoTypes(ann.annotationType().getDeclaredAnnotations());
-                
-                for(Annotation transitive : transitives)
-                {
-                    interAnns.add(transitive);
-                }                
-            }
-        }
 
-        Annotation[] ret = new Annotation[interAnns.size()];
-        ret = interAnns.toArray(ret);
-
-        return ret;
-    }
-    
-    private static Annotation[] getTransitiveStereoTypes(Annotation[] anns)
+    @Deprecated
+    public static Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
     {
-        return getStereotypeMetaAnnotations(anns);
+        return WebBeansContext.getInstance().getAnnotationManager().getStereotypeMetaAnnotations(anns);
     }
-    
 
+    @Deprecated
     public static boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
     {
-        Asserts.assertNotNull(anns, "anns parameter can not be null");
-
-        for (Annotation ann : anns)
-        {
-            if (isStereoTypeAnnotation(ann.annotationType()))
-            {
-                return true;
-            }
-            else
-            {
-                continue;
-            }
-        }
-
-        return false;
+        return WebBeansContext.getInstance().getAnnotationManager().hasStereoTypeMetaAnnotation(anns);
     }
 
     /**
      * Returns true if the annotation is defined in xml or annotated with
-     * {@link Stereotype} false otherwise.
-     * 
+     * {@link javax.enterprise.inject.Stereotype} false otherwise.
+     *
      * @param clazz type of the annotation
      * @return true if the annotation is defined in xml or annotated with
-     *         {@link Stereotype} false otherwise
+     *         {@link javax.enterprise.inject.Stereotype} false otherwise
      */
+    @Deprecated
     public static boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
     {
-        Asserts.nullCheckForClass(clazz);
-        XMLAnnotationTypeManager manager = WebBeansContext.getInstance().getxMLAnnotationTypeManager();
-        if (manager.hasStereoType(clazz))
-        {
-            return true;
-        }
-        else if (clazz.isAnnotationPresent(Stereotype.class))
-        {
-            return true;
-        }
-
-        return false;
+        return WebBeansContext.getInstance().getAnnotationManager().isStereoTypeAnnotation(clazz);
     }
-    
+
     /**
-     * If the bean extends generic class via {@link Realizes}
+     * If the bean extends generic class via Realizes
      * annotation, realized based producer methods, fields and observer
      * methods qualifier is
-     * 
+     *
      * <ul>
      *  <li>Qualifiers on the definitions</li>
      *  <li>Plus class qualifiers</li>
      *  <li>Minus generic class qualifiers</li>
      * </ul>
-     * 
+     *
      * @param clazz realized definition class
      * @param anns binding annotations array
      */
+    @Deprecated
     public static Annotation[] getRealizesGenericAnnotations(Class<?> clazz, Annotation[] anns)
     {
-       Set<Annotation> setAnnots = new HashSet<Annotation>();
-        
-        for(Annotation definedAnn : anns)
-        {
-            setAnnots.add(definedAnn);
-        }
-        
-        Annotation[] genericReliazesAnns = AnnotationUtil.getQualifierAnnotations(clazz.getSuperclass().getDeclaredAnnotations());
-        
-        for(Annotation generic : genericReliazesAnns)
-        {
-            setAnnots.remove(generic);
-        }
-        
-        genericReliazesAnns = AnnotationUtil.getQualifierAnnotations(clazz.getDeclaredAnnotations());
-
-        for(Annotation generic : genericReliazesAnns)
-        {
-            setAnnots.add(generic);
-        }            
-        
-        Annotation[] annots = new Annotation[setAnnots.size()];
-        annots = setAnnots.toArray(annots);
-        
-        return annots;
+        return WebBeansContext.getInstance().getAnnotationManager().getRealizesGenericAnnotations(clazz, anns);
     }
 
     public static Annotation[] getAnnotationsFromSet(Set<Annotation> set)



Re: svn commit: r1055805 [1/2] - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/corespi/ main/java/org/apache/...

Posted by David Blevins <da...@visi.com>.
On Jan 6, 2011, at 1:55 AM, Gurkan Erdogdu wrote:

> Some statements in WebBeansContext and DefaultsingleonService as
> 
> util.Track.....
> 
> I will comment out them....

Whoops! Thanks, Gurkan!  I have a script to comment/uncomment them, but forgot to run it.  Was a little tired :)


-David


Re: svn commit: r1055805 [1/2] - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/corespi/ main/java/org/apache/...

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Some statements in WebBeansContext and DefaultsingleonService as

util.Track.....

I will comment out them....



----- Original Message ----
From: "dblevins@apache.org" <db...@apache.org>
To: commits@openwebbeans.apache.org
Sent: Thu, January 6, 2011 11:35:32 AM
Subject: svn commit: r1055805 [1/2] - in /openwebbeans/trunk/webbeans-impl/src: 
main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/config/ 
main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/corespi/ 
main/java/org/apache/...

Author: dblevins
Date: Thu Jan  6 09:35:31 2011
New Revision: 1055805

URL: http://svn.apache.org/viewvc?rev=1055805&view=rev
Log:
Moved AnnotationUtil code that operated    on the WebBeansContext into an new 
AnnotationManager class that    now also lives in the WebBeansContext
Retained but deprecated      all the    affected methods of AnnotationUtil.
Consolidated repeated calls made in the same method (either in code or loops) to 
WebBeansContext.getInstance().getAnnotationManager()

OWB-503 status: 568 code uses
Total of 165069 static synchronized accesses and 232559 hashed calls in 340 
tests
Average of 485 static synchronized accesses and 683 hashed calls per test

Added:
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java 
  (with props)
Modified:
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java

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

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java

    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

    
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java


Added: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java?rev=1055805&view=auto

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
 (added)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
 Thu Jan  6 09:35:31 2011
@@ -0,0 +1,457 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.annotation;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.ArrayUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.SecurityUtil;
+import org.apache.webbeans.xml.XMLAnnotationTypeManager;
+
+import javax.enterprise.inject.Stereotype;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Manages annotation usage by classes in this application.
+ */
+public final class AnnotationManager
+{
+    public static final Annotation[] EMPTY_ANNOTATION_ARRAY = new 
Annotation[0];
+
+    public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
+    private final XMLAnnotationTypeManager manager;
+
+    private final BeanManagerImpl beanManagerImpl;
+
+    // No instantiate
+
+    public AnnotationManager(WebBeansContext context)
+    {
+        manager = context.getxMLAnnotationTypeManager();
+        beanManagerImpl = context.getBeanManagerImpl();
+    }
+
+
+    /**
+     * Returns true if the annotation is defined in xml or annotated with
+     * {@link javax.interceptor.InterceptorBinding} false otherwise.
+     *
+     * @param clazz type of the annotation
+     * @return true if the annotation is defined in xml or annotated with
+     *         {@link javax.interceptor.InterceptorBinding} false otherwise
+     */
+    public boolean isInterceptorBindingAnnotation(Class<? extends Annotation> 
clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        if (manager.hasInterceptorBindingType(clazz))
+        {
+            return true;
+        }
+        else if (clazz.isAnnotationPresent(InterceptorBinding.class))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * If any Annotations in the input is an interceptor binding annotation 
type then return
+     * true, false otherwise.
+     *
+     * @param anns array of Annotations to check
+     * @return true if one or moe of the input annotations are an interceptor 
binding annotation
+     *         type false otherwise
+     */
+    public boolean hasInterceptorBindingMetaAnnotation(Annotation[] anns)
+    {
+        Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+        for (Annotation ann : anns)
+        {
+            if (isInterceptorBindingAnnotation(ann.annotationType()))
+            {
+                return true;
+            }
+            else
+            {
+                continue;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Collect the interceptor bindings from an array of annotations, including
+     * transitively defined interceptor bindings.
+     * @param anns An array of annotations
+     * @return an array of interceptor binding annotations, including the input 
and any transitively declared annotations
+     */
+    public Annotation[] getInterceptorBindingMetaAnnotations(Annotation[] anns)
+    {
+        Asserts.assertNotNull(anns, "anns parameter can not be null");
+        List<Annotation> interAnns = new ArrayList<Annotation>();
+
+        for (Annotation ann : anns)
+        {
+            if (isInterceptorBindingAnnotation(ann.annotationType()))
+            {
+                interAnns.add(ann);
+
+                //check for transitive
+                Annotation[] transitives = 
getTransitiveInterceptorBindings(ann.annotationType().getDeclaredAnnotations());
+
+                for(Annotation transitive : transitives)
+                {
+                    interAnns.add(transitive);
+                }
+
+            }
+        }
+
+        Annotation[] ret = new Annotation[interAnns.size()];
+        ret = interAnns.toArray(ret);
+
+        return ret;
+    }
+
+    private Annotation[] getTransitiveInterceptorBindings(Annotation[] anns)
+    {
+        return getInterceptorBindingMetaAnnotations(anns);
+    }
+
+    /**
+     * Returns true if the annotation is defined in xml or annotated with
+     * {@link javax.inject.Qualifier} false otherwise.
+     *
+     * @param clazz type of the annotation
+     * @return true if the annotation is defined in xml or annotated with
+     *         {@link javax.inject.Qualifier} false otherwise
+     */
+    public boolean isQualifierAnnotation(Class<? extends Annotation> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        if (manager.hasBindingType(clazz))
+        {
+            return true;
+        }
+        else if (clazz.isAnnotationPresent(Qualifier.class))
+        {
+            return true;
+        }
+        else if(beanManagerImpl.getAdditionalQualifiers().contains(clazz))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    public <X> Annotation[] 
getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(
+            AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> 
clazz)
+    {
+        Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can 
not be null");
+        Asserts.nullCheckForClass(clazz);
+
+        List<Annotation> list = new ArrayList<Annotation>();
+        List<AnnotatedParameter<X>> parameters = 
annotatedMethod.getParameters();
+        for(AnnotatedParameter<X> parameter : parameters)
+        {
+            if(parameter.isAnnotationPresent(clazz))
+            {
+                Annotation[] anns = 
AnnotationUtil.getAnnotationsFromSet(parameter.getAnnotations());
+                for(Annotation ann : anns)
+                {
+                    if(isQualifierAnnotation(ann.annotationType()))
+                    {
+                        list.add(ann);
+                    }
+                }
+            }
+        }
+
+        Annotation[] finalAnns = new Annotation[list.size()];
+        finalAnns = list.toArray(finalAnns);
+
+        return finalAnns;
+    }
+
+
+    /**
+     * Gets the method first found parameter qualifiers.
+     *
+     * @param method method
+     * @param clazz checking annotation
+     * @return annotation array
+     */
+    public Annotation[] 
getMethodFirstParameterQualifierWithGivenAnnotation(Method method, Class<? 
extends Annotation> clazz)
+    {
+        Asserts.assertNotNull(method, "Method argument can not be null");
+        Asserts.nullCheckForClass(clazz);
+
+        Annotation[][] parameterAnns = method.getParameterAnnotations();
+        List<Annotation> list = new ArrayList<Annotation>();
+        Annotation[] result;
+
+        for (Annotation[] parameters : parameterAnns)
+        {
+            boolean found = false;
+            for (Annotation param : parameters)
+            {
+                Class<? extends Annotation> btype = param.annotationType();
+                if (btype.equals(clazz))
+                {
+                    found = true;
+                    continue;
+                }
+
+                if (isQualifierAnnotation(btype))
+                {
+                    list.add(param);
+                }
+
+            }
+
+            if (found)
+            {
+                result = new Annotation[list.size()];
+                result = list.toArray(result);
+                return result;
+            }
+        }
+        result = new Annotation[0];
+        return result;
+    }
+
+    /**
+     * Gets the array of qualifier annotations on the given array.
+     *
+     * @param annotations annotation array
+     * @return array containing qualifier anns
+     */
+    public Annotation[] getQualifierAnnotations(Annotation... annotations)
+    {
+        Asserts.assertNotNull(annotations, "Annotations argument can not be 
null");
+
+        Set<Annotation> set = new HashSet<Annotation>();
+
+        for (Annotation annot : annotations)
+        {
+            if (isQualifierAnnotation(annot.annotationType()))
+            {
+                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);
+
+        return a;
+    }
+
+
+    /**
+     * If the bean extends generic class via Realizes
+     * annotation, realized based producer methods, fields and observer
+     * methods qualifier is
+     *
+     * <ul>
+     *  <li>Qualifiers on the definitions</li>
+     *  <li>Plus class qualifiers</li>
+     *  <li>Minus generic class qualifiers</li>
+     * </ul>
+     *
+     * @param clazz realized definition class
+     * @param anns binding annotations array
+     */
+    public Annotation[] getRealizesGenericAnnotations(Class<?> clazz, 
Annotation[] anns)
+    {
+       Set<Annotation> setAnnots = new HashSet<Annotation>();
+
+        for(Annotation definedAnn : anns)
+        {
+            setAnnots.add(definedAnn);
+        }
+
+        Annotation[] genericReliazesAnns = 
getQualifierAnnotations(clazz.getSuperclass().getDeclaredAnnotations());
+
+        for(Annotation generic : genericReliazesAnns)
+        {
+            setAnnots.remove(generic);
+        }
+
+        genericReliazesAnns = 
getQualifierAnnotations(clazz.getDeclaredAnnotations());
+
+        for(Annotation generic : genericReliazesAnns)
+        {
+            setAnnots.add(generic);
+        }
+
+        Annotation[] annots = new Annotation[setAnnots.size()];
+        annots = setAnnots.toArray(annots);
+
+        return annots;
+    }
+
+    public void checkQualifierConditions(Annotation... qualifierAnnots)
+    {
+        Set<Annotation> annSet = ArrayUtil.asSet(qualifierAnnots);
+
+        //check for duplicate annotations
+        if (qualifierAnnots.length != annSet.size())
+        {
+            throw new IllegalArgumentException("Qualifier annotations can not 
contain duplicate qualifiers:" + qualifierAnnots);
+        }
+
+        checkQualifierConditions(annSet);
+    }
+
+    /**
+     * This function obviously cannot check for duplicate annotations.
+     * So this must have been done before!
+     * @param qualifierAnnots
+     */
+    public void checkQualifierConditions(Set<Annotation> qualifierAnnots)
+    {
+        for (Annotation ann : qualifierAnnots)
+        {
+            checkQualifierConditions(ann);
+        }
+    }
+
+    private void checkQualifierConditions(Annotation ann)
+    {
+        Method[] methods = 
SecurityUtil.doPrivilegedGetDeclaredMethods(ann.annotationType());
+
+        for (Method method : methods)
+        {
+            Class<?> clazz = method.getReturnType();
+            if (clazz.isArray() || clazz.isAnnotation())
+            {
+                if 
(!AnnotationUtil.hasAnnotation(method.getDeclaredAnnotations(), 
Nonbinding.class))
+                {
+                    throw new WebBeansConfigurationException("@Qualifier : " + 
ann.annotationType().getName()
+                                                             + " must have 
@NonBinding valued members for its array-valued and annotation valued members");
+                }
+            }
+        }
+
+        if (!isQualifierAnnotation(ann.annotationType()))
+        {
+            throw new IllegalArgumentException("Qualifier annotations must be 
annotated with @Qualifier");
+        }
+    }
+
+    /**
+     * Returns true if the annotation is defined in xml or annotated with
+     * {@link javax.enterprise.inject.Stereotype} false otherwise.
+     *
+     * @param clazz type of the annotation
+     * @return true if the annotation is defined in xml or annotated with
+     *         {@link javax.enterprise.inject.Stereotype} false otherwise
+     */
+    public boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        if (manager.hasStereoType(clazz))
+        {
+            return true;
+        }
+        else if (clazz.isAnnotationPresent(Stereotype.class))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    public boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
+    {
+        Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+        for (Annotation ann : anns)
+        {
+            if (isStereoTypeAnnotation(ann.annotationType()))
+            {
+                return true;
+            }
+            else
+            {
+                continue;
+            }
+        }
+
+        return false;
+    }
+
+    public Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
+    {
+        Asserts.assertNotNull(anns, "anns parameter can not be null");
+        List<Annotation> interAnns = new ArrayList<Annotation>();
+
+        for (Annotation ann : anns)
+        {
+            if (isStereoTypeAnnotation(ann.annotationType()))
+            {
+                interAnns.add(ann);
+
+                //check for transitive
+                Annotation[] transitives = 
getTransitiveStereoTypes(ann.annotationType().getDeclaredAnnotations());
+
+                for(Annotation transitive : transitives)
+                {
+                    interAnns.add(transitive);
+                }
+            }
+        }
+
+        Annotation[] ret = new Annotation[interAnns.size()];
+        ret = interAnns.toArray(ret);
+
+        return ret;
+    }
+
+    private Annotation[] getTransitiveStereoTypes(Annotation[] anns)
+    {
+        return getStereotypeMetaAnnotations(anns);
+    }
+
+}

Propchange: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java

------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
 Thu Jan  6 09:35:31 2011
@@ -39,6 +39,7 @@ import javax.enterprise.inject.spi.Injec
import javax.enterprise.inject.spi.ProcessAnnotatedType;
import javax.interceptor.Interceptor;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.component.AbstractInjectionTargetBean;
import org.apache.webbeans.component.AbstractProducerBean;
import org.apache.webbeans.component.EnterpriseBeanMarker;
@@ -729,6 +730,8 @@ public class BeansDeployer
         logger.debug("Checking StereoType constraints has started.");

         addDefaultStereoTypes();
+
+        final AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
        
         Set<Class<?>> beanClasses = scanner.getBeanClasses();
         if (beanClasses != null && beanClasses.size() > 0)
@@ -737,8 +740,8 @@ public class BeansDeployer
             {                
                 if(beanClass.isAnnotation())
                 {
-                    Class<? extends Annotation> stereoClass = (Class<? extends 
Annotation>) beanClass;                    

-                    if (AnnotationUtil.isStereoTypeAnnotation(stereoClass))
+                    Class<? extends Annotation> stereoClass = (Class<? extends 
Annotation>) beanClass;
+                    if (annotationManager.isStereoTypeAnnotation(stereoClass))
                     {
                         if 
(!webBeansContext.getxMLAnnotationTypeManager().hasStereoType(stereoClass))
                         {

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
 Thu Jan  6 09:35:31 2011
@@ -50,6 +50,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Scope;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.annotation.AnyLiteral;
import org.apache.webbeans.annotation.DefaultLiteral;
import org.apache.webbeans.annotation.DependentScopeLiteral;
@@ -219,12 +220,14 @@ public final class DefinitionUtil
      */
     public static <T> void defineQualifiers(AbstractOwbBean<T> component, 
Annotation[] annotations)
     {
+        final AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
+
         boolean find = false;
         for (Annotation annotation : annotations)
         {
             Class<? extends Annotation> type = annotation.annotationType();

-            if (AnnotationUtil.isQualifierAnnotation(type))
+            if (annotationManager.isQualifierAnnotation(type))
             {
                 Method[] methods = 
SecurityUtil.doPrivilegedGetDeclaredMethods(type);

@@ -390,9 +393,11 @@ public final class DefinitionUtil

     public static <T> void defineStereoTypes(OwbBean<?> component, Annotation[] 
anns)
     {
-        if (AnnotationUtil.hasStereoTypeMetaAnnotation(anns))
+        final AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
+        if (annotationManager.hasStereoTypeMetaAnnotation(anns))
         {
-            Annotation[] steroAnns = 
AnnotationUtil.getStereotypeMetaAnnotations(anns);
+            Annotation[] steroAnns =
+                annotationManager.getStereotypeMetaAnnotations(anns);

             for (Annotation stereo : steroAnns)
             {
@@ -761,6 +766,8 @@ public final class DefinitionUtil

     private static <T> void createDisposalMethods(AbstractOwbBean<T> component, 
Method[] methods, Class<?> clazz)
     {
+        final AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
+
         ProducerMethodBean<?> previous = null;
         for (Method declaredMethod : methods)
         {
@@ -768,7 +775,7 @@ public final class DefinitionUtil
             WebBeansUtil.checkProducerMethodDisposal(declaredMethod, 
clazz.getName());

             Type type = 
AnnotationUtil.getMethodFirstParameterWithAnnotation(declaredMethod, 
Disposes.class);
-            Annotation[] annot = 
AnnotationUtil.getMethodFirstParameterQualifierWithGivenAnnotation(declaredMethod,
 Disposes.class);
+            Annotation[] annot = 
annotationManager.getMethodFirstParameterQualifierWithGivenAnnotation(declaredMethod,
 Disposes.class);


             Set<Bean<?>> set = 
InjectionResolver.getInstance().implResolveByType(type, annot);
@@ -850,6 +857,8 @@ public final class DefinitionUtil
     public static <T> void 
defineInternalInjectedFields(AbstractInjectionTargetBean<T> component, Class<T> 
clazz, boolean fromSuperClazz)
     {

+        final AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
+
         Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(clazz);

         if (fields.length != 0)
@@ -879,7 +888,7 @@ public final class DefinitionUtil
                     throw new WebBeansConfigurationException("Injection fields 
can not be annotated with @Produces");
                 }

-                Annotation[] qualifierAnns = 
AnnotationUtil.getQualifierAnnotations(anns);
+                Annotation[] qualifierAnns = 
annotationManager.getQualifierAnnotations(anns);

                 if (qualifierAnns.length > 0)
                 {

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
 Thu Jan  6 09:35:31 2011
@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.container.SerializableBeanVault;
import org.apache.webbeans.context.creational.CreationalContextFactory;
@@ -53,7 +54,7 @@ import org.apache.webbeans.xml.XMLSpecia
public class WebBeansContext
{

-    private AlternativesManager alternativesManager = new 
AlternativesManager();
+    private AlternativesManager alternativesManager = new 
AlternativesManager(this);
     private AnnotatedElementFactory annotatedElementFactory = new 
AnnotatedElementFactory();
     private BeanManagerImpl beanManagerImpl = new BeanManagerImpl(this);
     private ConversationManager conversationManager = new 
ConversationManager();
@@ -70,8 +71,9 @@ public class WebBeansContext
     private PluginLoader pluginLoader = new PluginLoader();
     private SerializableBeanVault serializableBeanVault = new 
SerializableBeanVault();
     private StereoTypeManager stereoTypeManager = new StereoTypeManager();
-    private WebBeansNameSpaceContainer webBeansNameSpaceContainer = new 
WebBeansNameSpaceContainer();
     private XMLAnnotationTypeManager xmlAnnotationTypeManager = new 
XMLAnnotationTypeManager(this);
+    private AnnotationManager annotationManager = new AnnotationManager(this);
+    private WebBeansNameSpaceContainer webBeansNameSpaceContainer = new 
WebBeansNameSpaceContainer();
     private XMLSpecializesManager xmlSpecializesManager = new 
XMLSpecializesManager();

     private final Map<String, Object> managerMap = new HashMap<String, 
Object>();
@@ -107,10 +109,10 @@ public class WebBeansContext
     }

     @Deprecated
-    public static WebBeansContext getInstance() 
+    public static WebBeansContext getInstance()
     {
         WebBeansContext webBeansContext = (WebBeansContext) 
WebBeansFinder.getSingletonInstance(WebBeansContext.class.getName());
-        
+
         return webBeansContext;
     }

@@ -158,6 +160,11 @@ public class WebBeansContext
         return (T) WebBeansFinder.getSingletonInstance(implName);
     }

+    public AnnotationManager getAnnotationManager()
+    {
+        return annotationManager;
+    }
+
     public ConversationManager getConversationManager()
     {
         return conversationManager;
@@ -260,14 +267,14 @@ public class WebBeansContext

     public Object get(String singletonName)
     {
-//        util.Track.get(singletonName);
+        util.Track.get(singletonName);
         Object object = managerMap.get(singletonName);

         /* No singleton for this application, create one */
         if (object == null)
         {
             object = createInstance(singletonName);
-            
+
             //Save it
             managerMap.put(singletonName, object);
         }

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
 Thu Jan  6 09:35:31 2011
@@ -694,9 +694,9 @@ public class BeanManagerImpl implements 
         {
             throw new IllegalArgumentException("Exception in getBeans method. 
Bean type can not be TypeVariable for bean type : " + beanType);
         }
-        
-        AnnotationUtil.checkQualifierConditions(bindings);
-        
+
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(bindings);

+
         return this.injectionResolver.implResolveByType(beanType, bindings);
        
     }
@@ -951,13 +951,13 @@ public class BeanManagerImpl implements 
     @Override
     public boolean isQualifier(Class<? extends Annotation> annotationType)
     {
-        return AnnotationUtil.isQualifierAnnotation(annotationType);
+        return 
webBeansContext.getAnnotationManager().isQualifierAnnotation(annotationType);
     }

     @Override
     public boolean isInterceptorBinding(Class<? extends Annotation> 
annotationType)
     {
-        return AnnotationUtil.isInterceptorBindingAnnotation(annotationType);
+        return 
webBeansContext.getAnnotationManager().isInterceptorBindingAnnotation(annotationType);

     }

     @Override

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
 Thu Jan  6 09:35:31 2011
@@ -27,7 +27,7 @@ import java.util.Set;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;

-import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.ClassUtil;
import org.apache.webbeans.util.WebBeansUtil;
@@ -81,7 +81,7 @@ public final class ResolutionUtil

     public static void getInstanceByTypeConditions(Annotation[] qualifiers)
     {
-        AnnotationUtil.checkQualifierConditions(qualifiers);
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);

     }

     public static void checkResolvedBeans(Set<Bean<?>> resolvedSet, Class<?> 
type, Annotation[] qualifiers) 


Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
 Thu Jan  6 09:35:31 2011
@@ -61,10 +61,10 @@ public class DefaultSingletonService imp

         synchronized (singletonMap)
         {
-//            util.Track.sync(singletonName);
+            util.Track.sync(singletonName);
            
             WebBeansContext managerMap = singletonMap.get(classLoader);
-//            util.Track.get(singletonName);
+            util.Track.get(singletonName);

             if (managerMap == null)
             {

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
 Thu Jan  6 09:35:31 2011
@@ -30,7 +30,9 @@ import javax.enterprise.inject.Typed;
import javax.inject.Named;
import javax.inject.Scope;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.logger.WebBeansLogger;
@@ -88,8 +90,9 @@ public class StereoTypeModel implements 
                 logger.warn(OWBLogConst.WARN_0016, clazz.getName());
             }            
         }
-        
-        Annotation[] qualifiers = 
AnnotationUtil.getQualifierAnnotations(annotations);
+
+        final AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
+        Annotation[] qualifiers = 
annotationManager.getQualifierAnnotations(annotations);
        
         if(qualifiers != null)
         {
@@ -119,19 +122,21 @@ public class StereoTypeModel implements 
         {
             this.defaultScopeType = 
AnnotationUtil.getMetaAnnotations(annotations, Scope.class)[0];
         }
-        
-        if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(annotations))
+
+        if (annotationManager.hasInterceptorBindingMetaAnnotation(annotations))
         {
-            Annotation[] ibs = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(annotations);
+            Annotation[] ibs =
+                
annotationManager.getInterceptorBindingMetaAnnotations(annotations);
             for (Annotation ann : ibs)
             {
                 this.interceptorBindingTypes.add(ann);
             }
         }

-        if (AnnotationUtil.hasStereoTypeMetaAnnotation(annotations))
+        if (annotationManager.hasStereoTypeMetaAnnotation(annotations))
         {
-            Annotation[] isy = 
AnnotationUtil.getStereotypeMetaAnnotations(annotations);
+            Annotation[] isy =
+                annotationManager.getStereotypeMetaAnnotations(annotations);

             Target outerStereo = clazz.getAnnotation(Target.class);
             for (Annotation is : isy)

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
 Thu Jan  6 09:35:31 2011
@@ -28,11 +28,12 @@ import javax.enterprise.context.NormalSc
import javax.inject.Named;
import javax.inject.Scope;

+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.definition.NonexistentTypeException;
import org.apache.webbeans.proxy.JavassistProxyFactory;
-import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.xml.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -95,6 +96,7 @@ public class XMLStereoTypeModel implemen
             annClazz = (Class<? extends Annotation>) clazz;
             Annotation defaultAnn = 
JavassistProxyFactory.createNewAnnotationProxy(annClazz);

+            final AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
             if (clazz.isAnnotationPresent(NormalScope.class) || 
clazz.isAnnotationPresent(Scope.class))
             {
                 if (scopeTypeFound)
@@ -105,7 +107,7 @@ public class XMLStereoTypeModel implemen
                 defaultScopeType = defaultAnn;
                 scopeTypeFound = true;
             }                
-            else if (AnnotationUtil.isInterceptorBindingAnnotation(annClazz))
+            else if 
(annotationManager.isInterceptorBindingAnnotation(annClazz))
             {
                 Target target = clazz.getAnnotation(Target.class);
                 ElementType[] type = target.value();
@@ -126,12 +128,12 @@ public class XMLStereoTypeModel implemen
                     throw new WebBeansConfigurationException(errorMessage + 
"@StereoType annotation can not define @Named annotation with value");
                 }
             }
-            else if (AnnotationUtil.isQualifierAnnotation(annClazz))
+            else if (annotationManager.isQualifierAnnotation(annClazz))
             {
                 throw new WebBeansConfigurationException(errorMessage + 
"@StereoType annotation can not define @Qualifier annotation");
             }

-            else if (AnnotationUtil.isStereoTypeAnnotation(annClazz))
+            else if (annotationManager.isStereoTypeAnnotation(annClazz))
             {
                 Target innerStereo = clazz.getAnnotation(Target.class);
                 Class<?> outerStereoClass = 
XMLUtil.getElementJavaType(stereoTypeDecleration);

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
 Thu Jan  6 09:35:31 2011
@@ -32,7 +32,6 @@ import javax.enterprise.util.TypeLiteral

import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.BeanManagerImpl;
-import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.ClassUtil;
import org.apache.webbeans.util.OwbCustomObjectInputStream;
import org.apache.webbeans.util.WebBeansUtil;
@@ -85,8 +84,8 @@ public class EventImpl<T> implements Eve
      */
     private Annotation[] getEventBindings(Annotation... annotations)
     {
-        AnnotationUtil.checkQualifierConditions(annotations);
-        
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(annotations);

+
         Set<Annotation> eventBindings = new HashSet<Annotation>();
        
         for(Annotation ann : this.injectedBindings)

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
 Thu Jan  6 09:35:31 2011
@@ -35,6 +35,7 @@ import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Inject;

+import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
@@ -59,7 +60,7 @@ public final class EventUtil

     public static void checkEventBindings(Set<Annotation> annotations)
     {
-        AnnotationUtil.checkQualifierConditions(annotations);
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(annotations);

     }

     public static void checkEventBindings(Annotation... annotations)
@@ -75,8 +76,8 @@ public final class EventUtil
             }
             ///////////////////////////////////////////////////////

-        }        
-        AnnotationUtil.checkQualifierConditions(annotations);
+        }
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(annotations);

     }

     public static TransactionPhase getObserverMethodTransactionType(Method 
observerMethod)

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
 Thu Jan  6 09:35:31 2011
@@ -527,7 +527,9 @@ public final class NotificationManager
         }
        
         //Looking for qualifiers
-        Annotation[] observerQualifiers = 
AnnotationUtil.getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(annotatedMethod,
 Observes.class);
+        Annotation[] observerQualifiers =
+            
WebBeansContext.getInstance().getAnnotationManager().getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(

+                annotatedMethod, Observes.class);
        
         //Getting observer event type
         Type type = 
AnnotationUtil.getAnnotatedMethodFirstParameterWithAnnotation(annotatedMethod, 
Observes.class);

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
 Thu Jan  6 09:35:31 2011
@@ -41,6 +41,7 @@ import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.ObserverMethod;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.annotation.DefaultLiteral;
import org.apache.webbeans.component.AbstractOwbBean;
import org.apache.webbeans.component.AbstractInjectionTargetBean;
@@ -130,9 +131,11 @@ public class ObserverMethodImpl<T> imple
         this.bean = bean;
         this.observerMethod = observerMethod;
         this.ifExist = ifExist;
-        
-        Annotation[] qualifiers = 
AnnotationUtil.getMethodFirstParameterQualifierWithGivenAnnotation(observerMethod,
 Observes.class);
-        AnnotationUtil.checkQualifierConditions(qualifiers);
+
+        Annotation[] qualifiers =
+            
WebBeansContext.getInstance().getAnnotationManager().getMethodFirstParameterQualifierWithGivenAnnotation(

+                observerMethod, Observes.class);
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);

         this.observedQualifiers = new HashSet<Annotation>(qualifiers.length);
        
         for (Annotation qualifier : qualifiers)
@@ -314,7 +317,9 @@ public class ObserverMethodImpl<T> imple
     @SuppressWarnings("unchecked")
     protected List<ObserverParams> getMethodArguments(Object event)
     {
-        AnnotatedElementFactory annotatedElementFactory = 
WebBeansContext.getInstance().getAnnotatedElementFactory();
+        WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        AnnotatedElementFactory annotatedElementFactory = 
webBeansContext.getAnnotatedElementFactory();
+        AnnotationManager annotationManager = 
webBeansContext.getAnnotationManager();

         //Define annotated parameter
         AnnotatedType<T> annotatedType = (AnnotatedType<T>) 
annotatedElementFactory.newAnnotatedType(this.bean.getReturnType());
@@ -324,7 +329,7 @@ public class ObserverMethodImpl<T> imple
         Annotation[][] annots = this.observerMethod.getParameterAnnotations();
         List<ObserverParams> list = new ArrayList<ObserverParams>();

-        BeanManagerImpl manager = 
WebBeansContext.getInstance().getBeanManagerImpl();
+        BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
         ObserverParams param = null;
         if (types.length > 0)
         {
@@ -358,7 +363,7 @@ public class ObserverMethodImpl<T> imple
                 if (!observesAnnotation)
                 {
                     //Get parameter annotations
-                    Annotation[] bindingTypes = 
AnnotationUtil.getQualifierAnnotations(annot);
+                    Annotation[] bindingTypes = 
annotationManager.getQualifierAnnotations(annot);
                    
                     //Annotated parameter
                     AnnotatedParameter<T> annotatedParameter = 
annotatedMethod.getParameters().get(i);
@@ -403,7 +408,9 @@ public class ObserverMethodImpl<T> imple
      */
     protected List<ObserverParams> getAnnotatedMethodArguments(Object event)
     {
-        BeanManagerImpl manager = 
WebBeansContext.getInstance().getBeanManagerImpl();
+        final WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        final AnnotationManager annotationManager = 
webBeansContext.getAnnotationManager();
+        final BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
         List<ObserverParams> list = new ArrayList<ObserverParams>();
         List<AnnotatedParameter<T>> parameters = 
this.annotatedMethod.getParameters();
         ObserverParams param = null;
@@ -418,7 +425,8 @@ public class ObserverMethodImpl<T> imple
             else
             {
                 //Get parameter annotations
-                Annotation[] bindingTypes = 
AnnotationUtil.getQualifierAnnotations(AnnotationUtil.
+                Annotation[] bindingTypes =
+                    annotationManager.getQualifierAnnotations(AnnotationUtil.
                         getAnnotationsFromSet(parameter.getAnnotations()));

                 InjectionPoint point = 
InjectionPointFactory.getPartialInjectionPoint(this.bean, 
parameter.getBaseType(), 


Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
 Thu Jan  6 09:35:31 2011
@@ -35,10 +35,13 @@ public class AlternativesManager
     private final Set<Class<?>> alternatives = new HashSet<Class<?>>();
    
     private final Set<Class<? extends Annotation>> stereoAlternatives = new 
HashSet<Class<? extends Annotation>>();
-    
-    public AlternativesManager()
+
+    private final WebBeansContext webBeansContext;
+
+    public AlternativesManager(WebBeansContext webBeansContext)
     {
-        
+
+        this.webBeansContext = webBeansContext;
     }

     @Deprecated
@@ -54,7 +57,7 @@ public class AlternativesManager
         {
             Class<? extends Annotation> stereo = (Class<? extends 
Annotation>)alternative;
             boolean ok = false;
-            if(AnnotationUtil.isStereoTypeAnnotation(stereo))
+            
if(webBeansContext.getAnnotationManager().isStereoTypeAnnotation(stereo))
             {
                 if(AnnotationUtil.hasClassAnnotation(stereo, 
Alternative.class))
                 {

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
 Thu Jan  6 09:35:31 2011
@@ -38,6 +38,7 @@ import javax.enterprise.inject.spi.Injec
import javax.inject.Inject;
import javax.inject.Provider;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.component.EventBean;
import org.apache.webbeans.component.InjectionPointBean;
import org.apache.webbeans.component.InjectionTargetWrapper;
@@ -333,6 +334,7 @@ public final class OWBInjector implement
     public static void checkInjectionPointForInjectInjectionPoint(Class<?> 
clazz)
     {
         Asserts.nullCheckForClass(clazz);
+        AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
         Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(clazz);
         for(Field field : fields)
         {
@@ -340,7 +342,8 @@ public final class OWBInjector implement
             {
                 if(field.getType() == InjectionPoint.class)
                 {
-                    Annotation[] anns = 
AnnotationUtil.getQualifierAnnotations(field.getDeclaredAnnotations());
+                    Annotation[] anns = 
annotationManager.getQualifierAnnotations(
+                        field.getDeclaredAnnotations());
                     if (AnnotationUtil.hasAnnotation(anns, Default.class))
                     {
                         throw new WebBeansConfigurationException("Java EE 
Component class :  " + clazz + " can not inject InjectionPoint");

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
 Thu Jan  6 09:35:31 2011
@@ -156,7 +156,8 @@ public class InjectionPointFactory
     {
         InjectionPointImpl injectionPoint = null;

-        Annotation[] qualifierAnnots = 
AnnotationUtil.getQualifierAnnotations(annots);
+        Annotation[] qualifierAnnots =
+            
WebBeansContext.getInstance().getAnnotationManager().getQualifierAnnotations(annots);

        
         //@Named update for injection fields!
         if(member instanceof Field)

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
 Thu Jan  6 09:35:31 2011
@@ -35,7 +35,6 @@ import javax.enterprise.util.TypeLiteral
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.InjectionResolver;
import org.apache.webbeans.container.ResolutionUtil;
-import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.ClassUtil;
import org.apache.webbeans.util.OwbCustomObjectInputStream;
import org.apache.webbeans.util.WebBeansUtil;
@@ -160,7 +159,7 @@ class InstanceImpl<T> implements Instanc
      */
     private Annotation[] getAdditionalQualifiers(Annotation[] qualifiers)
     {
-        AnnotationUtil.checkQualifierConditions(qualifiers);
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);

         Set<Annotation> newQualifiers = new 
HashSet<Annotation>(this.qualifierAnnotations);

         if (qualifiers != null && qualifiers.length > 0)
@@ -188,8 +187,8 @@ class InstanceImpl<T> implements Instanc
     @Override
     public <U extends T> Instance<U> select(Class<U> subtype, Annotation... 
qualifiers)
     {
-        AnnotationUtil.checkQualifierConditions(qualifiers);
-        
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);

+
         Type sub = subtype;
        
         if(sub == null)

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
 Thu Jan  6 09:35:31 2011
@@ -42,6 +42,7 @@ import javax.interceptor.ExcludeClassInt
import javax.interceptor.Interceptors;
import javax.interceptor.InvocationContext;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.component.InjectionTargetBean;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.context.creational.CreationalContextImpl;
@@ -309,7 +310,7 @@ public final class InterceptorUtil
         }
        
         Annotation[] anns = annotatedType.getAnnotations().toArray(new 
Annotation[0]);
-        if (!AnnotationUtil.hasInterceptorBindingMetaAnnotation(anns))
+        if 
(!WebBeansContext.getInstance().getAnnotationManager().hasInterceptorBindingMetaAnnotation(anns))

         {
             throw new WebBeansConfigurationException("Interceptor class : " + 
annotatedType.getJavaClass().getName()
                                                      + " must have at least one 
@InterceptorBinding annotation");
@@ -333,8 +334,9 @@ public final class InterceptorUtil
                                                          + method.getName());
             }
         }
-        
-        if 
(!AnnotationUtil.hasInterceptorBindingMetaAnnotation(clazz.getDeclaredAnnotations()))

+
+        if 
(!WebBeansContext.getInstance().getAnnotationManager().hasInterceptorBindingMetaAnnotation(

+            clazz.getDeclaredAnnotations()))
         {
             throw new WebBeansConfigurationException("WebBeans Interceptor 
class : " + clazz.getName()
                                                      + " must have at least one 
@InterceptorBinding annotation");
@@ -350,7 +352,8 @@ public final class InterceptorUtil

         if (isLifecycleMethodInterceptor(clazz) && 
!isBusinessMethodInterceptor(clazz))
         {
-            Annotation[] anns = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);
+            Annotation[] anns =
+                
WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(annots);


             for (Annotation annotation : anns)
             {
@@ -370,7 +373,8 @@ public final class InterceptorUtil
     {
         if (isLifecycleMethodInterceptor(annotatedType) && 
!isBusinessMethodInterceptor(annotatedType))
         {
-            Annotation[] anns = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);
+            Annotation[] anns =
+                
WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(annots);


             for (Annotation annotation : anns)
             {
@@ -393,16 +397,17 @@ public final class InterceptorUtil
         Annotation[] anns = clazz.getDeclaredAnnotations();

         boolean hasClassInterceptors = false;
-        if (AnnotationUtil.getInterceptorBindingMetaAnnotations(anns).length > 
0)
+        AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
+        if (annotationManager.getInterceptorBindingMetaAnnotations(anns).length 
> 0)
         {
             hasClassInterceptors = true;
         }
         else
         {
-            Annotation[] stereoTypes = 
AnnotationUtil.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
+            Annotation[] stereoTypes = 
annotationManager.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
             for (Annotation stero : stereoTypes)
             {
-                if 
(AnnotationUtil.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))

+                if 
(annotationManager.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))

                 {
                     hasClassInterceptors = true;
                     break;
@@ -431,7 +436,8 @@ public final class InterceptorUtil
                 }
                 else
                 {
-                    if 
(AnnotationUtil.hasInterceptorBindingMetaAnnotation(method.getDeclaredAnnotations()))

+                    if (annotationManager.hasInterceptorBindingMetaAnnotation(
+                        method.getDeclaredAnnotations()))
                     {
                         throw new WebBeansConfigurationException("Method : " + 
method.getName() + "in simple web bean class : "
                                                                  + 
clazz.getName()

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
 Thu Jan  6 09:35:31 2011
@@ -18,6 +18,7 @@
  */
package org.apache.webbeans.intercept;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.component.AbstractInjectionTargetBean;
import org.apache.webbeans.component.AbstractOwbBean;
import org.apache.webbeans.config.OWBLogConst;
@@ -162,9 +163,10 @@ public final class WebBeansInterceptorCo
         {
             typeAnns = clazz.getDeclaredAnnotations();
         }
-        if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(typeAnns))
+        AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
+        if (annotationManager.hasInterceptorBindingMetaAnnotation(typeAnns))
         {
-            anns = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(typeAnns);
+            anns = 
annotationManager.getInterceptorBindingMetaAnnotations(typeAnns);

             for (Annotation ann : anns)
             {
@@ -174,12 +176,14 @@ public final class WebBeansInterceptorCo

         // check for stereotypes _explicitly_ declared on the bean class (not
         // inherited)
-        Annotation[] stereoTypes = 
AnnotationUtil.getStereotypeMetaAnnotations(typeAnns);
+        Annotation[] stereoTypes =
+            annotationManager.getStereotypeMetaAnnotations(typeAnns);
         for (Annotation stero : stereoTypes)
         {
-            if 
(AnnotationUtil.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))

+            if 
(annotationManager.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))

             {
-                Annotation[] steroInterceptorBindings = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());

+                Annotation[] steroInterceptorBindings = 
annotationManager.getInterceptorBindingMetaAnnotations(
+                        stero.annotationType().getDeclaredAnnotations());

                 for (Annotation ann : steroInterceptorBindings)
                 {
@@ -200,7 +204,7 @@ public final class WebBeansInterceptorCo
             {
                 Annotation[] inheritedAnns = new 
Annotation[inheritedBindingTypes.size()];
                 inheritedAnns = inheritedBindingTypes.toArray(inheritedAnns);
-                anns = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(inheritedAnns);
+                anns = 
annotationManager.getInterceptorBindingMetaAnnotations(inheritedAnns);
                 bindingTypeSet.addAll(Arrays.asList(anns));
             }

@@ -214,13 +218,14 @@ public final class WebBeansInterceptorCo
                 // of stereotypes we've found
                 Annotation[] inherited = new 
Annotation[inheritedStereotypes.size()];
                 inherited = inheritedStereotypes.toArray(inherited);
-                Annotation[] transitiveStereotypes = 
AnnotationUtil.getStereotypeMetaAnnotations(inherited);
+                Annotation[] transitiveStereotypes = 
annotationManager.getStereotypeMetaAnnotations(inherited);

                 for (Annotation stereo : transitiveStereotypes)
                 {
-                    if 
(AnnotationUtil.hasInterceptorBindingMetaAnnotation(stereo.annotationType().getDeclaredAnnotations()))

+                    if 
(annotationManager.hasInterceptorBindingMetaAnnotation(stereo.annotationType().getDeclaredAnnotations()))

                     {
-                        Annotation[] steroInterceptorBindings = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(stereo.annotationType().getDeclaredAnnotations());

+                        Annotation[] steroInterceptorBindings =
+                            
annotationManager.getInterceptorBindingMetaAnnotations(stereo.annotationType().getDeclaredAnnotations());

                         for (Annotation ann : steroInterceptorBindings)
                         {
                             bindingTypeSet.add(ann);
@@ -354,6 +359,8 @@ public final class WebBeansInterceptorCo
     private static void addMethodInterceptors(Class<?> clazz, 
List<InterceptorData> stack, Set<Interceptor<?>> componentInterceptors,
                                               Set<Annotation> 
resolvedComponentInterceptorBindings)
     {
+        AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
+
         // All methods, not just those declared
         Method[] methods = clazz.getMethods();
         Set<Method> set = new HashSet<Method>();
@@ -375,9 +382,12 @@ public final class WebBeansInterceptorCo
         for (Method method : methods)
         {
             Set<Annotation> interceptorAnns = new HashSet<Annotation>();
-            if 
(AnnotationUtil.hasInterceptorBindingMetaAnnotation(method.getDeclaredAnnotations()))

+            if (annotationManager.hasInterceptorBindingMetaAnnotation(
+                method.getDeclaredAnnotations()))
             {
-                Annotation[] anns = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(method.getAnnotations());
+                Annotation[] anns =
+                    annotationManager.getInterceptorBindingMetaAnnotations(
+                        method.getAnnotations());
                 for (Annotation ann : anns)
                 {
                     interceptorAnns.add(ann);
@@ -428,6 +438,7 @@ public final class WebBeansInterceptorCo
     private static <T> void addMethodInterceptors(AnnotatedType<T> 
annotatedType, List<InterceptorData> stack, Set<Interceptor<?>> 
componentInterceptors)
     {

+        AnnotationManager annotationManager = 
WebBeansContext.getInstance().getAnnotationManager();
         Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
         for(AnnotatedMethod<? super T> methodA : methods)
         {
@@ -436,10 +447,14 @@ public final class WebBeansInterceptorCo
             Set<Annotation> interceptorAnns = new HashSet<Annotation>();
            
             Annotation[] methodAnns = 
AnnotationUtil.getAnnotationsFromSet(methodB.getAnnotations());
-            if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(methodAnns))
-            {                
-                Annotation[] anns = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(methodAnns);
-                Annotation[] annsClazz = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));

+            if 
(annotationManager.hasInterceptorBindingMetaAnnotation(methodAnns))
+            {
+                Annotation[] anns =
+                    annotationManager.getInterceptorBindingMetaAnnotations(
+                        methodAnns);
+                Annotation[] annsClazz =
+                    annotationManager.getInterceptorBindingMetaAnnotations(
+                        
AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));

                 for (Annotation ann : anns)
                 {
@@ -452,12 +467,17 @@ public final class WebBeansInterceptorCo
                 }
             }

-            Annotation[] stereoTypes = 
AnnotationUtil.getStereotypeMetaAnnotations(AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));

+            Annotation[] stereoTypes =
+                annotationManager.getStereotypeMetaAnnotations(
+                    
AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));
             for (Annotation stero : stereoTypes)
             {
-                if 
(AnnotationUtil.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))

+                if (annotationManager.hasInterceptorBindingMetaAnnotation(
+                    stero.annotationType().getDeclaredAnnotations()))
                 {
-                    Annotation[] steroInterceptorBindings = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());

+                    Annotation[] steroInterceptorBindings =
+                        annotationManager.getInterceptorBindingMetaAnnotations(
+                            stero.annotationType().getDeclaredAnnotations());

                     for (Annotation ann : steroInterceptorBindings)
                     {

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
 Thu Jan  6 09:35:31 2011
@@ -18,6 +18,7 @@
  */
package org.apache.webbeans.intercept.webbeans;

+import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.component.AbstractInjectionTargetBean;
import org.apache.webbeans.component.AbstractOwbBean;
import org.apache.webbeans.component.ManagedBean;
@@ -187,6 +188,8 @@ public class WebBeansInterceptor<T> exte

         Set<Annotation> keys = getInterceptorBindings();

+        AnnotationManager annotationManager = 
webBeansContext.getAnnotationManager();
+
         for (Annotation key : keys)
         {
             Class<? extends Annotation> clazzAnnot = key.annotationType();
@@ -200,9 +203,9 @@ public class WebBeansInterceptor<T> exte
                 anns = declared.toArray(anns);
             }

-            else if 
(AnnotationUtil.hasInterceptorBindingMetaAnnotation(clazzAnnot.getDeclaredAnnotations()))

+            else if 
(annotationManager.hasInterceptorBindingMetaAnnotation(clazzAnnot.getDeclaredAnnotations()))

             {
-                anns = 
AnnotationUtil.getInterceptorBindingMetaAnnotations(clazzAnnot.getDeclaredAnnotations());

+                anns = 
annotationManager.getInterceptorBindingMetaAnnotations(clazzAnnot.getDeclaredAnnotations());

             }

             /*

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

URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=1055805&r1=1055804&r2=1055805&view=diff

==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
 Thu Jan  6 09:35:31 2011
@@ -18,20 +18,14 @@
  */
package org.apache.webbeans.util;

-import org.apache.webbeans.annotation.DefaultLiteral;
import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansException;
-import org.apache.webbeans.xml.XMLAnnotationTypeManager;

import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Stereotype;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.util.Nonbinding;
-import javax.inject.Qualifier;
-import javax.interceptor.InterceptorBinding;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -41,7 +35,6 @@ import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;

@@ -319,36 +312,13 @@ public final class AnnotationUtil
        
         return null;
     }
-    
+
+    @Deprecated
     public static <X> Annotation[] 
getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(AnnotatedMethod<X> 
annotatedMethod, Class<? extends Annotation> clazz)
     {
-        Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can 
not be null");
-        Asserts.nullCheckForClass(clazz);
-        
-        List<Annotation> list = new ArrayList<Annotation>();
-        List<AnnotatedParameter<X>> parameters = 
annotatedMethod.getParameters();
-        for(AnnotatedParameter<X> parameter : parameters)
-        {
-            if(parameter.isAnnotationPresent(clazz))
-            {
-                Annotation[] anns = 
getAnnotationsFromSet(parameter.getAnnotations());
-                for(Annotation ann : anns)
-                {
-                    if(isQualifierAnnotation(ann.annotationType()))
-                    {
-                        list.add(ann);
-                    }
-                }
-            }
-        }
-        
-        Annotation[] finalAnns = new Annotation[list.size()];
-        finalAnns = list.toArray(finalAnns);
-        
-        return finalAnns;
+        return 
WebBeansContext.getInstance().getAnnotationManager().getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(annotatedMethod,
 clazz);
     }
    
-
     public static Class<?> 
getMethodFirstParameterTypeClazzWithAnnotation(Method method, Class<? extends 
Annotation> clazz)
     {
         Type type = getMethodFirstParameterWithAnnotation(method, clazz);
@@ -362,52 +332,18 @@ public final class AnnotationUtil
             return (Class<?>) type;
         }
     }
-        
-    
+
     /**
      * Gets the method first found parameter qualifiers.
-     * 
+     *
      * @param method method
      * @param clazz checking annotation
      * @return annotation array
      */
+    @Deprecated
     public static Annotation[] 
getMethodFirstParameterQualifierWithGivenAnnotation(Method method, Class<? 
extends Annotation> clazz)
     {
-        Asserts.assertNotNull(method, "Method argument can not be null");
-        Asserts.nullCheckForClass(clazz);
-
-        Annotation[][] parameterAnns = method.getParameterAnnotations();
-        List<Annotation> list = new ArrayList<Annotation>();
-        Annotation[] result;
-
-        for (Annotation[] parameters : parameterAnns)
-        {
-            boolean found = false;
-            for (Annotation param : parameters)
-            {
-                Class<? extends Annotation> btype = param.annotationType();
-                if (btype.equals(clazz))
-                {
-                    found = true;
-                    continue;
-                }
-
-                if (AnnotationUtil.isQualifierAnnotation(btype))
-                {
-                    list.add(param);
-                }
-
-            }
-
-            if (found)
-            {
-                result = new Annotation[list.size()];
-                result = list.toArray(result);
-                return result;
-            }
-        }
-        result = new Annotation[0];
-        return result;
+        return 
WebBeansContext.getInstance().getAnnotationManager().getMethodFirstParameterQualifierWithGivenAnnotation(method,
 clazz);
     }

     /**
@@ -753,38 +689,16 @@ public final class AnnotationUtil
         return Collections.emptyList();
     }

-
     /**
      * Gets the array of qualifier annotations on the given array.
-     * 
+     *
      * @param annotations annotation array
      * @return array containing qualifier anns
      */
+    @Deprecated
     public static Annotation[] getQualifierAnnotations(Annotation... 
annotations)
     {
-        Asserts.assertNotNull(annotations, "Annotations argument can not be 
null");
-
-        Set<Annotation> set = new HashSet<Annotation>();
-
-        for (Annotation annot : annotations)
-        {
-            if (AnnotationUtil.isQualifierAnnotation(annot.annotationType()))
-            {
-                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);
-
-        return a;
+        return 
WebBeansContext.getInstance().getAnnotationManager().getQualifierAnnotations(annotations);

     }


@@ -973,17 +887,10 @@ public final class AnnotationUtil
         return fields;
     }

+    @Deprecated
     public static void checkQualifierConditions(Annotation... qualifierAnnots)
     {
-        Set<Annotation> annSet = ArrayUtil.asSet(qualifierAnnots);
-
-        //check for duplicate annotations
-        if (qualifierAnnots.length != annSet.size())
-        {
-            throw new IllegalArgumentException("Qualifier annotations can not 
contain duplicate qualifiers:" + qualifierAnnots);
-        }
-
-        checkQualifierConditions(annSet);
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifierAnnots);

     }

     /**
@@ -991,67 +898,26 @@ public final class AnnotationUtil
      * So this must have been done before!
      * @param qualifierAnnots
      */
+    @Deprecated
     public static void checkQualifierConditions(Set<Annotation> 
qualifierAnnots)
     {
-        for (Annotation ann : qualifierAnnots)
-        {
-            checkQualifierConditions(ann);
-        }
-    }
-
-    private static void checkQualifierConditions(Annotation ann)
-    {
-        Method[] methods = 
SecurityUtil.doPrivilegedGetDeclaredMethods(ann.annotationType());
-
-        for (Method method : methods)
-        {
-            Class<?> clazz = method.getReturnType();
-            if (clazz.isArray() || clazz.isAnnotation())
-            {
-                if 
(!AnnotationUtil.hasAnnotation(method.getDeclaredAnnotations(), 
Nonbinding.class))
-                {
-                    throw new WebBeansConfigurationException("@Qualifier : " + 
ann.annotationType().getName()
-                                                             + " must have 
@NonBinding valued members for its array-valued and annotation valued members");
-                }
-            }
-        }
-        
-        
-        if (!AnnotationUtil.isQualifierAnnotation(ann.annotationType()))
-        {
-            throw new IllegalArgumentException("Qualifier annotations must be 
annotated with @Qualifier");
-        }
+        
WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifierAnnots);

     }

     /**
      * Returns true if the annotation is defined in xml or annotated with
      * {@link javax.inject.Qualifier} false otherwise.
-     * 
+     *
      * @param clazz type of the annotation
      * @return true if the annotation is defined in xml or annotated with
      *         {@link javax.inject.Qualifier} false otherwise
      */
+    @Deprecated
     public static boolean isQualifierAnnotation(Class<? extends Annotation> 
clazz)
     {
-        Asserts.nullCheckForClass(clazz);
-        XMLAnnotationTypeManager manager = 
WebBeansContext.getInstance().getxMLAnnotationTypeManager();
-        if (manager.hasBindingType(clazz))
-        {
-            return true;
-        }
-        else if (clazz.isAnnotationPresent(Qualifier.class))
-        {
-            return true;
-        }
-        else 
if(WebBeansContext.getInstance().getBeanManagerImpl().getAdditionalQualifiers().contains(clazz))

-        {
-            return true;
-        }
-
-        return false;
+        return 
WebBeansContext.getInstance().getAnnotationManager().isQualifierAnnotation(clazz);

     }
-    
-    
+
     /**
      * Returns true if any binding exist
      * 
@@ -1090,57 +956,33 @@ public final class AnnotationUtil
        
         return null;        
     }
-    

     /**
      * Returns true if the annotation is defined in xml or annotated with
      * {@link javax.interceptor.InterceptorBinding} false otherwise.
-     * 
+     *
      * @param clazz type of the annotation
      * @return true if the annotation is defined in xml or annotated with
      *         {@link javax.interceptor.InterceptorBinding} false otherwise
      */
+    @Deprecated
     public static boolean isInterceptorBindingAnnotation(Class<? extends 
Annotation> clazz)
     {
-        Asserts.nullCheckForClass(clazz);
-        XMLAnnotationTypeManager manager = 
WebBeansContext.getInstance().getxMLAnnotationTypeManager();
-        if (manager.hasInterceptorBindingType(clazz))
-        {
-            return true;
-        }
-        else if (clazz.isAnnotationPresent(InterceptorBinding.class))
-        {
-            return true;
-        }
-
-        return false;
+        return 
WebBeansContext.getInstance().getAnnotationManager().isInterceptorBindingAnnotation(clazz);

     }

     /**
      * If any Annotations in the input is an interceptor binding annotation 
type then return
      * true, false otherwise.
-     * 
-     * @param anns array of Annotations to check 
+     *
+     * @param anns array of Annotations to check
      * @return true if one or moe of the input annotations are an interceptor 
binding annotation
      *         type false otherwise
      */
+    @Deprecated
     public static boolean hasInterceptorBindingMetaAnnotation(Annotation[] 
anns)
     {
-        Asserts.assertNotNull(anns, "anns parameter can not be null");
-
-        for (Annotation ann : anns)
-        {
-            if (isInterceptorBindingAnnotation(ann.annotationType()))
-            {
-                return true;
-            }
-            else
-            {
-                continue;
-            }
-        }
-
-        return false;
+        return 
WebBeansContext.getInstance().getAnnotationManager().hasInterceptorBindingMetaAnnotation(anns);

     }

     /**
@@ -1149,156 +991,56 @@ public final class AnnotationUtil
      * @param anns An array of annotations
      * @return an array of interceptor binding annotations, including the input 
and any transitively declared annotations
      */
+    @Deprecated
     public static Annotation[] 
getInterceptorBindingMetaAnnotations(Annotation[] anns)
     {
-        Asserts.assertNotNull(anns, "anns parameter can not be null");
-        List<Annotation> interAnns = new ArrayList<Annotation>();
-
-        for (Annotation ann : anns)
-        {
-            if (isInterceptorBindingAnnotation(ann.annotationType()))
-            {
-                interAnns.add(ann);
-                
-                //check for transitive
-                Annotation[] transitives = 
getTransitiveInterceptorBindings(ann.annotationType().getDeclaredAnnotations());
-                
-                for(Annotation transitive : transitives)
-                {
-                    interAnns.add(transitive);
-                }
-                
-            }
-        }
-
-        Annotation[] ret = new Annotation[interAnns.size()];
-        ret = interAnns.toArray(ret);
-
-        return ret;
-    }
-    
-    private static Annotation[] getTransitiveInterceptorBindings(Annotation[] 
anns)
-    {
-        return getInterceptorBindingMetaAnnotations(anns);
+        return 
WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(anns);

     }
- 
-    public static Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
-    {
-        Asserts.assertNotNull(anns, "anns parameter can not be null");
-        List<Annotation> interAnns = new ArrayList<Annotation>();
-
-        for (Annotation ann : anns)
-        {
-            if (isStereoTypeAnnotation(ann.annotationType()))
-            {
-                interAnns.add(ann);
-                
-                //check for transitive
-                Annotation[] transitives = 
getTransitiveStereoTypes(ann.annotationType().getDeclaredAnnotations());
-                
-                for(Annotation transitive : transitives)
-                {
-                    interAnns.add(transitive);
-                }                
-            }
-        }

-        Annotation[] ret = new Annotation[interAnns.size()];
-        ret = interAnns.toArray(ret);
-
-        return ret;
-    }
-    
-    private static Annotation[] getTransitiveStereoTypes(Annotation[] anns)
+    @Deprecated
+    public static Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
     {
-        return getStereotypeMetaAnnotations(anns);
+        return 
WebBeansContext.getInstance().getAnnotationManager().getStereotypeMetaAnnotations(anns);

     }
-    

+    @Deprecated
     public static boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
     {
-        Asserts.assertNotNull(anns, "anns parameter can not be null");
-
-        for (Annotation ann : anns)
-        {
-            if (isStereoTypeAnnotation(ann.annotationType()))
-            {
-                return true;
-            }
-            else
-            {
-                continue;
-            }
-        }
-
-        return false;
+        return 
WebBeansContext.getInstance().getAnnotationManager().hasStereoTypeMetaAnnotation(anns);

     }

     /**
      * Returns true if the annotation is defined in xml or annotated with
-     * {@link Stereotype} false otherwise.
-     * 
+     * {@link javax.enterprise.inject.Stereotype} false otherwise.
+     *
      * @param clazz type of the annotation
      * @return true if the annotation is defined in xml or annotated with
-     *         {@link Stereotype} false otherwise
+     *         {@link javax.enterprise.inject.Stereotype} false otherwise
      */
+    @Deprecated
     public static boolean isStereoTypeAnnotation(Class<? extends Annotation> 
clazz)
     {
-        Asserts.nullCheckForClass(clazz);
-        XMLAnnotationTypeManager manager = 
WebBeansContext.getInstance().getxMLAnnotationTypeManager();
-        if (manager.hasStereoType(clazz))
-        {
-            return true;
-        }
-        else if (clazz.isAnnotationPresent(Stereotype.class))
-        {
-            return true;
-        }
-
-        return false;
+        return 
WebBeansContext.getInstance().getAnnotationManager().isStereoTypeAnnotation(clazz);

     }
-    
+
     /**
-     * If the bean extends generic class via {@link Realizes}
+     * If the bean extends generic class via Realizes
      * annotation, realized based producer methods, fields and observer
      * methods qualifier is
-     * 
+     *
      * <ul>
      *  <li>Qualifiers on the definitions</li>
      *  <li>Plus class qualifiers</li>
      *  <li>Minus generic class qualifiers</li>
      * </ul>
-     * 
+     *
      * @param clazz realized definition class
      * @param anns binding annotations array
      */
+    @Deprecated
     public static Annotation[] getRealizesGenericAnnotations(Class<?> clazz, 
Annotation[] anns)
     {
-       Set<Annotation> setAnnots = new HashSet<Annotation>();
-        
-        for(Annotation definedAnn : anns)
-        {
-            setAnnots.add(definedAnn);
-        }
-        
-        Annotation[] genericReliazesAnns = 
AnnotationUtil.getQualifierAnnotations(clazz.getSuperclass().getDeclaredAnnotations());

-        
-        for(Annotation generic : genericReliazesAnns)
-        {
-            setAnnots.remove(generic);
-        }
-        
-        genericReliazesAnns = 
AnnotationUtil.getQualifierAnnotations(clazz.getDeclaredAnnotations());
-
-        for(Annotation generic : genericReliazesAnns)
-        {
-            setAnnots.add(generic);
-        }            
-        
-        Annotation[] annots = new Annotation[setAnnots.size()];
-        annots = setAnnots.toArray(annots);
-        
-        return annots;
+        return 
WebBeansContext.getInstance().getAnnotationManager().getRealizesGenericAnnotations(clazz,
 anns);
     }

     public static Annotation[] getAnnotationsFromSet(Set<Annotation> set)