Fix compilation issue due to jdk bug Inference fails for type variable return constraint, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954

This commit is contained in:
Eric Charles 2012-02-20 10:28:40 +01:00
parent c5582a14b8
commit bb6d140220

View File

@ -612,6 +612,7 @@ public class LegacyLinkedTransferQueue<E> extends AbstractQueue<E>
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
static <E> E cast(Object item) { static <E> E cast(Object item) {
// assert item == null || item.getClass() != Node.class; // assert item == null || item.getClass() != Node.class;
// Explicit cast, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954
return (E) item; return (E) item;
} }
@ -653,7 +654,8 @@ public class LegacyLinkedTransferQueue<E> extends AbstractQueue<E>
} }
} }
LockSupport.unpark(p.waiter); LockSupport.unpark(p.waiter);
return LegacyLinkedTransferQueue.cast(item); // Explicit cast, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954
return (E) LegacyLinkedTransferQueue.cast(item);
} }
} }
Node n = p.next; Node n = p.next;
@ -737,7 +739,8 @@ public class LegacyLinkedTransferQueue<E> extends AbstractQueue<E>
if (item != e) { // matched if (item != e) { // matched
// assert item != s; // assert item != s;
s.forgetContents(); // avoid garbage s.forgetContents(); // avoid garbage
return LegacyLinkedTransferQueue.cast(item); // Explicit cast, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954
return (E) LegacyLinkedTransferQueue.cast(item);
} }
if ((w.isInterrupted() || timed && nanos <= 0) && if ((w.isInterrupted() || timed && nanos <= 0) &&
s.casItem(e, s)) { // cancel s.casItem(e, s)) { // cancel
@ -825,7 +828,8 @@ public class LegacyLinkedTransferQueue<E> extends AbstractQueue<E>
Object item = p.item; Object item = p.item;
if (p.isData) { if (p.isData) {
if (item != null && item != p) { if (item != null && item != p) {
return LegacyLinkedTransferQueue.cast(item); // Explicit cast, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954
return (E) LegacyLinkedTransferQueue.cast(item);
} }
} }
else if (item == null) { else if (item == null) {
@ -878,7 +882,8 @@ public class LegacyLinkedTransferQueue<E> extends AbstractQueue<E>
Object item = p.item; Object item = p.item;
if (p.isData) { if (p.isData) {
if (item != null && item != p) { if (item != null && item != p) {
nextItem = LegacyLinkedTransferQueue.cast(item); // Explicit cast, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954
nextItem = (E) LegacyLinkedTransferQueue.cast(item);
nextNode = p; nextNode = p;
return; return;
} }