Author: hlship
Date: Wed Apr 13 22:23:55 2011
New Revision: 1091956

URL: http://svn.apache.org/viewvc?rev=1091956&view=rev
Log:
TAP5-853: Correctly wrap primitives returned from method invocations before 
returning the value from get()

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java?rev=1091956&r1=1091955&r2=1091956&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
 Wed Apr 13 22:23:55 2011
@@ -780,8 +780,7 @@ public class PropertyConduitSourceImpl i
                 {
                     Class expressionType = buildSubexpression(builder, null, 
node.getChild(0));
 
-                    if (expressionType.isPrimitive())
-                        builder.boxPrimitive(expressionType.getName());
+                    boxIfPrimitive(builder, expressionType);
 
                     // Now invoke the delegate invert() method
 
@@ -931,8 +930,7 @@ public class PropertyConduitSourceImpl i
 
                 Class expressionType = buildSubexpression(builder, null, 
listNode.getChild(i));
 
-                if (expressionType.isPrimitive())
-                    builder.boxPrimitive(expressionType.getName());
+                boxIfPrimitive(builder, expressionType);
 
                 // Add the value to the array, then pop off the returned 
boolean
                 builder.invoke(ArrayListMethods.ADD).pop();
@@ -1224,7 +1222,7 @@ public class PropertyConduitSourceImpl i
                 return;
             }
 
-            plasticClass.introduceMethod(GET).changeImplementation(new 
InstructionBuilderCallback()
+            plasticClass.introduceMethod(GET, new InstructionBuilderCallback()
             {
                 public void doBuild(InstructionBuilder builder)
                 {
@@ -1232,20 +1230,13 @@ public class PropertyConduitSourceImpl i
 
                     Class termType = evaluateTerm(builder, activeType, node, 
info);
 
-                    unboxIfPrimitive(builder, termType);
+                    boxIfPrimitive(builder, termType);
 
                     builder.returnResult();
                 }
-
             });
         }
 
-        private void unboxIfPrimitive(InstructionBuilder builder, Class type)
-        {
-            if (type.isPrimitive())
-                builder.unboxPrimitive(type.getName());
-        }
-
         /**
          * Extends the builder with the code to evaluate a term (which may
          * 
@@ -1876,6 +1867,12 @@ public class PropertyConduitSourceImpl i
 
             throw new 
NoSuchMethodException(ServicesMessages.noSuchMethod(activeType, methodName));
         }
+
+        public void boxIfPrimitive(InstructionBuilder builder, Class termType)
+        {
+            if (termType.isPrimitive())
+                builder.boxPrimitive(termType.getName());
+        }
     }
 
     public PropertyConduitSourceImpl(PropertyAccess access, @ComponentLayer


Reply via email to