openwebbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: svn commit: r1408825 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Date Wed, 14 Nov 2012 07:23:46 GMT
Oops sorry, will take care next time
Le 14 nov. 2012 00:01, "Mark Struberg" <struberg@yahoo.de> a écrit :

> change is fine but please turn off ANY reformatting in ASF projects!
>
> This is really a general note and not only you ;)
>
> The import order you are using might be slightly different than the one
> from another committer. And then we end up with changing those lines back
> and forth over and over again...
>
>
> And folks, please also make sure that you never commit tabs!
>
> LieGrue,
> strub
>
>
>
> ----- Original Message -----
> > From: "rmannibucau@apache.org" <rmannibucau@apache.org>
> > To: commits@openwebbeans.apache.org
> > Cc:
> > Sent: Tuesday, November 13, 2012 5:25 PM
> > Subject: svn commit: r1408825 -
> /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
> >
> > Author: rmannibucau
> > Date: Tue Nov 13 16:25:55 2012
> > New Revision: 1408825
> >
> > URL: http://svn.apache.org/viewvc?rev=1408825&view=rev
> > Log:
> > OWB-720 trying to get generic type from superclass to get a better
> matching on
> > injection points
> >
> > Modified:
> >
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
> > URL:
> >
> http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=1408825&r1=1408824&r2=1408825&view=diff
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
> > (original)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
> > Tue Nov 13 16:25:55 2012
> > @@ -18,6 +18,14 @@
> >   */
> > package org.apache.webbeans.util;
> >
> > +import org.apache.webbeans.config.BeanTypeSetResolver;
> > +import org.apache.webbeans.config.WebBeansContext;
> > +import org.apache.webbeans.exception.WebBeansException;
> > +import org.apache.webbeans.logger.WebBeansLoggerFacade;
> > +
> > +import javax.enterprise.event.Event;
> > +import javax.enterprise.inject.spi.InjectionPoint;
> > +import javax.inject.Provider;
> > import java.lang.reflect.Field;
> > import java.lang.reflect.GenericArrayType;
> > import java.lang.reflect.Method;
> > @@ -37,15 +45,6 @@ import java.util.Set;
> > import java.util.logging.Level;
> > import java.util.logging.Logger;
> >
> > -import javax.enterprise.event.Event;
> > -import javax.enterprise.inject.spi.InjectionPoint;
> > -import javax.inject.Provider;
> > -
> > -import org.apache.webbeans.config.BeanTypeSetResolver;
> > -import org.apache.webbeans.config.WebBeansContext;
> > -import org.apache.webbeans.exception.WebBeansException;
> > -import org.apache.webbeans.logger.WebBeansLoggerFacade;
> > -
> > /**
> >   * Utility classes with respect to the class operations.
> >   *
> > @@ -603,19 +602,39 @@ public final class ClassUtil
> >          //Bean type is class and required type is parametrized
> >          else if(beanType instanceof Class && requiredType instanceof
> > ParameterizedType)
> >          {
> > -            Class<?> clazzBeanType = (Class<?>)beanType;
> > -            ParameterizedType ptReq = (ParameterizedType)requiredType;
> > -            Class<?> clazzReqType = (Class<?>)ptReq.getRawType();
> > -
> > +            final Class<?> clazzBeanType = (Class<?>)beanType;
> > +            final ParameterizedType ptReq =
> (ParameterizedType)requiredType;
> > +            final Class<?> clazzReqType =
> > (Class<?>)ptReq.getRawType();
> > +            final Type genericSuperClass =
> > clazzBeanType.getGenericSuperclass();
> > +
> >              if(Provider.class.isAssignableFrom(clazzReqType) ||
> >                      Event.class.isAssignableFrom(clazzReqType))
> >              {
> >                  if(isClassAssignable(clazzReqType, clazzBeanType))
> >                  {
> >                      return true;
> > -                }
> > +                }
> >              }
> > -
> > +            else if (genericSuperClass instanceof ParameterizedType)
> > +            {
> > +                final Type[] params = ((ParameterizedType)
> > genericSuperClass).getActualTypeArguments();
> > +                final Type[] requiredParams = ((ParameterizedType)
> > requiredType).getActualTypeArguments();
> > +                if (params.length != requiredParams.length)
> > +                {
> > +                    return false;
> > +                }
> > +
> > +                for (int i = 0; i < params.length; i++)
> > +                {
> > +                    if (!isAssignable(params[i], requiredParams[i]))
> > +                    {
> > +                        return false;
> > +                    }
> > +                }
> > +
> > +                return isClassAssignable(clazzReqType, clazzBeanType);
> > +            }
> > +
> >              return false;
> >          }
> >          else
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message