spotify / missinglink

Build time tool for detecting link problems in java projects
Apache License 2.0
146 stars 27 forks source link

False error on a method with the polymorphic signature #55

Closed plokhotnyuk closed 3 years ago

plokhotnyuk commented 5 years ago

Got the following error when checking using the sbt-missinglink plugin:

[error] Category: Method being called not found
[error]   In artifact: scala-library-2.13.0.jar
[error]     In class: scala.runtime.Statics
[error]       In method:  releaseFence():148
[error]       Call to: java.lang.invoke.MethodHandle.invoke()
[error]       Problem: Method not found: java.lang.invoke.MethodHandle.invoke()
[error]       Found in: rt.jar
[error]       --------
[error] there were conflicts
[error] (jsoniter-scala-core / Compile / missinglinkCheck) there were conflicts
spkrka commented 5 years ago

I tried looking at the caller: https://github.com/scala/scala/blob/2.13.x/src/library/scala/runtime/Statics.java

And the target: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/invoke/MethodHandle.html#invoke(java.lang.Object...)

The caller is doing: VM.RELEASE_FENCE.invoke(); which should be compiled to the vararg method.

Running javap on the Statics class gives:

  public static void releaseFence() throws java.lang.Throwable;
    Code:
       0: getstatic     #25                 // Field scala/runtime/Statics$VM.RELEASE_FENCE:Ljava/lang/invoke/MethodHandle;
       3: invokevirtual #26                 // Method java/lang/invoke/MethodHandle.invoke:()V
       6: return

So yes, this seems like a bug. I think the correct fix is that vararg methods should match calls that look like either: