8189981: Improve queuing portability
Reviewed-by: skoivu, rhalade, chegar, igerasim
--- a/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java Fri Jan 26 12:01:08 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java Fri Feb 02 10:56:12 2018 -0800
@@ -51,6 +51,7 @@
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Consumer;
+import jdk.internal.misc.SharedSecrets;
/**
* An unbounded {@linkplain BlockingQueue blocking queue} that uses
@@ -921,7 +922,9 @@
throws java.io.IOException, ClassNotFoundException {
try {
s.defaultReadObject();
- this.queue = new Object[q.size()];
+ int sz = q.size();
+ SharedSecrets.getJavaObjectInputStreamAccess().checkArray(s, Object[].class, sz);
+ this.queue = new Object[sz];
comparator = q.comparator();
addAll(q);
} finally {