[prev in list] [next in list] [prev in thread] [next in thread]
List: velocity-dev
Subject: [jira] Commented: (VELOCITY-453) [PATCH] Fix IntrospectionCacheData
From: "Alexey Panchenko (JIRA)" <jira () apache ! org>
Date: 2006-09-28 8:44:51
Message-ID: 13872584.1159433091325.JavaMail.jira () brutus
[Download RAW message or body]
[ http://issues.apache.org/jira/browse/VELOCITY-453?page=comments#action_12438373 \
]
Alexey Panchenko commented on VELOCITY-453:
-------------------------------------------
The hash function could be as follows
public int hashCode()
{
int result = 17;
for (int i = 0; i < params.length; ++i)
{
final Class param = params[i];
if (param != null)
{
result = result * 37 + param.hashCode();
}
}
return result * 37 + methodName.hashCode();
}
17 and 37 are used in HashCodeBuilder by default.
> [PATCH] Fix IntrospectionCacheData caching
> ------------------------------------------
>
> Key: VELOCITY-453
> URL: http://issues.apache.org/jira/browse/VELOCITY-453
> Project: Velocity
> Issue Type: Bug
> Components: Source
> Affects Versions: 1.5
> Reporter: Alexey Panchenko
> Assigned To: Will Glass-Husain
> Fix For: 1.5
>
> Attachments: ASTMethod.java.patch2006-09-28, \
> ASTMethod_IntrospectionCacheData_cache, \
> ASTMethod_IntrospectionCacheData_cache-v2-retry.patch, \
> ASTMethod_IntrospectionCacheData_cache-v2.patch, \
> IntrospectionCacheDataTest-no-copyright.java, \
> IntrospectionCacheDataTest-no-copyright.java, IntrospectionCacheDataTest-v4.java, \
> IntrospectionCacheDataTest.java
>
> The old code used Class[].hashCode() in MethodCacheKey.hashCode() implementation.
> hashCode() is not overriden for arrays so it returns different value for each array \
> instance. The attached is the correct implementation and a test case to prove the \
> caching actually works.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: \
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic