You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2012/03/24 16:15:21 UTC
svn commit: r1304822 - in
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans:
annotation/AnnotationManager.java config/BeansDeployer.java
container/BeanManagerImpl.java inject/impl/InjectionPointFactory.java
Author: struberg
Date: Sat Mar 24 15:15:21 2012
New Revision: 1304822
URL: http://svn.apache.org/viewvc?rev=1304822&view=rev
Log:
OWB-657 improve OWB boot performance
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
Modified: 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=1304822&r1=1304821&r2=1304822&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java Sat Mar 24 15:15:21 2012
@@ -67,6 +67,12 @@ public final class AnnotationManager
private final BeanManagerImpl beanManagerImpl;
private final WebBeansContext webBeansContext;
+ private final static Annotation[] ONLY_DEFAULT_ANNOTATION = new Annotation[1];
+ static
+ {
+ ONLY_DEFAULT_ANNOTATION[0] = new DefaultLiteral();
+ };
+
// No instantiate
public AnnotationManager(WebBeansContext context)
@@ -270,6 +276,11 @@ public final class AnnotationManager
{
Asserts.assertNotNull(annotations, "Annotations argument can not be null");
+ if (annotations.length == 0)
+ {
+ return ONLY_DEFAULT_ANNOTATION;
+ }
+
Set<Annotation> set = new HashSet<Annotation>();
for (Annotation annot : annotations)
@@ -283,7 +294,7 @@ public final class AnnotationManager
//Add the default qualifier if no others exist. Section 3.10, OWB-142///
if(set.size() == 0)
{
- set.add(new DefaultLiteral());
+ return ONLY_DEFAULT_ANNOTATION;
}
////////////////////////////////////////////////////////////////////////
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=1304822&r1=1304821&r2=1304822&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 Sat Mar 24 15:15:21 2012
@@ -684,7 +684,7 @@ public class BeansDeployer
{
boolean validate = false;
- if(EnterpriseBeanMarker.class.isAssignableFrom(beanObj.getClass()))
+ if(beanObj instanceof EnterpriseBeanMarker)
{
EnterpriseBeanMarker marker = (EnterpriseBeanMarker)beanObj;
if(marker.isPassivationCapable())
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=1304822&r1=1304821&r2=1304822&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 Sat Mar 24 15:15:21 2012
@@ -1084,9 +1084,10 @@ public class BeanManagerImpl implements
}
}
- if(AnnotationUtil.hasAnnotation(annotationType.getDeclaredAnnotations(), NormalScope.class))
+ NormalScope scope = annotationType.getAnnotation(NormalScope.class);
+
+ if(scope != null)
{
- NormalScope scope = annotationType.getAnnotation(NormalScope.class);
return scope.passivating();
}
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=1304822&r1=1304821&r2=1304822&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 Sat Mar 24 15:15:21 2012
@@ -117,14 +117,14 @@ public class InjectionPointFactory
*/
private InjectionPoint getGenericInjectionPoint(Bean<?> owner, Annotation[] annots, Type type, Member member,Annotated annotated)
{
- InjectionPointImpl injectionPoint = null;
+ InjectionPointImpl injectionPoint;
Annotation[] qualifierAnnots = webBeansContext.getAnnotationManager().getQualifierAnnotations(annots);
//@Named update for injection fields!
if(member instanceof Field)
{
- for(int i=0;i<qualifierAnnots.length;i++)
+ for(int i=0; i < qualifierAnnots.length; i++)
{
Annotation qualifier = qualifierAnnots[i];
if(qualifier.annotationType().equals(Named.class))