ctubbsii opened a new issue, #2697: URL: https://github.com/apache/accumulo/issues/2697
The CacheEntry class uses a generic method for getIndex to retrieve a Weighable generic type. However, because the generic is on the method, instead of the class, there's no guarantee of retrieving the same Weighable subclass type for repeated calls to the CacheEntry. This forces the calling class to do unnecessary unchecked casts to ensure the result of this method is consistent with the result of a previous call to the same supplier. This could be made much better if the generic type was put on the CacheEntry, so all calls to getIndex for a given CacheEntry instance would return the same Weighable type, and expect a Supplier that is of that same type. The risk here is that this breaks users slightly. With runtime erasure, the generic types wouldn't matter for previously compiled code. It also wouldn't normally matter for newly compiled code... except that the Weighable interface is defined inside the CacheEntry class, and it needs to be moved in order to make the class generic instead of the method. That probably would break somebody. However, even then, it's probably low risk to make breaking changes here to fix this, as I doubt it is common for users to write their own block cache implementations. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
