提交 87e68933 编写于 作者: I igerasim

8189981: Improve queuing portability

Reviewed-by: skoivu, rhalade, chegar, igerasim
上级 c5cfbd7d
...@@ -48,6 +48,7 @@ import java.util.Queue; ...@@ -48,6 +48,7 @@ import java.util.Queue;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.Spliterator; import java.util.Spliterator;
import java.util.function.Consumer; import java.util.function.Consumer;
import sun.misc.SharedSecrets;
/** /**
* An unbounded {@linkplain BlockingQueue blocking queue} that uses * An unbounded {@linkplain BlockingQueue blocking queue} that uses
...@@ -940,7 +941,9 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E> ...@@ -940,7 +941,9 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
throws java.io.IOException, ClassNotFoundException { throws java.io.IOException, ClassNotFoundException {
try { try {
s.defaultReadObject(); s.defaultReadObject();
this.queue = new Object[q.size()]; int sz = q.size();
SharedSecrets.getJavaOISAccess().checkArray(s, Object[].class, sz);
this.queue = new Object[sz];
comparator = q.comparator(); comparator = q.comparator();
addAll(q); addAll(q);
} finally { } finally {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册