You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/04/16 00:36:51 UTC
svn commit: r1092836 -
/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
Author: hlship
Date: Fri Apr 15 22:36:51 2011
New Revision: 1092836
URL: http://svn.apache.org/viewvc?rev=1092836&view=rev
Log:
TAP5-853: Don't inject the PropertyConduitDelegate unless actually needed
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=1092836&r1=1092835&r2=1092836&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 Fri Apr 15 22:36:51 2011
@@ -279,9 +279,6 @@ public class PropertyConduitSourceImpl i
{
this.plasticClass = plasticClass;
- delegateField = plasticClass.introduceField(PropertyConduitDelegate.class, "delegate").inject(
- sharedDelegate);
-
// Create the various methods; also determine the conduit's property type, property name and identify
// the annotation provider.
@@ -307,9 +304,6 @@ public class PropertyConduitSourceImpl i
}
});
- if (conduitPropertyType == null)
- throw new RuntimeException("Conduit property type is null for " + rootType + " " + expression);
-
final PlasticField propertyTypeField = plasticClass.introduceField(Class.class, "propertyType").inject(
conduitPropertyType);
@@ -629,7 +623,7 @@ public class PropertyConduitSourceImpl i
{
// Put the delegate on top of the stack
- builder.loadThis().getField(delegateField);
+ builder.loadThis().getField(getDelegateField());
invokeMethod(builder, DelegateMethods.RANGE, rangeNode, 0);
@@ -688,7 +682,7 @@ public class PropertyConduitSourceImpl i
{
Term term;
- while (node != null)
+ while (true)
{
switch (node.getType())
{
@@ -766,8 +760,6 @@ public class PropertyConduitSourceImpl i
IDENTIFIER, INVOKE, LIST, NOT);
}
}
-
- return activeType;
}
public void invokeGetRootMethod(InstructionBuilder builder)
@@ -869,7 +861,7 @@ public class PropertyConduitSourceImpl i
{
boxIfPrimitive(builder, expressionType);
- builder.loadThis().getField(delegateField);
+ builder.loadThis().getField(getDelegateField());
builder.swap().loadTypeConstant(PlasticUtils.toWrapperType(parameterType));
builder.invoke(DelegateMethods.COERCE);
@@ -1176,12 +1168,22 @@ public class PropertyConduitSourceImpl i
// Now invoke the delegate invert() method
- builder.loadThis().getField(delegateField);
+ builder.loadThis().getField(getDelegateField());
builder.swap().invoke(DelegateMethods.INVERT);
return boolean.class;
}
+
+ /** Defer creation of the delegate field unless actually needed. */
+ private PlasticField getDelegateField()
+ {
+ if (delegateField == null)
+ delegateField = plasticClass.introduceField(PropertyConduitDelegate.class, "delegate").inject(
+ sharedDelegate);
+
+ return delegateField;
+ }
}
public PropertyConduitSourceImpl(PropertyAccess access, @ComponentLayer