Re: svn commit: r1079926 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java

2011-06-04 Thread Eric Covener
I'm looking at an issue and have a question about this area of the
code. I'm working with a dependent bean that has interceptors, so it
is proxied.

It seems to me like the final argument of
CreationalContextImpl#addDependent() is meant to be a contextual
instance -- something suitable to be returned from Contextual.create()
or Contextual.destroy().   The same things that should only ever
directly be pulled from a Context.

In this case though, it seems like at injection time we're passing not
a contextual instance, but a  contextual reference (e.g. our own
javassist proxy) like we'd inject or provide via a call to
BeanManager.getReference().

This will cause us to later call Contextual.destroy() on a
proxy/reference instead of a contextual instance itself.  Does the
adding of dependents need to be pushed down into places where
Contextual.create() is really called?

Can anyone shed some light on this?


On Wed, Mar 9, 2011 at 1:44 PM,  strub...@apache.org wrote:
 Author: struberg
 Date: Wed Mar  9 18:44:04 2011
 New Revision: 1079926

 URL: http://svn.apache.org/viewvc?rev=1079926view=rev
 Log:
 OWB-542 oops, something went wrong with the revert. all fixed now ;)

 Modified:
    
 openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java

 Modified: 
 openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
 URL: 
 http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=1079926r1=1079925r2=1079926view=diff
 ==
 --- 
 openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
  (original)
 +++ 
 openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
  Wed Mar  9 18:44:04 2011
 @@ -37,6 +37,7 @@ import org.apache.webbeans.component.Inj
  import org.apache.webbeans.component.InstanceBean;
  import org.apache.webbeans.component.OwbBean;
  import org.apache.webbeans.container.InjectionResolver;
 +import org.apache.webbeans.context.creational.CreationalContextImpl;
  import org.apache.webbeans.context.creational.DependentCreationalContext;
  import org.apache.webbeans.util.ClassUtil;
  import org.apache.webbeans.util.WebBeansUtil;
 @@ -138,6 +139,15 @@ public abstract class AbstractInjectable
             }
         }

 +        // add this dependent into bean dependent list
 +        if (!WebBeansUtil.isStaticInjection(injectionPoint)  
 WebBeansUtil.isDependent(injectedBean))
 +        {
 +            if(instanceUnderInjection.get() != null)
 +            {
 +                
 ((CreationalContextImpl?)this.injectionOwnerCreationalContext).addDependent(instanceUnderInjection.get(),injectedBean,
  injected);
 +            }
 +        }
 +
         return injected;
     }







-- 
Eric Covener
cove...@gmail.com


Re: svn commit: r1079926 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java

2011-06-04 Thread Mark Struberg
that would indeed be a bug in this case.

For the long term, I'd like to completely split our dependent proxies from the 
proxies we need because of @NormalScoped. The problem is that according to the 
spec @PreDestroy methods might be intercepted. Not sure if we have this 
correctly implemented atm.

LieGrue,
strub 

--- On Sat, 6/4/11, Eric Covener cove...@gmail.com wrote:

 From: Eric Covener cove...@gmail.com
 Subject: Re: svn commit: r1079926 - 
 /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
 To: dev@openwebbeans.apache.org
 Date: Saturday, June 4, 2011, 10:41 AM
 I'm looking at an issue and have a
 question about this area of the
 code. I'm working with a dependent bean that has
 interceptors, so it
 is proxied.
 
 It seems to me like the final argument of
 CreationalContextImpl#addDependent() is meant to be a
 contextual
 instance -- something suitable to be returned from
 Contextual.create()
 or Contextual.destroy().   The same things
 that should only ever
 directly be pulled from a Context.
 
 In this case though, it seems like at injection time we're
 passing not
 a contextual instance, but a  contextual reference
 (e.g. our own
 javassist proxy) like we'd inject or provide via a call to
 BeanManager.getReference().
 
 This will cause us to later call Contextual.destroy() on a
 proxy/reference instead of a contextual instance
 itself.  Does the
 adding of dependents need to be pushed down into places
 where
 Contextual.create() is really called?
 
 Can anyone shed some light on this?
 
 
 On Wed, Mar 9, 2011 at 1:44 PM,  strub...@apache.org
 wrote:
  Author: struberg
  Date: Wed Mar  9 18:44:04 2011
  New Revision: 1079926
 
  URL: http://svn.apache.org/viewvc?rev=1079926view=rev
  Log:
  OWB-542 oops, something went wrong with the revert.
 all fixed now ;)
 
  Modified:
   
  openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
 
  Modified:
 openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
  URL: 
  http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=1079926r1=1079925r2=1079926view=diff
 
 ==
  ---
 openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
 (original)
  +++
 openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
 Wed Mar  9 18:44:04 2011
  @@ -37,6 +37,7 @@ import
 org.apache.webbeans.component.Inj
   import org.apache.webbeans.component.InstanceBean;
   import org.apache.webbeans.component.OwbBean;
   import
 org.apache.webbeans.container.InjectionResolver;
  +import
 org.apache.webbeans.context.creational.CreationalContextImpl;
   import
 org.apache.webbeans.context.creational.DependentCreationalContext;
   import org.apache.webbeans.util.ClassUtil;
   import org.apache.webbeans.util.WebBeansUtil;
  @@ -138,6 +139,15 @@ public abstract class
 AbstractInjectable
              }
          }
 
  +        // add this dependent into bean dependent
 list
  +        if
 (!WebBeansUtil.isStaticInjection(injectionPoint) 
 WebBeansUtil.isDependent(injectedBean))
  +        {
  +            if(instanceUnderInjection.get() !=
 null)
  +            {
  +              
  ((CreationalContextImpl?)this.injectionOwnerCreationalContext).addDependent(instanceUnderInjection.get(),injectedBean,
 injected);
  +            }
  +        }
  +
          return injected;
      }
 
 
 
 
 
 
 
 -- 
 Eric Covener
 cove...@gmail.com



Re: Yet another proxy/weaving problem

2011-06-04 Thread David Jencks
I've now found another place where the added WovenProxy interface breaks 
OpenWebBeans.   The lack of response on the aries list to my first post makes 
me think that perhaps this interface can't be removed.  I notice that there's 
an isSynthetic() method on Class.  I'm not sure what this means but I'm 
wondering if it would be possible to mark this interface synthetic and have the 
relevant parts of OWB ignore synthetic interfaces rather than explicitly 
configuring it to ignore this particular interface?

thanks
david jencks

On Jun 2, 2011, at 11:53 PM, David Jencks wrote:

 another day another problem
 
 org.apache.webbeans.exception.WebBeansConfigurationException: Decorator : 
 Name:null, WebBeans Type:DECORATOR, API 
 Types:[org.jboss.jsr299.tck.tests.context.dependent.InteriorDecorator,org.apache.aries.proxy.weaving.WovenProxy,org.jboss.jsr299.tck.tests.context.dependent.Interior,java.lang.Object],
  Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default] 
 delegate attribute must implement all of the decorator decorated types, but 
 decorator type interface org.apache.aries.proxy.weaving.WovenProxy is not 
 assignable from delegate type of interface 
 org.jboss.jsr299.tck.tests.context.dependent.Interior
 
 
 I believe the story here is that decorator classes must not implement 
 interfaces that the delegate doesn't implement, but aries is adding the 
 org.apache.aries.proxy.weaving.WovenProxy to the decorator class.
 
 OWB is already excluding Serializable and I can modify the code to also 
 exclude org.apache.aries.proxy.weaving.WovenProxy and the jcdi tests pass but 
 this is going to involve making the list of ignored interfaces configurable 
 and may not be acceptable to OWB.
 
 Is there any way to make the weaving/proxying code not add this interface?  I 
 don't think the jdk proxying code needs to add interfaces
 
 thanks
 david jencks