Lucene code involving MethodHandle is returning odd warnings
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
This is odd. I'm upgrading from a much older version of ProGuard and ProGuard 5.2 is throwing these warnings. They are odd; seems like MethodHandles are not properly parsed/ recognized?
[proguard] Warning: org.apache.lucene.util.AttributeFactory$1: can't find referenced method 'org.apache.lucene.util.AttributeImpl invokeExact()' in library class java.lang.invoke.MethodHandle [proguard] Warning: org.apache.lucene.util.AttributeFactory$DefaultAttributeFactory: can't find referenced method 'org.apache.lucene.util.AttributeImpl invokeExact()' in library class java.lang.invoke.MethodHandle
I think it's polymorphic signatures that are not supported.
http://docs.oracle.com/javase/8/docs/api/java/lang/invoke/MethodHandle.html#sigpoly
A temporary (?) workaround is to add:
-dontwarn java.lang.invoke.MethodHandle
to your config.
Thanks for your report. ProGuard currently indeed treats the polymorphic signature of MethodHandle#invoke/invokeExact like all normal signatures. This may produce warnings, but it should work otherwise. You should use the workaround. Since ProGuard tries to be agnostic of the platform (JSE, JME, Android,...), I'm a bit reluctant to hard-code such an exception.
Hi Eric. This seems to be part of the JLS now (not just a caveat of the runtime library) so I think in the end it should be somehow respected/ recognized out of the box, otherwise you get those cryptic errors that will be very difficult for any non-JVM specialist to figure out. But I understand it's a very low priority.
A duplicate of https://sourceforge.net/p/proguard/bugs/536/