uschindler commented on a change in pull request #393:
URL: https://github.com/apache/lucene/pull/393#discussion_r731292709



##########
File path: lucene/core/src/java/org/apache/lucene/util/AttributeFactory.java
##########
@@ -148,7 +148,10 @@ public int hashCode() {
       AttributeFactory delegate, Class<A> clazz) {
     final MethodHandle constr = findAttributeImplCtor(clazz);
     return new StaticImplementationAttributeFactory<A>(delegate, clazz) {
+      // UweSays: It's ok. I know why it happens, but it's a bug. The type 
safety is checked by the

Review comment:
       I fixed it. The problem here is worse: it's a bug in ECJ so it compiles 
the wrong signature. It compiles it to bytecode that calls invokeExcat with 
"Object" return code (wrongly guessed). Javac does it correct. To prevent the 
problem I made all casts explcit so the MethodHandle's invokeExact is called 
with 100% correct signature. The unsafe cast is in following line, now marked 
as unsafe (which is fine, as we know the return type).




-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to