Fix bug in PropertyValuesHolder_Delegate method index

The method index in PropertyValuesHolder was using only the method name
+ the number of parameters in the call to index the different properties
methods. This worked ok most of the time because, for a given method
name (let's say setTrimStartOffset), the class is usually the same.
However, if the same method name is used in multiple classes, this will
cause collisions and will most likely crash.

Change-Id: Ie6fa8872c5c5e69e690f4f1bb79191a31bef2a28
This commit is contained in:
Diego Perez
2016-01-19 10:42:19 +00:00
parent b9c48d8f49
commit ada8c117b1

View File

@@ -64,7 +64,8 @@ class PropertyValuesHolder_Delegate {
private static long registerMethod(Class<?> targetClass, String methodName, Class[] types,
int nArgs) {
// Encode the number of arguments in the method name
String methodIndexName = String.format("%1$s#%2$d", methodName, nArgs);
String methodIndexName = String.format("%1$s.%2$s#%3$d", targetClass.getSimpleName(),
methodName, nArgs);
synchronized (sMethodIndexLock) {
Long methodId = METHOD_NAME_TO_ID.get(methodIndexName);