openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1435507 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: intercept/InterceptorResolutionService.java proxy/DecoratorProxyFactory.java
Date Sat, 19 Jan 2013 08:50:08 GMT
Author: arne
Date: Sat Jan 19 08:50:08 2013
New Revision: 1435507

URL: http://svn.apache.org/viewvc?rev=1435507&view=rev
Log:
OWB-344: Fixed resolution of generic delegate points

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DecoratorProxyFactory.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1435507&r1=1435506&r2=1435507&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
Sat Jan 19 08:50:08 2013
@@ -32,6 +32,7 @@ import javax.interceptor.Interceptors;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -319,6 +320,10 @@ public class InterceptorResolutionServic
         Set<Type> decoratedTypes = decorator.getDecoratedTypes();
         for (Type decoratedType : decoratedTypes)
         {
+            if (decoratedType instanceof ParameterizedType) {
+                ParameterizedType parameterizedType = (ParameterizedType)decoratedType;
+                decoratedType = parameterizedType.getRawType();
+            }
             if (decoratedType instanceof Class)
             {
                 Class decoratedClass = (Class) decoratedType;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DecoratorProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DecoratorProxyFactory.java?rev=1435507&r1=1435506&r2=1435507&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DecoratorProxyFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DecoratorProxyFactory.java
Sat Jan 19 08:50:08 2013
@@ -161,9 +161,9 @@ public class DecoratorProxyFactory exten
         {
             T proxy = proxyClass.newInstance();
 
-            Field delegateField = proxy.getClass().getDeclaredField(FIELD_INSTANCE_PROVIDER);
-            delegateField.setAccessible(true);
-            delegateField.set(proxy, provider);
+//            Field delegateField = proxy.getClass().getDeclaredField(FIELD_INSTANCE_PROVIDER);
+//            delegateField.setAccessible(true);
+//            delegateField.set(proxy, provider);
 
             return proxy;
         }
@@ -175,10 +175,10 @@ public class DecoratorProxyFactory exten
         {
             throw new ProxyGenerationException(e);
         }
-        catch (NoSuchFieldException e)
-        {
-            throw new ProxyGenerationException(e);
-        }
+//        catch (NoSuchFieldException e)
+//        {
+//            throw new ProxyGenerationException(e);
+//        }
     }
 
 
@@ -208,7 +208,7 @@ public class DecoratorProxyFactory exten
 
             mv.visitVarInsn(Opcodes.ALOAD, 0);
             mv.visitInsn(Opcodes.ACONST_NULL);
-            mv.visitFieldInsn(Opcodes.PUTFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER,
Type.getDescriptor(Provider.class));
+//            mv.visitFieldInsn(Opcodes.PUTFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER,
Type.getDescriptor(Provider.class));
 
             mv.visitInsn(Opcodes.RETURN);
             mv.visitMaxs(-1, -1);
@@ -224,8 +224,8 @@ public class DecoratorProxyFactory exten
     protected void createInstanceVariables(ClassWriter cw, Class<?> classToProxy, String
classFileName)
     {
         // variable #1, the Provider<?> for the Contextual Instance
-        cw.visitField(Opcodes.ACC_PRIVATE,
-                FIELD_INSTANCE_PROVIDER, Type.getDescriptor(Provider.class), null, null).visitEnd();
+//        cw.visitField(Opcodes.ACC_PRIVATE,
+//                FIELD_INSTANCE_PROVIDER, Type.getDescriptor(Provider.class), null, null).visitEnd();
     }
 
     @Override
@@ -263,7 +263,7 @@ public class DecoratorProxyFactory exten
 
             // load the contextual instance Provider
             mv.visitVarInsn(Opcodes.ALOAD, 0);
-            mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER,
Type.getDescriptor(Provider.class));
+//            mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER,
Type.getDescriptor(Provider.class));
 
             // invoke the get() method on the Provider
             mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(Provider.class),
"get", "()Ljava/lang/Object;");



Mime
View raw message