Author: struberg
Date: Sun Feb 20 16:39:23 2011
New Revision: 1072627
URL: http://svn.apache.org/viewvc?rev=1072627&view=rev
Log:
OWB-461 cleanup: use known size for toArray
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=1072627&r1=1072626&r2=1072627&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
Sun Feb 20 16:39:23 2011
@@ -1182,7 +1182,8 @@ public final class DefinitionUtil
private static <X> void
createProducerBeansFromAnnotatedType(InjectionTargetBean<X> bean,
Set<ProducerMethodBean<?>> producerComponents,
AnnotatedMethod<X> annotatedMethod, Class<?> clazz, boolean isSpecializes)
{
- Annotation[] anns = annotatedMethod.getAnnotations().toArray(new
Annotation[0]);
+ Set<Annotation> annSet = annotatedMethod.getAnnotations();
+ Annotation[] anns = annSet.toArray(new Annotation[annSet.size()]);
List<AnnotatedParameter<X>> parameters =
annotatedMethod.getParameters();
// Producer Method
@@ -1190,7 +1191,8 @@ public final class DefinitionUtil
{
for(AnnotatedParameter<X> parameter : parameters)
{
- Annotation[] parameterAnns =
parameter.getAnnotations().toArray(new Annotation[0]);
+ Set<Annotation> paramAnnSet = parameter.getAnnotations();
+ Annotation[] parameterAnns = paramAnnSet.toArray(new
Annotation[parameter.getAnnotations().size()]);
if (AnnotationUtil.hasAnnotation(anns, Inject.class) ||
AnnotationUtil.hasAnnotation(parameterAnns,
Disposes.class) ||
AnnotationUtil.hasAnnotation(parameterAnns,
Observes.class))
@@ -1240,7 +1242,8 @@ public final class DefinitionUtil
bean.setNullable(false);
}
- Annotation[] anns = method.getAnnotations().toArray(new Annotation[0]);
+ Set<Annotation> annSet = method.getAnnotations();
+ Annotation[] anns = annSet.toArray(new Annotation[annSet.size()]);
defineSerializable(bean);
defineStereoTypes(bean, anns);
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java?rev=1072627&r1=1072626&r2=1072627&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
Sun Feb 20 16:39:23 2011
@@ -54,7 +54,7 @@ public class OwbParametrizedTypeImpl imp
@Override
public Type[] getActualTypeArguments()
{
- return this.types.toArray(new Type[0]);
+ return types.toArray(new Type[types.size()]);
}
public void addTypeArgument(Type type)