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

Exceptions when omitting trailing arguments in cleanup

XMLWordPrintable

      The {@code target} and {@code cleanup} must have the same corresponding argument and return types, except that {@code cleanup} may omit trailing arguments.

      BUT

      1. IllegalArgumentException: bad spread array length
      WHEN
      private static void target(int a1, long a2, Object a3, int b1, long b2, Object b3) {}
      private static void cleanup(Throwable t) {}

      2. WrongMethodTypeException: cannot convert MethodHandle(Throwable,int,long,Object[])void to (Throwable,Object[])void
      WHEN
      private static void target(int a1, long a2, Object a3, int b1, long b2, Object b3) {}
      private static void cleanup(Throwable t, int a1, long a2, Object a3, int b1) {}


            mhaupt Michael Haupt
            kfertikov Kirill Fertikov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: