[webbeans-commits] Webbeans SVN: r793 - in ri/trunk: webbeans-ri and 15 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Jan 6 17:43:57 EST 2009


Author: nickarls
Date: 2009-01-06 17:43:56 -0500 (Tue, 06 Jan 2009)
New Revision: 793

Added:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/binding/NewBinding.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/LoopingProducer.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/ScopeTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/invalid/
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/Sample.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/WrappedBean.java
Removed:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java
Modified:
   ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Bean.java
   ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Manager.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
   ri/trunk/webbeans-ri/testng.xml
Log:
Preliminary support for @New Simple Bean case
removal of toDetailedString():s
Manager.resolveDecorators param Class<?> -> Type
WS, cleanups

Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Bean.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Bean.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Bean.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -21,6 +21,8 @@
 import java.lang.reflect.Type;
 import java.util.Set;
 
+import javax.webbeans.InjectionPoint;
+
 /**
  * The contract between the Web Bean manager and a Web Bean. This interface
  * should not be called directly by the application.
@@ -31,7 +33,6 @@
  */
 public abstract class Bean<T> implements Contextual<T>
 {
-
    private final Manager manager;
 
    protected Bean(Manager manager)
@@ -62,4 +63,6 @@
 
    public abstract boolean isNullable();
 
+//   public abstract Set<InjectionPoint> getInjectionPoints();
+
 }

Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Manager.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Manager.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Manager.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -19,6 +19,7 @@
 
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
 import java.util.List;
 import java.util.Set;
 
@@ -81,6 +82,6 @@
 
    public List<Interceptor> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings);
 
-   public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation... bindings);
+   public List<Decorator> resolveDecorators(Set<Type> types, Annotation... bindings);
 
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -60,7 +60,6 @@
 import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
 import org.jboss.webbeans.resources.spi.Naming;
 import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * Implementation of the Web Beans Manager.
@@ -175,7 +174,8 @@
     */
    public <T> Set<AnnotatedMethod<Object>> resolveDisposalMethods(Class<T> apiType, Annotation... bindings)
    {
-      return new HashSet<AnnotatedMethod<Object>>();
+      //TODO Implement disposal methods
+      return Collections.emptySet();
    }
 
    /**
@@ -634,7 +634,7 @@
 
    /**
     * Resolves a list of decorators based on API types and binding types
-    * 
+    * Os
     * @param types The set of API types to match
     * @param bindingTypes The binding types to match
     * @return A list of matching decorators
@@ -642,7 +642,7 @@
     * @see javax.webbeans.manager.Manager#resolveDecorators(java.util.Set,
     *      java.lang.annotation.Annotation[])
     */
-   public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation... bindings)
+   public List<Decorator> resolveDecorators(Set<Type> types, Annotation... bindings)
    {
       return resolver.resolveDecorators(types, bindings);
    }
@@ -696,21 +696,6 @@
       return buffer.toString();
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append(Strings.collectionToString("Enabled deployment types: ", getEnabledDeploymentTypes()));
-      buffer.append(eventManager.toString() + "\n");
-      buffer.append(MetaDataCache.instance().toString() + "\n");
-      buffer.append(resolver.toString() + "\n");
-      buffer.append(contextMap.toString() + "\n");
-      buffer.append(proxyPool.toString() + "\n");
-      buffer.append(Strings.collectionToString("Registered beans: ", getBeans()));
-      buffer.append(Strings.collectionToString("Registered decorators: ", decorators));
-      buffer.append(Strings.collectionToString("Registered interceptors: ", interceptors));
-      return buffer.toString();
-   }
-
    public Manager parse(InputStream xmlStream)
    {
       // TODO Implement XML parsing
@@ -732,30 +717,6 @@
          {
             throw new UnserializableDependencyException(bean + " is not serializable or has unserializable dependencies");
          }
-         // // TODO: Not that pretty. Can this logic be moved to the
-         // isSerializable()
-         // // of SimpleBean and EnterpriseBean or are they too strict there?
-         // if (bean instanceof EnterpriseBean)
-         // {
-         // boolean stateful =
-         // getEjbDescriptorCache().containsKey(((EnterpriseBean<?>)
-         // bean).getType());
-         // if (stateful && !bean.isSerializable())
-         // {
-         // throw new UnserializableDependencyException(bean +
-         // " is not serializable or has unserializable dependencies");
-         // }
-         // }
-         // else if (bean instanceof SimpleBean)
-         // {
-         // boolean passivating =
-         // MetaDataCache.instance().getScopeModel(bean.getScopeType()).isPassivating();
-         // if (passivating && !bean.isSerializable())
-         // {
-         // throw new UnserializableDependencyException(bean +
-         // " is not serializable or has unserializable dependencies");
-         // }
-         // }
       }
    }
 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -18,6 +18,7 @@
 package org.jboss.webbeans;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -360,10 +361,10 @@
     * @param bindingTypes The binding types to match
     * @return The set of matching decorators
     */
