Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8019340

varargs-related warnings are meaningless on signature-polymorphic methods such as MethodHandle.invokeExact

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • None
    • tools
    • None
    • b100
    • Verified

      Certain warnings are meaningless on signature-polymorphic methods such as MethodHandle.invokeExact.

      Here is an example:

      .../jdk/test/java/lang/invoke/BigArityTest.java:295: warning: non-varargs call of varargs method with inexact argument type for last parameter;
                      r = mh_VA.invokeExact((Integer[])args);
                                            ^
        cast to Object for a varargs call
        cast to Object[] for a non-varargs call and to suppress this warning

      The type Integer[] is defined to be literally present in the bytecode call site descriptor. The suggested changes (cast to Object or cast to Object[]) would presumably be erroneous, since they would change the call site descriptor to one which is incompatible with the specified one.

            mcimadamore Maurizio Cimadamore
            jrose John Rose
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: