commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Cumiskey (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OGNL-38) [PATCH] Use StringBuilder instead of StringBuffer, deprecate >=JDK1.5 conditionals and use CONSTANT.equals(variable).
Date Mon, 07 Nov 2011 01:16:51 GMT
[PATCH] Use StringBuilder instead of StringBuffer, deprecate >=JDK1.5 conditionals and use
CONSTANT.equals(variable).
---------------------------------------------------------------------------------------------------------------------

                 Key: OGNL-38
                 URL: https://issues.apache.org/jira/browse/OGNL-38
             Project: OGNL
          Issue Type: Improvement
            Reporter: Adrian Cumiskey
            Priority: Minor
         Attachments: patch-OGNL38.txt

This patch replaces all StringBuffer references with StringBuilder for better performance.
 Improved performance has not been verified but it is fairly well established that StringBuilder
performs better in single threaded use cases (see http://littletutorials.com/2008/07/16/stringbuffer-vs-stringbuilder-performance-comparison/).
 All JDK1.5 checking has also been deprecated/removed since OGNL is now dependent upon >=JDK1.5
these days.  Lastly, all remaining variable.equals(CONSTANT) has been flipped to the null
safe CONSTANT.equals(variable).


A list of modified classes and changes are given here :-

MenuItem: toString() now uses a chained StringBuilder instead of StringBuffer.

StaticsAndConstructorsTest: use StringBuilder instead of StringBuffer.

EnumerationPropertyAccessor: Test CONSTANT.equals(variable).

ExpressionCompiler: Test CONSTANT.equals(variable).

ASTMethod: Variable naming (don't use acronyms), remove OgnlRuntime.isJdk15() check.

OgnlRuntime:
* Remove JDK1.5 checking since OGNL now requires >=JDK1.5.
* The isJdk15() method is now deprecated.
* Variable naming (don't use acronyms.
* getPointerString(int) now uses StringBuilder instead of StringBuffer.
* getUniqueDescriptor(Object, boolean) now uses StringBuilder instead of StringBuffer.
* package private method findType() unused to removed.
* Simplify getMethods(Class<?>,boolean) with ternary.
* getStaticField(OgnlContext,String,String) test CONSTANT.equals(variable) and remove JDK1.5
conditionals.
* A lot of variable naming!

SetPropertyAccessor: Test CONSTANT.equals(variable) and simplify conditionals.

ASTStaticField: Test CONSTANT.equals(variable), remove JDK1.5 conditionals and variable naming.


MapPropertyAccessor: Simplify conditionals.

ArrayPropertyAccessor: Test CONSTANT.equals(variable).

IteratorPropertyAccessor: Test CONSTANT.equals(variable).

OgnlOps: Use StringBuilder instead of StringBuffer.

ognl.jjt: Variable naming, use StringBuilder instead of StringBuffer. Replace new String(stringBuffer)
with stringBuffer.toString().

Cheers, Adrian.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message