-   public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation[] bindingTypes)
+   public List<Decorator> resolveDecorators(Set<Type> types, Annotation[] bindingTypes)
    {
       // TODO Implement decorators
-      return null;
+      return Collections.emptyList();
    }
 
    /**

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -48,7 +48,6 @@
 import org.jboss.webbeans.log.Logging;
 import org.jboss.webbeans.model.MergedStereotypes;
 import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * An abstract bean representation common for all beans
@@ -559,22 +558,4 @@
    {
       return "AbstractBean " + getName();
    }
-
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AbstractBean:\n");
-      buffer.append("Name: " + name + "\n");
-      buffer.append("Type: " + type + "\n");
-      buffer.append("Scope type " + scopeType.toString() + "\n");
-      buffer.append("Deployment type: " + deploymentType.toString() + "\n");
-      buffer.append("Primitive : " + primitive + "\n");
-      buffer.append("Declared bean type: " + (declaredBeanType == null ? "null" : declaredBeanType.toString()) + "\n");
-      buffer.append(Strings.collectionToString("Binding types: ", getBindingTypes()));
-      buffer.append(Strings.collectionToString("API types: ", getTypes()));
-      buffer.append(Strings.collectionToString("Injection points: ", getInjectionPoints()));
-      buffer.append(mergedStereotypes.toString() + "\n");
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -26,7 +26,6 @@
 import javax.webbeans.Dependent;
 import javax.webbeans.Destructor;
 import javax.webbeans.Disposes;
-import javax.webbeans.IllegalProductException;
 import javax.webbeans.Initializer;
 import javax.webbeans.Observes;
 import javax.webbeans.Produces;
@@ -40,9 +39,7 @@
 import org.jboss.webbeans.MetaDataCache;
 import org.jboss.webbeans.introspector.AnnotatedClass;
 import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotatedItem;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember;
 import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
@@ -315,18 +312,6 @@
       return "AbstractClassBean " + getName();
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AbstractClassBean:\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append("Annotated item: " + annotatedItem.toString() + "\n");
-      buffer.append(Strings.collectionToString("Initializer methods: ", getInitializerMethods()));
-      buffer.append(Strings.collectionToString("Injectable fields: ", getInjectableFields()));
-      buffer.append(Strings.collectionToString("Producer methods: ", getProducerMethods()));
-      return buffer.toString();
-   }
-
    @Override
    /*
     * Gets the default deployment type

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -130,7 +130,7 @@
    {
       return new EventBean<T, S>(field, manager);
    }
-   
+
    /**
     * Creates an instance Web Bean
     * 
@@ -143,7 +143,7 @@
    {
       return new InstanceBean<T, S>(field, manager);
    }
- 
+
    /**
     * Creates an observer
     * 
@@ -157,4 +157,9 @@
       return new ObserverImpl<T>(method, declaringBean, manager);
    }
 
+   public static <T> NewSimpleBean<T> createNewSimpleBean(Class<T> type, ManagerImpl manager)
+   {
+      return new NewSimpleBean<T>(type, manager);
+   }
+
 }

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewBean.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewBean.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,62 @@
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.Standard;
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Manager;
+
+import org.jboss.webbeans.binding.NewBinding;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+
+public class NewBean<T> extends ForwardingBean<T>
+{
+   private AbstractClassBean<T> wrappedBean;
+   
+   public NewBean(AbstractClassBean<T> wrappedBean, Manager manager)
+   {
+      super(manager);
+      this.wrappedBean = wrappedBean;
+   }
+
+   @Override
+   protected Bean<T> delegate()
+   {
+      return wrappedBean;
+   }
+
+   @Override
+   public Class<? extends Annotation> getScopeType()
+   {
+      return Dependent.class;
+   }
+
+   @Override
+   public Class<? extends Annotation> getDeploymentType()
+   {
+      return Standard.class;
+   }
+
+   @Override
+   public String getName()
+   {
+      return null;
+   }
+
+   public Set<AnnotatedItem<?, ?>> getInjectionPoints()
+   {
+      return wrappedBean.getInjectionPoints();
+   }
+
+   @Override
+   public Set<Annotation> getBindingTypes()
+   {
+      return new HashSet<Annotation>(Arrays.asList(new NewBinding()));
+   }
+   
+   
+}

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,96 @@
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.Standard;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.MetaDataCache;
+import org.jboss.webbeans.binding.NewBinding;
+import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+
+public class NewSimpleBean<T> extends SimpleBean<T>
+{
+   private static Set<Annotation> NEW_BINDING_SET = new HashSet<Annotation>(Arrays.asList(new NewBinding()));
+
+   public NewSimpleBean(Class<T> type, ManagerImpl manager)
+   {
+      super(type, manager);
+   }
+
+   @Override
+   public T create()
+   {
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         boolean passivating = MetaDataCache.instance().getScopeModel(getScopeType()).isPassivating();
+         if (passivating)
+         {
+            checkProducedInjectionPoints();
+         }
+         T instance = getConstructor().newInstance(manager);
+         bindDecorators();
+         bindInterceptors();
+         injectEjbAndCommonFields();
+         injectBoundFields(instance, manager);
+         callInitializers(instance);
+         callPostConstruct(instance);
+         return instance;
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
+   }
+
+   @Override
+   public Class<? extends Annotation> getScopeType()
+   {
+      return Dependent.class;
+   }
+
+   @Override
+   public Class<? extends Annotation> getDeploymentType()
+   {
+      return Standard.class;
+   }
+
+   @Override
+   public String getName()
+   {
+      return null;
+   }
+
+   @Override
+   public Set<AnnotatedMethod<Object>> getObserverMethods()
+   {
+      return Collections.emptySet();
+   }
+
+   @Override
+   public Set<AnnotatedField<Object>> getProducerFields()
+   {
+      return Collections.emptySet();
+   }
+
+   @Override
+   public Set<AnnotatedMethod<Object>> getProducerMethods()
+   {
+      return Collections.emptySet();
+   }
+
+   @Override
+   public Set<Annotation> getBindingTypes()
+   {
+      return NEW_BINDING_SET;
+   }
+
+}

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -408,17 +408,6 @@
       return buffer.toString();
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("SimpleBean\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append("Constructor: " + constructor.toString() + "\n");
-      buffer.append("Post-construct: " + (postConstruct == null ? "null" : postConstruct.toString()) + "\n");
-      buffer.append("Pre-destroy: " + (preDestroy == null ? "null" : preDestroy.toString()) + "\n");
-      return buffer.toString();
-   }
-
    /**
     * Indicates if the bean is serializable
     * 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -41,8 +41,8 @@
  */
 public class ProxyPool implements Serializable
 {
-   
-   
+   private static final long serialVersionUID = 9029999149357529341L;
+
    /**
     * A container/cache for previously created proxies
     * 

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/binding/NewBinding.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/binding/NewBinding.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/binding/NewBinding.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.binding;
+
+import javax.webbeans.AnnotationLiteral;
+import javax.webbeans.New;
+
+/**
+ * Annotation literal for @Current
+ * 
+ * @author Pete Muir
+ */
+public class NewBinding extends AnnotationLiteral<New> implements New {}

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -57,7 +57,6 @@
 import org.jboss.webbeans.introspector.AnnotatedField;
 import org.jboss.webbeans.introspector.AnnotatedItem;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
 import org.jboss.webbeans.jsf.JSFApiAbstraction;
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -27,7 +27,6 @@
 import javax.webbeans.manager.Context;
 
 import org.jboss.webbeans.util.ConcurrentCache;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * A map from a scope to a list of contexts
@@ -126,11 +125,6 @@
       return "ContextMap holding " + delegate().size() + " contexts: " + delegate().keySet();
    }
 
-   public String toDetailedString()
-   {
-      return Strings.mapToString("ContextMap (scope type -> context list): ", delegate());
-   }
-
    /**
     * Adds a context under a scope type
     * 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -26,7 +26,6 @@
 
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Strings;
 
 import com.google.common.collect.ForwardingMap;
 
@@ -136,9 +135,4 @@
       return "holding " + delegate.size() + " instances";
    }
 
-   public String toDetailedString()
-   {
-      return Strings.mapToString("SimpleBeanMap (bean -> instance): ", delegate);
-   }
-
 }
\ No newline at end of file

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -449,16 +449,6 @@
       return toString;
    }
    
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AbstractAnnotatedItem:\n");
-      buffer.append(Strings.collectionToString("Annotations: ", getAnnotations()));
-      buffer.append(annotationMap == null ? "" : (annotationMap.toString() + "\n"));
-      buffer.append(metaAnnotationMap == null ? "" : (metaAnnotationMap.toString()) + "\n");
-      return buffer.toString();
-   }
-
    /**
     * Gets the binding types of the item
     * 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -173,15 +173,4 @@
       return toString;
    }   
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AbstractAnnotatedMember:\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append("Final: " + isFinal() + "\n");
-      buffer.append("Static: " + isStatic() + "\n");
-      buffer.append("Name: " + getName() + "\n");
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -126,16 +126,4 @@
       return toString;
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AbstractAnnotatedType:\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append("Superclass: " + (superclass == null ? "" : superclass.toString()) + "\n");
-      buffer.append("Name: " + getName() + "\n");
-      buffer.append("Final: " + isFinal() + "\n");
-      buffer.append("Static: " + isStatic() + "\n");
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -185,20 +185,8 @@
       {
          return toString;
       }
-//      toString = "Annotated annotation " + Names.annotation2String(getDelegate());
       return toString;
    }
-   
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AnnotatedConstructorImpl:\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append("Class: " + clazz.toString() + "\n");
-      buffer.append(Strings.collectionToString("Members: ", getMembers()));
-      buffer.append(annotatedMembers == null ? "" : (annotatedMembers.toString() + "\n"));
-      return buffer.toString();
-   }
 
    public Class<T> getDelegate()
    {

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -532,23 +532,5 @@
       toString = "Annotated class " + Names.class2String(getDelegate());
       return toString;
    }
-   
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AnnotatedConstructorImpl:\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
-      buffer.append("Class: " + clazz.toString() + "\n");
-      buffer.append(Strings.collectionToString("Fields: ", getFields()));
-      buffer.append(Strings.collectionToString("Methods: ", methods));
-      buffer.append(Strings.collectionToString("Constructors: ", getConstructors()));
-      buffer.append(annotatedConstructors == null ? "" : (annotatedConstructors.toString() + "\n"));
-      buffer.append(annotatedFields == null ? "" : (annotatedFields.toString() + "\n"));
-      buffer.append(annotatedMethods == null ? "" : (annotatedMethods.toString() + "\n"));
-      buffer.append(constructorsByArgumentMap == null ? "" : (constructorsByArgumentMap.toString() + "\n"));
-      buffer.append(metaAnnotatedFields == null ? "" : (metaAnnotatedFields.toString() + "\n"));
-      return buffer.toString();
-   }
 
 }
\ No newline at end of file

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -22,12 +22,10 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
 import javax.webbeans.ExecutionException;
-import javax.webbeans.IllegalProductException;
 import javax.webbeans.manager.Manager;
 
 import org.jboss.webbeans.ManagerImpl;
@@ -35,8 +33,6 @@
 import org.jboss.webbeans.introspector.AnnotatedParameter;
 import org.jboss.webbeans.introspector.AnnotatedType;
 import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * Represents an annotated constructor
@@ -270,19 +266,4 @@
       return toString;
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AnnotatedConstructorImpl:\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
-      buffer.append("Declaring class:\n");
-      buffer.append(declaringClass.getName() + "[ " + declaringClass.getType() + "]" + "\n");
-      buffer.append("Constructor:\n");
-      buffer.append(constructor.toString() + "\n");
-      buffer.append(Strings.collectionToString("Parameters: ", getParameters()));
-      buffer.append(annotatedParameters.toString() + "\n");
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -20,7 +20,6 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
-import java.util.Arrays;
 
 import javax.webbeans.manager.Manager;
 
@@ -28,7 +27,6 @@
 import org.jboss.webbeans.introspector.AnnotatedType;
 import org.jboss.webbeans.util.Names;
 import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * Represents an annotated field
@@ -178,16 +176,4 @@
       return toString;
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AnnotatedFieldImpl:\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
-      buffer.append("Declaring class:\n");
-      buffer.append(declaringClass.getName() + "[ " + declaringClass.getType() + "]" + "\n");
-      buffer.append("Field: " + field + "\n");
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -34,7 +34,6 @@
 import org.jboss.webbeans.introspector.AnnotatedType;
 import org.jboss.webbeans.util.Names;
 import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * Represents an annotated method
@@ -321,20 +320,4 @@
       return toString;
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AnnotatedMethodImpl:\n");
-      buffer.append(super.toString() + "\n");
-      buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
-      buffer.append(annotatedParameters == null ? "" : (annotatedParameters.toString() + "\n"));
-      buffer.append("Declaring class:\n");
-      buffer.append(declaringClass.getName() + "[ " + declaringClass.getType() + "]" + "\n");
-      buffer.append("Method:\n");
-      buffer.append(method.toString());
-      buffer.append("Property name: " + propertyName + "\n");
-      buffer.append(Strings.collectionToString("Parameters: ", getParameters()));
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -19,14 +19,11 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
-import java.util.Arrays;
 
 import javax.webbeans.BindingType;
 import javax.webbeans.manager.Manager;
 
 import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * Represents a parameter
@@ -160,20 +157,8 @@
       {
          return toString;
       }
-      toString = toDetailedString();
       return toString;
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AnnotatedParameterImpl:\n");
-      buffer.append("Type: " + type.toString() + "\n");
-      buffer.append("Annotations: " + Names.annotations2String(this.getAnnotations().toArray(new Annotation[0])));
-      buffer.append("Final: " + _final + "\n");
-      buffer.append("Static: " + _static + "\n");
-      buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
-      return buffer.toString();
-   }
 
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -123,13 +123,4 @@
      return (isValid() ? "Valid" : "Invalid") + " annotation model for " + getType();
    }
    
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("AnnotationModel:\n");
-      buffer.append("Annotated annotation: " + getAnnotatedAnnotation().toString());
-      buffer.append("Valid: " + isValid());
-      return buffer.toString();
-   }
-   
 }
\ No newline at end of file

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -26,7 +26,6 @@
 
 import org.jboss.webbeans.introspector.AnnotatedMethod;
 import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * 
@@ -39,8 +38,6 @@
 {
    // The non-binding types
    private Set<AnnotatedMethod<?>> nonBindingTypes;
-   // The hash code
-   private Integer hashCode;
 
    /**
     * Constructor
@@ -157,14 +154,4 @@
      return (isValid() ? "Valid" : "Invalid") + " binding type model for " + getType() + " with non-binding types " + getNonBindingTypes();
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("BindingTypeModel:\n");
-      buffer.append(super.toString());
-      buffer.append("Hash code: " + hashCode);
-      buffer.append(Strings.collectionToString("Non-binding types: ", getNonBindingTypes()));
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -23,7 +23,6 @@
 
 import org.jboss.webbeans.MetaDataCache;
 import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
-import org.jboss.webbeans.util.Strings;
 
 /**
  * Meta model for the merged stereotype for a bean
@@ -162,21 +161,4 @@
         ", possible scopes " + possibleScopeTypes + " and supported scopes " + supportedScopes; 
    }
    
-   /**
-    * Gets a string representation of the merged stereotypes
-    * 
-    * @return The string representation
-    */
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("Merged stereotypes:\n");
-      buffer.append("Bean name defaulted: " + beanNameDefaulted + "\n");
-      buffer.append("Possible deployment types: " + getPossibleDeploymentTypes().toString());
-      buffer.append(Strings.collectionToString("Possible scope types: ", getPossibleScopeTypes()));
-      buffer.append(Strings.collectionToString("Required types: ", getRequiredTypes()));
-      buffer.append(Strings.collectionToString("Supported scopes: ", getSupportedScopes()));
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -85,15 +85,4 @@
       return valid + normal + passivating + " scope model for " + getType();
    }
 
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("ScopeModel:\n");
-      buffer.append(super.toString());
-      buffer.append("Normal: " + isNormal());
-      buffer.append("Passivating: " + isPassivating());
-      buffer.append("Meta-annotation: " + getMetaAnnotation().toString());
-      return buffer.toString();
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -30,8 +30,6 @@
 import javax.webbeans.ScopeType;
 import javax.webbeans.Stereotype;
 
