Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      FULL PRODUCT VERSION :
      1.5.0
      1.6.0

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP (5.1.2600)
      Linux 2.6.16.13-4-smp

      A DESCRIPTION OF THE PROBLEM :
      Having a class with following two static methods:

      1. public static <T> List<T> notWorking(StaticClass<T> subject, T object);
      2. public static <T> List<T> notWorking(StaticClass<T> subject, Collection<T> objects);

      Calling method 2 with any typed collection will report an message that the call target is ambigous. Example is attached.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Method 2 should be the only call target

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      StaticClass.java:18: reference to notWorking is ambiguous, both method <T>notWorking(StaticClass<T>,T) in StaticClass and method <T>notWorking(StaticClass<T>,java.util.Collection<T>) in StaticClass match
              List<Object> notworkinglist = StaticClass.notWorking(subject, objects);
                                                       
      1 error

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Collection;
      import java.util.List;

      public class StaticClass<A extends Object> {

          public static <T> List<T> notWorking(StaticClass<T> subject, T object) {
              return null;
          }

          public static <T> List<T> notWorking(StaticClass<T> subject, Collection<T> objects) {
              return null;
          }
          
          public static void example(StaticClass<Object> subject, Collection<Object> objects) {
              List workinglist = StaticClass.working(subject, objects);
              List<Object> notworkinglist = StaticClass.notWorking(subject, objects);
          }
          
          public static List working(StaticClass subject, Object object) {
              return null;
          }

          public static List working(StaticClass subject, Collection objects) {
              return null;
          }
          
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Renaming of the methods or using non-generic methods.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: