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/10/21 17:56:47 UTC
svn commit: r1187422 -
/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
Author: hlship
Date: Fri Oct 21 15:56:46 2011
New Revision: 1187422
URL: http://svn.apache.org/viewvc?rev=1187422&view=rev
Log:
TAP5-1713: Add (inefficient) fix for case where the field is static
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=1187422&r1=1187421&r2=1187422&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 Oct 21 15:56:46 2011
@@ -1141,8 +1141,25 @@ public class PropertyConduitSourceImpl i
{
Class rawFieldType = field.getType();
- builder.getField(field.getDeclaringClass().getName(), field.getName(),
- PlasticUtils.toTypeName(rawFieldType));
+ String rawTypeName = PlasticUtils.toTypeName(rawFieldType);
+ String containingClassName = field.getDeclaringClass().getName();
+ String fieldName = field.getName();
+
+ if (isStatic(field))
+ {
+ // We've gone to the trouble of loading the root object, or navigated to some other object,
+ // but we don't need or want the instance, since it's a static field we're accessing.
+ // Ideally, we would optimize this, and only generate and invoke the getRoot() and nav() methods as needed, but
+ // access to public fields is relatively rare, and the cost is just the unused bytecode.
+
+ builder.pop();
+
+ builder.getStaticField(containingClassName, fieldName, rawTypeName);
+
+ } else
+ {
+ builder.getField(containingClassName, fieldName, rawTypeName);
+ }
castToGenericType(builder, rawFieldType, fieldType);
}