commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] [bug #12699] TreeSet & PriorityQueue in generics_branch cann


From: Ewout Prangsma
Subject: [commit-cp] [bug #12699] TreeSet & PriorityQueue in generics_branch cannot be compiled with sun's javac.
Date: Sat, 16 Apr 2005 05:28:05 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=12699>

                 Summary: TreeSet & PriorityQueue in generics_branch cannot
be compiled with sun's javac.
                 Project: classpath
            Submitted by: epr
            Submitted on: Sat 04/16/2005 at 05:28
                Category: classpath
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
        Platform Version: None

    _______________________________________________________

Details:

Compiling it with Eclipse 3.1M6 is ok, sun's javac give invalid type errors.

The patches are here:

===================================================================
  RCS file:
/cvsroot/jnode/jnode/core/src/classpath/5.0/java/util/TreeSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TreeSet.java      15 Apr 2005 07:46:57 -0000      1.1
  +++ TreeSet.java      15 Apr 2005 18:52:58 -0000      1.2
  @@ -151,7 +151,7 @@
     {
       Iterator<T> itr;
   
  -    map = new TreeMap<T, String>(sortedSet.comparator());
  +    map = new TreeMap<T, String>((Comparator<? super
T>)sortedSet.comparator());
       itr = ((SortedSet<T>) sortedSet).iterator();
       ((TreeMap<T, String>) map).putKeysLinear(itr, sortedSet.size());
     }
  
  
  
  1.2       +8 -4     
jnode/core/src/classpath/5.0/java/util/PriorityQueue.java
  
  Index: PriorityQueue.java
  ===================================================================
  RCS file:
/cvsroot/jnode/jnode/core/src/classpath/5.0/java/util/PriorityQueue.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PriorityQueue.java        15 Apr 2005 07:46:57 -0000      1.1
  +++ PriorityQueue.java        15 Apr 2005 18:52:58 -0000      1.2
  @@ -76,7 +76,8 @@
       if (c instanceof SortedSet)
         {
        SortedSet<? extends E> ss = (SortedSet<? extends E>) c;
  -     this.comparator = ss.comparator();
  +    // @classpath-bugfix Type mismatch using sun's compiler
  +     this.comparator = (Comparator<? super E>)ss.comparator();
        // We can insert the elements directly, since they are sorted.
        int i = 0;
        for (E val : ss)
  @@ -89,7 +90,8 @@
       else if (c instanceof PriorityQueue)
         {
        PriorityQueue<? extends E> pq = (PriorityQueue<? extends E>) c;
  -     this.comparator = pq.comparator();
  +    // @classpath-bugfix Type mismatch on sun's compiler
  +     this.comparator = (Comparator<? super E>)pq.comparator();
        // We can just copy the contents.
        System.arraycopy(pq.storage, 0, storage, 0, pq.storage.length);
         }
  @@ -111,14 +113,16 @@
   
     public PriorityQueue(PriorityQueue<? extends E> c)
     {
  -    this(Math.max(1, (int) (1.1 * c.size())), c.comparator());
  +      // @classpath-bugfix Type mismatch on sun's compiler
  +    this(Math.max(1, (int) (1.1 * c.size())), (Comparator<? super
E>)c.comparator());
       // We can just copy the contents.
       System.arraycopy(c.storage, 0, storage, 0, c.storage.length);
     }
   
     public PriorityQueue(SortedSet<? extends E> c)
     {
  -    this(Math.max(1, (int) (1.1 * c.size())), c.comparator());
  +      // @classpath-bugfix Type mismatch on sun's compiler
  +    this(Math.max(1, (int) (1.1 * c.size())), (Comparator<? super
E>)c.comparator());
       // We can insert the elements directly, since they are sorted.
       int i = 0;
       for (E val : c)
  
  






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=12699>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]