Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8025535

Unsafe typecast in java.util.stream.SortedOps

XMLWordPrintable

      Unsafe typecast long to int:

      private static final class RefSortingSink<T> extends Sink.ChainedReference<T, T> {
          public void begin(long size) {
              list = (size >= 0) ? new ArrayList<T>((int) size) : new ArrayList<T>();
          }
          ...........
      private static final class IntSortingSink extends Sink.ChainedInt<Integer> {
          public void begin(long size) {
              b = (size > 0) ? new SpinedBuffer.OfInt((int) size) : new SpinedBuffer.OfInt();
          }
          ...........
      private static final class LongSortingSink extends Sink.ChainedLong<Long> {
          public void begin(long size) {
              b = (size > 0) ? new SpinedBuffer.OfLong((int) size) : new SpinedBuffer.OfLong();
          }
          ...........
      private static final class DoubleSortingSink extends Sink.ChainedDouble<Double> {
          public void begin(long size) {
              b = (size > 0) ? new SpinedBuffer.OfDouble((int) size) : new SpinedBuffer.OfDouble();
          }
       

            psandoz Paul Sandoz
            ogb Oleg Barbashov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: