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

generics: problem with methods when type parameter doesn't appear in signature

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 1.4.2
    • 5.0
    • tools
    • mantis
    • generic
    • solaris_8

    Description

      class Bug
      {
      public static int fi()
      {
      return fi();
      }

      public static void gi()
      {
      fi();
      gi();
      }

      public static <T> int f()
      {
      return f();
      }

      public static <T> void g()
      {
      f(); // incompatible.types found: <T>int required: java.lang.Object
      int i = f(); // workaround for f()
      g(); // incompatible.types found: <T>void required: java.lang.Object
      }
      // required type looks strange

      public static <T> void h()
      {
      g(); // incompatible.types found: <T>void required: java.lang.Object
      }

      public static <T> int f(T x)
      {
      return f(x);
      }

      public static <T> void g(T x)
      {
      f(x);
      g(x); // incompatible.types found: <T>void required: java.lang.Object
      }

      public static <T> void h(T x)
      {
      g(x); // works fine now; why not in void g(T x)?
      }
      }


      Attachments

        Activity

          People

            gafter Neal Gafter
            gafter Neal Gafter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: