DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13108>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13108 unnecessary reflection Summary: unnecessary reflection Product: Commons Version: Nightly Builds Platform: All OS/Version: All Status: NEW Severity: Enhancement Priority: Other Component: JXPath AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hello, I think that in BeanPropertyPointer.java there is an unnecessary use of reflection. If you get a member of a collection then the collection will be fetched twice through reflection. The SimplePathInterpreter.java has the following code : if (index >= 0 && index < pointer.getLength()){ pointer.setIndex(index); return pointer.getValuePointer(); } The pointer.getLength() will set the 'baseValue' in BeanPropertyPointer. The pointer.getValuePointer() will wet the 'value' in BeanPropertyPointer. Both will do reflection. getValuePointer() calls getNode(). getNodeValue() doesn't use the 'baseValue' and I think it can ! So I changed getNode() into : public Object getNode(){ if (value == UNINITIALIZED){ PropertyDescriptor pd = getPropertyDescriptor(); if (pd == null){ value = null; } else { getBaseValue(); if(baseValue != null) { if (index == WHOLE_COLLECTION){ value = baseValue; } else if (index >= 0 && index < getLength()){ value = ValueUtils.getValue(baseValue, index); } } } } return value; } Kees. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
