Collections.checkedQueue() offer method should not call add.

Jason Mehrens jason_mehrens at hotmail.com
Mon Oct 31 18:08:18 UTC 2011


Darryl,
 
CheckedQueue.offer should call 'this.queue.offer' instead of 'this.add'.  If you pass a Queue with bounded capacity (ArrayBlockingQueue) the CQ.offer method should return false when the queue is full but will instead throw an IllegalStateException.  The current version also is performing the type check twice.
 
Jason
 
 
Changeset: c5c91589b126
Author:    mduigou
Date:      2011-10-19 14:17 -0700
URL:       http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c5c91589b126

5029031: Add Collections.checkedQueue()
Reviewed-by: mduigou
Contributed-by: darryl.mocek at oracle.com

! src/share/classes/java/util/Collections.java
+ test/java/util/Collections/CheckedQueue.java

 		 	   		  


More information about the core-libs-dev mailing list