-import org.jboss.webbeans.util.Strings;
-
 /**
  * A meta model for a stereotype, allows us to cache a stereotype and to
  * validate it
@@ -245,21 +243,6 @@
    {
      return "Stereotype model with required types " + requiredTypes + " and supported scopes " + supportedScopes; 
    }   
-   
-   public String toDetailedString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("StereotypeModel:\n");
-      buffer.append(super.toString());
-      buffer.append("Bean name defaulted: " + isBeanNameDefaulted());
-      buffer.append("Default deployment type: " + getDefaultDeploymentType());
-      buffer.append("Default scope type: " + getDefaultScopeType());
-      buffer.append("Meta-annotation: " + getMetaAnnotation().toString());
-      buffer.append(Strings.collectionToString("Interceptor bindings: ", getInterceptorBindings()));
-      buffer.append(Strings.collectionToString("Required types: ", getRequiredTypes()));
-      buffer.append(Strings.collectionToString("Supported scopes: ", getSupportedScopes()));
-      return buffer.toString();
-   }
 
    /**
     * Gets the meta-annotation type

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -10,7 +10,7 @@
 public class Proxies
 {
    
-   private static class TypeInfo
+   public static class TypeInfo
    {
       
       private static final Class<?>[] EMPTY_INTERFACES_ARRAY = new Class<?>[0];
@@ -25,7 +25,7 @@
          this.classes = new HashSet<Class<?>>();
       }
       
-      private Class<?> getSuperClass()
+      public Class<?> getSuperClass()
       {
          if (classes.isEmpty())
          {

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -10,6 +10,9 @@
 import javax.webbeans.Production;
 import javax.webbeans.Standard;
 
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.BeanFactory;
 import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
 import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
 import org.jboss.webbeans.test.mock.MockBootstrap;
@@ -31,7 +34,30 @@
       manager = webBeansBootstrap.getManager();
       addStandardDeploymentTypesForTests();
    }
-   
+
+   protected <T> AbstractClassBean<T> registerBean(Class<T> clazz)
+   {
+      AbstractClassBean<T> bean = null;
+      if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
+      {
+         bean = BeanFactory.createEnterpriseBean(clazz, manager);
+      }
+      else
+      {
+         bean = BeanFactory.createSimpleBean(clazz, manager);
+      }
+      CurrentManager.rootManager().addBean(bean);
+      return bean;
+   }
+
+   protected void registerBeans(Class<?>[] classes)
+   {
+      for (Class<?> clazz : classes)
+      {
+         registerBean(clazz);
+      }
+   }
+
    @SuppressWarnings("unchecked")
    protected void addStandardDeploymentTypesForTests()
    {
@@ -42,17 +68,19 @@
    {
       manager.getEjbDescriptorCache().add(new MockEjbDescriptor<T>(clazz));
    }
-   
-   protected byte[] serialize(Object instance) throws IOException {
+
+   protected byte[] serialize(Object instance) throws IOException
+   {
       ByteArrayOutputStream bytes = new ByteArrayOutputStream();
       ObjectOutputStream out = new ObjectOutputStream(bytes);
       out.writeObject(instance);
       return bytes.toByteArray();
    }
-   
-   protected Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
+
+   protected Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+   {
       ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
       return in.readObject();
-   }   
-   
+   }
+
 }

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -1,393 +0,0 @@
-package org.jboss.webbeans.test;
-
-import javax.webbeans.DefinitionException;
-
-import org.testng.annotations.Test;
-
- at SpecVersion("20081222")
-public class NewTest extends AbstractTest
-{
-
-   /**
-    * When the built-in binding type @New is applied to an injection point, a
-    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
-    * 
-    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
-    *            stereotypes, and such that • the implementation class is the
-    *            declared type of the injection point.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanIsDependentScoped()
-   {
-      assert false;
-   }
-
-   /**
-    * When the built-in binding type @New is applied to an injection point, a
-    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
-    * 
-    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
-    *            stereotypes, and such that • the implementation class is the
-    *            declared type of the injection point.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanIsOfStandardDeploymentType()
-   {
-      assert false;
-   }
-
-   /**
-    * When the built-in binding type @New is applied to an injection point, a
-    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
-    * 
-    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
-    *            stereotypes, and such that • the implementation class is the
-    *            declared type of the injection point.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanIsHasOnlyNewBinding()
-   {
-      assert false;
-   }
-
-   /**
-    * When the built-in binding type @New is applied to an injection point, a
-    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
-    * 
-    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
-    *            stereotypes, and such that • the implementation class is the
-    *            declared type of the injection point.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasNoWebBeanName()
-   {
-      assert false;
-   }
-
-   /**
-    * When the built-in binding type @New is applied to an injection point, a
-    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
-    * 
-    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
-    *            stereotypes, and such that • the implementation class is the
-    *            declared type of the injection point.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasNoStereotypes()
-   {
-      assert false;
-   }
-
-   /**
-    * When the built-in binding type @New is applied to an injection point, a
-    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
-    * 
-    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
-    *            stereotypes, and such that • the implementation class is the
-    *            declared type of the injection point.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasImplementationClassOfInjectionPointType()
-   {
-      assert false;
-   }
-
-   /**
-    * If the parameter type satisfies the definition of a simple Web Bean
-    * implementation class, Section 3.2.1, “Which Java classes are simple Web
-    * Beans?”, then the Web Bean is a simple Web Bean. If the parameter type
-    * satisfies the definition of an enterprise Web Bean implementation class,
-    * Section 3.3.2, “Which EJBs are enterprise Web Beans?”, then the Web Bean
-    * is an enterprise Web Bean.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanIsSimpleWebBeanIfParameterTypeIsSimpleWebBean()
-   {
-      // TODO: has to be?
-      assert false;
-   }
-
-   /**
-    * If the parameter type satisfies the definition of a simple Web Bean
-    * implementation class, Section 3.2.1, “Which Java classes are simple Web
-    * Beans?”, then the Web Bean is a simple Web Bean. If the parameter type
-    * satisfies the definition of an enterprise Web Bean implementation class,
-    * Section 3.3.2, “Which EJBs are enterprise Web Beans?”, then the Web Bean
-    * is an enterprise Web Bean.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanIsEnterpriseWebBeanIfParameterTypeIsEnterpriseWebBean()
-   {
-      // TODO: has to be?
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasSameConstructorAsWrappedBean()
-   {
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
-   {
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
-   {
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasNoObservers()
-   {
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasNoProducerFields()
-   {
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasNoProducerMethods()
-   {
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasNoDisposalMethods()
-   {
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasSameInterceptorMethodsAsWrappedBean()
-   {
-      assert false;
-   }
-
-   /**
-    * Furthermore, this Web Bean: • has the same Web Bean constructor,
-    * initializer methods and injected fields as a Web Bean defined using
-    * annotations— that is, it has any Web Bean constructor, initializer method
-    * or injected field declared by annotations that appear on the
-    * implementation class, • has no observer methods, producer methods or
-    * fields or disposal methods, • has the same interceptors as a Web Bean
-    * defined using annotations—that is, it has all the interceptor binding
-    * types declared by annotations that appear on the implementation class, and
-    * • has no decorators.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewBeanHasNoDecorators()
-   {
-      assert false;
-   }
-
-   /**
-    * The @New annotation or <New> element may be applied to any field of a Web
-    * Bean implementation class or to any parameter of a producer method,
-    * initializer method, disposal method or Web Bean constructor where the type
-    * of the field or parameter is a concrete Java type which satisfies the
-    * requirements of a simple Web Bean implementation class or enterprise Web
-    * Bean implementation class.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewAnnotationMayBeAppliedToField()
-   {
-      assert false;
-   }
-
-   /**
-    * The @New annotation or <New> element may be applied to any field of a Web
-    * Bean implementation class or to any parameter of a producer method,
-    * initializer method, disposal method or Web Bean constructor where the type
-    * of the field or parameter is a concrete Java type which satisfies the
-    * requirements of a simple Web Bean implementation class or enterprise Web
-    * Bean implementation class.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewAnnotationMayBeAppliedToProducerMethodParameter()
-   {
-      assert false;
-   }
-
-   /**
-    * The @New annotation or <New> element may be applied to any field of a Web
-    * Bean implementation class or to any parameter of a producer method,
-    * initializer method, disposal method or Web Bean constructor where the type
-    * of the field or parameter is a concrete Java type which satisfies the
-    * requirements of a simple Web Bean implementation class or enterprise Web
-    * Bean implementation class.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewAnnotationMayBeAppliedToInitializerMethodParameter()
-   {
-      assert false;
-   }
-
-   /**
-    * The @New annotation or <New> element may be applied to any field of a Web
-    * Bean implementation class or to any parameter of a producer method,
-    * initializer method, disposal method or Web Bean constructor where the type
-    * of the field or parameter is a concrete Java type which satisfies the
-    * requirements of a simple Web Bean implementation class or enterprise Web
-    * Bean implementation class.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewAnnotationMayBeAppliedToConstructorMethodParameter()
-   {
-      assert false;
-   }
-
-   /**
-    * If the @New binding type appears in conjunction with some other binding
-    * type, or is specified for a field or parameter of a type which does not
-    * satisfy the definition of a simple Web Bean implementation class or
-    * enterprise Web Bean implementation class, a DefinitionException is thrown
-    * by the container at deployment time.
-    */
-   @Test(groups = { "stub", "new" })
-   @SpecAssertion(section = "3.9")
-   public void testNewAnnotationCannotAppearInConjunctionWithOtherBindingType()
-   {
-      assert false;
-   }
-
-   /**
-    * If the @New binding type appears in conjunction with some other binding
-    * type, or is specified for a field or parameter of a type which does not
-    * satisfy the definition of a simple Web Bean implementation class or
-    * enterprise Web Bean implementation class, a DefinitionException is thrown
-    * by the container at deployment time.
-    */
-   @Test(groups = { "stub", "new" }, expectedExceptions = DefinitionException.class)
-   @SpecAssertion(section = "3.9")
-   public void testNewAnnotationCannotBeAppliedToNonWebBeanImplementationClass()
-   {
-      assert false;
-   }
-
-   /**
-    * No Web Bean defined using annotations or XML may explicitly declare @New
-    * as a binding type
-    */
-   @Test(groups = { "stub", "new" }, expectedExceptions = DefinitionException.class)
-   @SpecAssertion(section = "3.9")
-   public void testNewAnnotationCannotBeExplicitlyDeclared()
-   {
-      assert false;
-   }
-}

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -304,21 +304,6 @@
       // System.out.println(instance.test());
    }
 
-   private void registerBeans(Class<?>[] classes)
-   {
-      for (Class<?> clazz : classes)
-      {
-         if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
-         {
-            CurrentManager.rootManager().addBean(BeanFactory.createEnterpriseBean(clazz, manager));
-         }
-         else
-         {
-            CurrentManager.rootManager().addBean(BeanFactory.createSimpleBean(clazz, manager));
-         }
-      }
-   }
-
    /**
     * If a simple Web Bean of scope @Dependent and a non-serializable
     * implementation class is injected into a stateful session bean, into a

Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/LoopingProducer.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/LoopingProducer.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/LoopingProducer.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.contexts.invalid;
+
+import javax.webbeans.Current;
+import javax.webbeans.Produces;
+
+public class LoopingProducer
+{
+   @Current Violation violation;
+   
+   @Produces
+   public Violation produceViolation(Violation violation) {
+      return violation;
+   }
+   
+   public void ping() {
+      System.out.println(violation);
+   }
+}

Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/ScopeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/ScopeTest.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/ScopeTest.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.contexts.invalid;
+
+import java.io.Serializable;
+
+import javax.webbeans.Produces;
+import javax.webbeans.SessionScoped;
+
+ at SessionScoped
+public class ScopeTest implements Serializable
+{
+   public ScopeTest()
+   {
+   }
+
+   @Produces
+   public Violation makeViolation()
+   {
+      return new Violation();
+   }
+}

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java (from rev 781, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,430 @@
+package org.jboss.webbeans.test.newbean;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
+import javax.webbeans.Standard;
+
+import org.jboss.webbeans.bean.BeanFactory;
+import org.jboss.webbeans.bean.NewSimpleBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.binding.NewBinding;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecAssertion;
+import org.jboss.webbeans.test.SpecVersion;
+import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
+import org.jboss.webbeans.test.newbean.valid.Sample;
+import org.jboss.webbeans.test.newbean.valid.WrappedBean;
+import org.jboss.webbeans.util.Proxies.TypeInfo;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+ at SpecVersion("20081222")
+public class NewBeanTest extends AbstractTest
+{
+   private SimpleBean<WrappedBean> wrappedBean;
+   private NewSimpleBean<WrappedBean> newBean;
+   
+   @BeforeMethod
+   public void initNewBean() {
+      wrappedBean = BeanFactory.createSimpleBean(WrappedBean.class, manager);
+      manager.addBean(wrappedBean);
+      newBean = BeanFactory.createNewSimpleBean(WrappedBean.class, manager);
+      manager.addBean(newBean);
+   }
+   
+   /**
+    * When the built-in binding type @New is applied to an injection point, a
+    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
+    * 
+    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
+    *            stereotypes, and such that • the implementation class is the
+    *            declared type of the injection point.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanIsDependentScoped()
+   {
+      assert Dependent.class.equals(newBean.getScopeType());
+   }
+
+   /**
+    * When the built-in binding type @New is applied to an injection point, a
+    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
+    * 
+    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
+    *            stereotypes, and such that • the implementation class is the
+    *            declared type of the injection point.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanIsOfStandardDeploymentType()
+   {
+      assert Standard.class.equals(newBean.getDeploymentType());
+   }
+
+   /**
+    * When the built-in binding type @New is applied to an injection point, a
+    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
+    * 
+    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
+    *            stereotypes, and such that • the implementation class is the
+    *            declared type of the injection point.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanIsHasOnlyNewBinding()
+   {
+      assert newBean.getBindingTypes().size() == 1;
+      assert newBean.getBindingTypes().iterator().next().annotationType().equals(new NewBinding().annotationType());
+   }
+
+   /**
+    * When the built-in binding type @New is applied to an injection point, a
+    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
+    * 
+    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
+    *            stereotypes, and such that • the implementation class is the
+    *            declared type of the injection point.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasNoWebBeanName()
+   {
+      assert newBean.getName() == null;
+   }
+
+   /**
+    * When the built-in binding type @New is applied to an injection point, a
+    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
+    * 
+    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
+    *            stereotypes, and such that • the implementation class is the
+    *            declared type of the injection point.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasNoStereotypes()
+   {
+      assert false;
+   }
+
+   /**
+    * When the built-in binding type @New is applied to an injection point, a
+    * Web Bean is implicitly defined with: • scope @Dependent, • deployment type
+    * 
+    * @Standard, • @New as the only binding annotation, • no Web Bean name, • no
+    *            stereotypes, and such that • the implementation class is the
+    *            declared type of the injection point.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasImplementationClassOfInjectionPointType()
+   {
+      assert newBean.getType().equals(WrappedBean.class);
+   }
+
+   /**
+    * If the parameter type satisfies the definition of a simple Web Bean
+    * implementation class, Section 3.2.1, “Which Java classes are simple Web
+    * Beans?”, then the Web Bean is a simple Web Bean. If the parameter type
+    * satisfies the definition of an enterprise Web Bean implementation class,
+    * Section 3.3.2, “Which EJBs are enterprise Web Beans?”, then the Web Bean
+    * is an enterprise Web Bean.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanIsSimpleWebBeanIfParameterTypeIsSimpleWebBean()
+   {
+      // TODO: has to be?
+      assert false;
+   }
+
+   /**
+    * If the parameter type satisfies the definition of a simple Web Bean
+    * implementation class, Section 3.2.1, “Which Java classes are simple Web
+    * Beans?”, then the Web Bean is a simple Web Bean. If the parameter type
+    * satisfies the definition of an enterprise Web Bean implementation class,
+    * Section 3.3.2, “Which EJBs are enterprise Web Beans?”, then the Web Bean
+    * is an enterprise Web Bean.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanIsEnterpriseWebBeanIfParameterTypeIsEnterpriseWebBean()
+   {
+      // TODO: has to be?
+      assert false;
+   }
+
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasSameConstructorAsWrappedBean()
+   {
+      assert wrappedBean.getConstructor().equals(newBean.getConstructor());
+   }
+
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
+   {
+      assert newBean.getInitializerMethods().equals(wrappedBean.getInitializerMethods());
+   }
+
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
+   {
+      Set<AnnotatedItem<?, ?>> wrappedBeanInjectionPoints = wrappedBean.getInjectionPoints();
+      Set<AnnotatedItem<?, ?>> newBeanInjectionPoints = newBean.getInjectionPoints();
+      assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
+   }
+   
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = {"new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasNoObservers()
+   {
+      assert newBean.getObserverMethods().isEmpty();
+   }
+
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasNoProducerFields()
+   {
+      assert newBean.getProducerFields().isEmpty();
+   }
+
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasNoProducerMethods()
+   {
+      assert newBean.getProducerMethods().isEmpty();
+   }
+
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasNoDisposalMethods()
+   {
+      Class<?> type = TypeInfo.ofTypes(newBean.getTypes()).getSuperClass();
+      assert manager.resolveDisposalMethods(type, newBean.getBindingTypes().toArray(new Annotation[0])).isEmpty();
+   }
+
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasSameInterceptorMethodsAsWrappedBean()
+   {
+      assert false;
+   }
+
+   /**
+    * Furthermore, this Web Bean: • has the same Web Bean constructor,
+    * initializer methods and injected fields as a Web Bean defined using
+    * annotations— that is, it has any Web Bean constructor, initializer method
+    * or injected field declared by annotations that appear on the
+    * implementation class, • has no observer methods, producer methods or
+    * fields or disposal methods, • has the same interceptors as a Web Bean
+    * defined using annotations—that is, it has all the interceptor binding
+    * types declared by annotations that appear on the implementation class, and
+    * • has no decorators.
+    */
+   @Test(groups = { "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewBeanHasNoDecorators()
+   {
+      Annotation[] bindingTypes = newBean.getBindingTypes().toArray(new Annotation[0]);
+      assert manager.resolveDecorators(newBean.getTypes(), bindingTypes).isEmpty();
+   }
+
+   /**
+    * The @New annotation or <New> element may be applied to any field of a Web
+    * Bean implementation class or to any parameter of a producer method,
+    * initializer method, disposal method or Web Bean constructor where the type
+    * of the field or parameter is a concrete Java type which satisfies the
+    * requirements of a simple Web Bean implementation class or enterprise Web
+    * Bean implementation class.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewAnnotationMayBeAppliedToField()
+   {
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Sample.class));
+      webBeansBootstrap.boot();
+      assert manager.resolveByType(WrappedBean.class, new NewBinding()).size() == 1;
+   }
+
+   /**
+    * The @New annotation or <New> element may be applied to any field of a Web
+    * Bean implementation class or to any parameter of a producer method,
+    * initializer method, disposal method or Web Bean constructor where the type
+    * of the field or parameter is a concrete Java type which satisfies the
+    * requirements of a simple Web Bean implementation class or enterprise Web
+    * Bean implementation class.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewAnnotationMayBeAppliedToProducerMethodParameter()
+   {
+      assert false;
+   }
+
+   /**
+    * The @New annotation or <New> element may be applied to any field of a Web
+    * Bean implementation class or to any parameter of a producer method,
+    * initializer method, disposal method or Web Bean constructor where the type
+    * of the field or parameter is a concrete Java type which satisfies the
+    * requirements of a simple Web Bean implementation class or enterprise Web
+    * Bean implementation class.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewAnnotationMayBeAppliedToInitializerMethodParameter()
+   {
+      assert false;
+   }
+
+   /**
+    * The @New annotation or <New> element may be applied to any field of a Web
+    * Bean implementation class or to any parameter of a producer method,
+    * initializer method, disposal method or Web Bean constructor where the type
+    * of the field or parameter is a concrete Java type which satisfies the
+    * requirements of a simple Web Bean implementation class or enterprise Web
+    * Bean implementation class.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewAnnotationMayBeAppliedToConstructorMethodParameter()
+   {
+      assert false;
+   }
+
+   /**
+    * If the @New binding type appears in conjunction with some other binding
+    * type, or is specified for a field or parameter of a type which does not
+    * satisfy the definition of a simple Web Bean implementation class or
+    * enterprise Web Bean implementation class, a DefinitionException is thrown
+    * by the container at deployment time.
+    */
+   @Test(groups = { "stub", "new" })
+   @SpecAssertion(section = "3.9")
+   public void testNewAnnotationCannotAppearInConjunctionWithOtherBindingType()
+   {
+      assert false;
+   }
+
+   /**
+    * If the @New binding type appears in conjunction with some other binding
+    * type, or is specified for a field or parameter of a type which does not
+    * satisfy the definition of a simple Web Bean implementation class or
+    * enterprise Web Bean implementation class, a DefinitionException is thrown
+    * by the container at deployment time.
+    */
+   @Test(groups = { "stub", "new" }, expectedExceptions = DefinitionException.class)
+   @SpecAssertion(section = "3.9")
+   public void testNewAnnotationCannotBeAppliedToNonWebBeanImplementationClass()
+   {
+      assert false;
+   }
+
+   /**
+    * No Web Bean defined using annotations or XML may explicitly declare @New
+    * as a binding type
+    */
+   @Test(groups = { "stub", "new" }, expectedExceptions = DefinitionException.class)
+   @SpecAssertion(section = "3.9")
+   public void testNewAnnotationCannotBeExplicitlyDeclared()
+   {
+      assert false;
+   }
+   
+   
+}


Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/Sample.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/Sample.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/Sample.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,28 @@
+package org.jboss.webbeans.test.newbean.valid;
+
+import javax.webbeans.Initializer;
+import javax.webbeans.New;
+import javax.webbeans.Produces;
+
+
+public class Sample
+{
+   @New
+   WrappedBean reference;
+
+   @Initializer
+   public Sample(@New WrappedBean reference)
+   {
+   }
+
+   @Initializer
+   public void init(@New WrappedBean reference)
+   {
+   }
+
+   @Produces
+   Object produce(@New WrappedBean reference)
+   {
+      return new Object();
+   }
+}

Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/WrappedBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/WrappedBean.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/WrappedBean.java	2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.newbean.valid;
+
+import java.io.Serializable;
+
+import javax.webbeans.Named;
+import javax.webbeans.SessionScoped;
+
+ at SessionScoped
+ at Named("Fred")
+public class WrappedBean implements Serializable
+{
+   public WrappedBean() {
+      
+   }
+}

Modified: ri/trunk/webbeans-ri/testng.xml
===================================================================
--- ri/trunk/webbeans-ri/testng.xml	2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/testng.xml	2009-01-06 22:43:56 UTC (rev 793)
@@ -37,6 +37,7 @@
          <package name="org.jboss.webbeans.test.contexts"></package>
          <package name="org.jboss.webbeans.examples"></package>
          <package name="org.jboss.webbeans.test.ejb"></package>
+         <package name="org.jboss.webbeans.test.newbean"></package>
       </packages>
    </test>
    




More information about the weld-commits mailing list