incorrect warning on call of variable-arity method (b49)

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • None
    • Affects Version/s: 5.0
    • Component/s: tools
    • None
    • generic
    • generic

      With b49, the following example:

      public class Foo {
          Class<?>[] get() { return null; }

          void set(Class... c) { }

          void test() {
      set(get());
          }
      }

      results in

      Foo.java:7: warning: fixed-arity call of variable-arity method with inexact match for last parameter;
      cast to java.lang.Class for a variable-arity call
      cast to java.lang.Class[] for a fixed-arity call
      set(get());
                     ^
      1 warning

      Suggesting a cast from Class<?>[] to Class makes no sense. The ambiguity in this call is not obvious to me.

            Assignee:
            Neal Gafter (Inactive)
            Reporter:
            Bob Scheifler (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: