openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1072626 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept: InterceptorUtil.java WebBeansInterceptorConfig.java
Date Sun, 20 Feb 2011 16:33:30 GMT
Author: struberg
Date: Sun Feb 20 16:33:30 2011
New Revision: 1072626

URL: http://svn.apache.org/viewvc?rev=1072626&view=rev
Log:
OWB-461 cleanup: use known size for toArray

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

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=1072626&r1=1072625&r2=1072626&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
Sun Feb 20 16:33:30 2011
@@ -170,7 +170,7 @@ public final class InterceptorUtil
                             clazzParameters.add(ClassUtil.getClazz(parameter.getBaseType()));
                         }
 
-                        Class<?>[] params = clazzParameters.toArray(new Class<?>[0]);
+                        Class<?>[] params = clazzParameters.toArray(new Class<?>[clazzParameters.size()]);
                         if (params.length == 1 && params[0].equals(InvocationContext.class))
                         {
                             if (ClassUtil.getReturnType(method.getJavaMember()).equals(Object.class))
@@ -280,7 +280,7 @@ public final class InterceptorUtil
                             clazzParameters.add(ClassUtil.getClazz(parameter.getBaseType()));
                         }
 
-                        Class<?>[] params = clazzParameters.toArray(new Class<?>[0]);
+                        Class<?>[] params = clazzParameters.toArray(new Class<?>[clazzParameters.size()]);
                         if (params.length == 1 && params[0].equals(InvocationContext.class))
                         {
                             if (ClassUtil.getReturnType(method.getJavaMember()).equals(Void.TYPE))
@@ -316,7 +316,8 @@ public final class InterceptorUtil
 
         }
 
-        Annotation[] anns = annotatedType.getAnnotations().toArray(new Annotation[0]);
+        Set<Annotation> annSet = annotatedType.getAnnotations();
+        Annotation[] anns = annSet.toArray(new Annotation[annSet.size()]);
         if (!webBeansContext.getAnnotationManager().hasInterceptorBindingMetaAnnotation(anns))
         {
             throw new WebBeansConfigurationException("Interceptor class : " + annotatedType.getJavaClass().getName()

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=1072626&r1=1072625&r2=1072626&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
Sun Feb 20 16:33:30 2011
@@ -155,7 +155,7 @@ public final class WebBeansInterceptorCo
         Annotation[] typeAnns = null;
         if(annotations != null)
         {
-            typeAnns = annotations.toArray(new Annotation[0]);
+            typeAnns = annotations.toArray(new Annotation[annotations.size()]);
         }
         else
         {
@@ -409,7 +409,7 @@ public final class WebBeansInterceptorCo
             set.add(m);
         }
 
-        methods = set.toArray(new Method[0]);
+        methods = set.toArray(new Method[set.size()]);
 
         for (Method method : methods)
         {



Mime
View raw message