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

Fix compiler warning msg for a method call from raw type.

XMLWordPrintable

    • generic
    • generic

      For the following example

         String t = "test"
         Class c = t.getClass();
         Class sig[] = new Class[2];
         sig[0] = null;
         sig[1] = null;
         c.getMethod("foo", sig);

      compiler prints the following warning msg:

      warning: [unchecked] unchecked call to getMethod(java.lang.String,java.lang.Class<?>...)
      as a member of the raw type java.lang.Class

      Changing the Class type of "c" to Class<?> removes the warning msg.

      Discussed this with Peter and he said:
      >I don't think the compiler needs to give a warning in this particular
      >case.

            Unassigned Unassigned
            swamyv Swamy Venkataramanappa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: