You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/10/18 20:29:08 UTC

[GitHub] [lucene] uschindler commented on a change in pull request #393: LUCENE-10185: pass --release 11 to ECJ linter, fix JDK 17 build

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-unsubscribe@lucene.apache.org

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



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