changeset 7532:3e50294c68ea

- ensure constructors of private inner classes are package private - ensure classes, where appropriate, are marked as final. - misc cleanups for access of classes and fields.
author psandoz
date Mon, 25 Feb 2013 18:11:42 +0100
parents e343f811b2b4
children 6dbfee22c2ff
files src/share/classes/java/util/stream/AbstractPipeline.java src/share/classes/java/util/stream/AbstractSpinedBuffer.java src/share/classes/java/util/stream/Collector.java src/share/classes/java/util/stream/Collectors.java src/share/classes/java/util/stream/ConcurrentCollectors.java src/share/classes/java/util/stream/DistinctOp.java src/share/classes/java/util/stream/DoublePipeline.java src/share/classes/java/util/stream/FindOp.java src/share/classes/java/util/stream/ForEachOp.java src/share/classes/java/util/stream/IntPipeline.java src/share/classes/java/util/stream/LongPipeline.java src/share/classes/java/util/stream/MatchOp.java src/share/classes/java/util/stream/Node.java src/share/classes/java/util/stream/NodeUtils.java src/share/classes/java/util/stream/Nodes.java src/share/classes/java/util/stream/ReduceOp.java src/share/classes/java/util/stream/Sink.java src/share/classes/java/util/stream/SliceOp.java src/share/classes/java/util/stream/SortedOp.java src/share/classes/java/util/stream/SpinedBuffer.java src/share/classes/java/util/stream/StreamSpliterators.java src/share/classes/java/util/stream/Streams.java src/share/classes/java/util/stream/TerminalOp.java src/share/classes/java/util/stream/Tripwire.java
diffstat 24 files changed, 346 insertions(+), 327 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/AbstractPipeline.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/AbstractPipeline.java	Mon Feb 25 18:11:42 2013 +0100
@@ -470,7 +470,7 @@
         public Sink<T> wrapSink(int flags, Sink sink);
     }
 
-    static class StatelessOp<T,U> implements IntermediateOp<T,U> {
+    static final class StatelessOp<T,U> implements IntermediateOp<T,U> {
         private final int opFlags;
         private final StreamShape inputShape, outputShape;
         private final SinkWrapper<T> sinkWrapper;
@@ -500,7 +500,10 @@
         }
     }
 
-    abstract class UpstreamSpliteratorSupplier<T> implements Supplier<Spliterator<T>> {
+    private abstract class UpstreamSpliteratorSupplier<T> implements Supplier<Spliterator<T>> {
+
+        UpstreamSpliteratorSupplier() {} // Avoid creation of special accessor
+
         @Override
         public Spliterator<T> get() {
             // This may occur when a spliterator is obtained for a pipeline of zero depth
@@ -510,7 +513,9 @@
         abstract Spliterator<T> get(PipelineHelperImpl downstream);
     }
 
-    abstract class NodeSpliteratorSupplier<T> extends UpstreamSpliteratorSupplier<T> {
+    private abstract class NodeSpliteratorSupplier<T> extends UpstreamSpliteratorSupplier<T> {
+
+        NodeSpliteratorSupplier() {} // Avoid creation of special accessor
 
         @Override
         public Spliterator<T> get(PipelineHelperImpl downstream) {
@@ -520,15 +525,15 @@
         abstract Node<T> getNode(PipelineHelperImpl downstream);
     }
 
-    class PipelineHelperImpl<P_IN> implements PipelineHelper<P_IN, E_OUT> {
-        final int terminalFlags;
-        final int streamAndOpFlags;
-        final IntFunction<E_OUT[]> generator;
+    private final class PipelineHelperImpl<P_IN> implements PipelineHelper<P_IN, E_OUT> {
+        private final int terminalFlags;
+        private final int streamAndOpFlags;
+        private final IntFunction<E_OUT[]> generator;
 
         // Source spliterator
-        Spliterator<P_IN> spliterator;
+        private Spliterator<P_IN> spliterator;
 
-        private PipelineHelperImpl(int terminalFlags, IntFunction<E_OUT[]> generator) {
+        PipelineHelperImpl(int terminalFlags, IntFunction<E_OUT[]> generator) {
             // If a sequential pipeline then unset the clearing of ORDERED
             // @@@ Should a general mask be used e.g. TERMINAL_OP_SEQUENTIAL_MASK
             this.terminalFlags = isParallel() ? terminalFlags : terminalFlags & ~StreamOpFlag.ORDERED.clear();
--- a/src/share/classes/java/util/stream/AbstractSpinedBuffer.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/AbstractSpinedBuffer.java	Mon Feb 25 18:11:42 2013 +0100
@@ -59,7 +59,7 @@
     /**
      * @param initialCapacity The minimum expected number of elements
      */
-    public AbstractSpinedBuffer(int initialCapacity) {
+    protected AbstractSpinedBuffer(int initialCapacity) {
         if (initialCapacity < 0)
             throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity);
 
--- a/src/share/classes/java/util/stream/Collector.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/Collector.java	Mon Feb 25 18:11:42 2013 +0100
@@ -70,7 +70,7 @@
 
         @Override
         default BiConsumer<R, Integer> accumulator() {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Collector.OfInt.accumulator()");
             return (r, i) -> intAccumulator().accept(r, i);
         }
@@ -81,7 +81,7 @@
 
         @Override
         default BiConsumer<R, Long> accumulator() {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Collector.OfLong.accumulator()");
             return (r, l) -> longAccumulator().accept(r, l);
         }
@@ -92,7 +92,7 @@
 
         @Override
         default BiConsumer<R, Double> accumulator() {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Collector.OfDouble.accumulator()");
             return (r, d) -> doubleAccumulator().accept(r, d);
         }
--- a/src/share/classes/java/util/stream/Collectors.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/Collectors.java	Mon Feb 25 18:11:42 2013 +0100
@@ -58,7 +58,10 @@
  * Collectors
  * @since 1.8
  */
-public class Collectors {
+public final class Collectors {
+
+    private Collectors() {}
+
     public static<T> BinaryOperator<T> throwingMerger() {
         return (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); };
     }
@@ -93,7 +96,7 @@
         }
     }
 
-    static class CollectorImpl<T, R> extends AbstractCollectorImpl<R> implements Collector<T, R> {
+    static final class CollectorImpl<T, R> extends AbstractCollectorImpl<R> implements Collector<T, R> {
         private final BiConsumer<R, T> accumulator;
 
         CollectorImpl(Supplier<R> resultSupplier,
@@ -114,7 +117,7 @@
         }
     }
 
-    static class IntCollectorImpl<R> extends AbstractCollectorImpl<R> implements Collector.OfInt<R> {
+    static final class IntCollectorImpl<R> extends AbstractCollectorImpl<R> implements Collector.OfInt<R> {
         private final ObjIntConsumer<R> intAccumulator;
 
         IntCollectorImpl(Supplier<R> resultSupplier,
@@ -135,7 +138,7 @@
         }
     }
 
-    static class DoubleCollectorImpl<R> extends AbstractCollectorImpl<R> implements Collector.OfDouble<R> {
+    static final class DoubleCollectorImpl<R> extends AbstractCollectorImpl<R> implements Collector.OfDouble<R> {
         private final ObjDoubleConsumer<R> doubleAccumulator;
 
         DoubleCollectorImpl(Supplier<R> resultSupplier,
@@ -156,7 +159,7 @@
         }
     }
 
-    static class LongCollectorImpl<R> extends AbstractCollectorImpl<R> implements Collector.OfLong<R> {
+    static final class LongCollectorImpl<R> extends AbstractCollectorImpl<R> implements Collector.OfLong<R> {
         private final ObjLongConsumer<R> longAccumulator;
 
         LongCollectorImpl(Supplier<R> resultSupplier,
@@ -333,7 +336,7 @@
         return new CollectorImpl<>(mapSupplier, accumulator, leftMapMerger(mergeFunction));
     }
 
-    static class Partition<T> extends AbstractMap<Boolean, T> implements Map<Boolean, T> {
+    static final class Partition<T> extends AbstractMap<Boolean, T> implements Map<Boolean, T> {
         T forTrue;
         T forFalse;
 
@@ -342,7 +345,7 @@
             this.forFalse = forFalse;
         }
 
-        class Entry implements Map.Entry<Boolean, T> {
+        final class Entry implements Map.Entry<Boolean, T> {
             private final int state;
 
             Entry(int state) {
--- a/src/share/classes/java/util/stream/ConcurrentCollectors.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/ConcurrentCollectors.java	Mon Feb 25 18:11:42 2013 +0100
@@ -42,7 +42,10 @@
  *
  * @since 1.8
  */
-public class ConcurrentCollectors {
+public final class ConcurrentCollectors {
+
+    private ConcurrentCollectors() {}
+
     public static <T, K>
     Collector<T, ConcurrentMap<K, Collection<T>>> groupingBy(Function<? super T, ? extends K> classifier) {
         return groupingBy(classifier, ConcurrentHashMap::new, ArrayList::new);
--- a/src/share/classes/java/util/stream/DistinctOp.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/DistinctOp.java	Mon Feb 25 18:11:42 2013 +0100
@@ -36,7 +36,7 @@
  * @param <T> The input and output type of the stream pipeline
  * @since 1.8
  */
-class DistinctOp<T> implements StatefulOp<T> {
+final class DistinctOp<T> implements StatefulOp<T> {
     @Override
     public int getOpFlags() {
         return StreamOpFlag.IS_DISTINCT | StreamOpFlag.NOT_SIZED;
--- a/src/share/classes/java/util/stream/DoublePipeline.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/DoublePipeline.java	Mon Feb 25 18:11:42 2013 +0100
@@ -110,7 +110,7 @@
             return (DoubleConsumer) sink;
         }
         else {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(AbstractPipeline.class, "using DoubleStream.adapt(Sink<Double> s)");
             return sink::accept;
         }
@@ -131,7 +131,7 @@
             return (Spliterator.OfDouble) s;
         }
         else {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(AbstractPipeline.class, "using DoubleStream.adapt(Spliterator<Double> s)");
             throw new UnsupportedOperationException("DoubleStream.adapt(Spliterator<Double> s)");
         }
--- a/src/share/classes/java/util/stream/FindOp.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/FindOp.java	Mon Feb 25 18:11:42 2013 +0100
@@ -38,7 +38,7 @@
  * @param <O> The result type of the find operation, typically an optional type
  * @since 1.8
  */
-class FindOp<T, O> implements TerminalOp<T, O> {
+final class FindOp<T, O> implements TerminalOp<T, O> {
 
     /**
      * Construct a {@code FindOp} for streams of objects
@@ -84,10 +84,12 @@
      * @param <T> The type of input element
      * @param <O> The result type, typically an optional type
      */
-    static abstract class FindSink<T, O> implements TerminalSink<T, O> {
+    private static abstract class FindSink<T, O> implements TerminalSink<T, O> {
         boolean hasValue;
         T value;
 
+        FindSink() {} // Avoid creation of special accessor
+
         @Override
         public void accept(T value) {
             if (!hasValue) {
@@ -102,7 +104,7 @@
         }
 
         /** Specialization of {@code FindSink} for reference streams */
-        static class OfRef<T> extends FindSink<T, Optional<T>> {
+        static final class OfRef<T> extends FindSink<T, Optional<T>> {
             @Override
             public Optional<T> get() {
                 return hasValue ? Optional.of(value) : null;
@@ -110,7 +112,7 @@
         }
 
         /** Specialization of {@code FindSink} for int streams */
-        static class OfInt extends FindSink<Integer, OptionalInt> implements Sink.OfInt {
+        static final class OfInt extends FindSink<Integer, OptionalInt> implements Sink.OfInt {
             @Override
             public void accept(int value) {
                 // Boxing is OK here, since few values will actually flow into the sink
@@ -124,7 +126,7 @@
         }
 
         /** Specialization of {@code FindSink} for long streams */
-        static class OfLong extends FindSink<Long, OptionalLong> implements Sink.OfLong {
+        static final class OfLong extends FindSink<Long, OptionalLong> implements Sink.OfLong {
             @Override
             public void accept(long value) {
                 // Boxing is OK here, since few values will actually flow into the sink
@@ -138,7 +140,7 @@
         }
 
         /** Specialization of {@code FindSink} for double streams */
-        static class OfDouble extends FindSink<Double, OptionalDouble> implements Sink.OfDouble {
+        static final class OfDouble extends FindSink<Double, OptionalDouble> implements Sink.OfDouble {
             @Override
             public void accept(double value) {
                 // Boxing is OK here, since few values will actually flow into the sink
@@ -205,15 +207,15 @@
      * @param <T> Output element type from the stream pipeline
      * @param <O> Result type from the find operation
      */
-    private static class FindTask<S, T, O> extends AbstractShortCircuitTask<S, T, O, FindTask<S, T, O>> {
+    private static final class FindTask<S, T, O> extends AbstractShortCircuitTask<S, T, O, FindTask<S, T, O>> {
         private final FindOp<T, O> op;
 
-        private FindTask(PipelineHelper<S, T> helper, FindOp<T, O> op) {
+        FindTask(PipelineHelper<S, T> helper, FindOp<T, O> op) {
             super(helper);
             this.op = op;
         }
 
-        private FindTask(FindTask<S, T, O> parent, Spliterator<S> spliterator) {
+        FindTask(FindTask<S, T, O> parent, Spliterator<S> spliterator) {
             super(parent, spliterator);
             this.op = parent.op;
         }
--- a/src/share/classes/java/util/stream/ForEachOp.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/ForEachOp.java	Mon Feb 25 18:11:42 2013 +0100
@@ -54,20 +54,20 @@
     }
 
     /** Specialization of {@code TerminalSink} with void result */
-    protected interface VoidTerminalSink<T> extends TerminalSink<T, Void> {
+    interface VoidTerminalSink<T> extends TerminalSink<T, Void> {
         @Override
-        default public Void get() {
+        default Void get() {
             return null;
         }
 
         /** Specialization of {@code TerminalSink} and {@code Sink.OfInt} with void result */
-        public interface OfInt extends VoidTerminalSink<Integer>, Sink.OfInt { }
+        interface OfInt extends VoidTerminalSink<Integer>, Sink.OfInt { }
 
         /** Specialization of {@code TerminalSink} and {@code Sink.OfLong} with void result */
-        public interface OfLong extends VoidTerminalSink<Long>, Sink.OfLong { }
+        interface OfLong extends VoidTerminalSink<Long>, Sink.OfLong { }
 
         /** Specialization of {@code TerminalSink} and {@code Sink.OfDouble} with void result */
-        public interface OfDouble extends VoidTerminalSink<Double>, Sink.OfDouble { }
+        interface OfDouble extends VoidTerminalSink<Double>, Sink.OfDouble { }
     }
 
     /**
@@ -134,7 +134,7 @@
         private final PipelineHelper<S, T> helper;
         private final long targetSize;
 
-        private ForEachTask(PipelineHelper<S, T> helper, Sink<S> sink) {
+        ForEachTask(PipelineHelper<S, T> helper, Sink<S> sink) {
             super(null);
             this.spliterator = helper.sourceSpliterator();
             this.sink = sink;
@@ -142,7 +142,7 @@
             this.helper = helper;
         }
 
-        private ForEachTask(ForEachTask<S, T> parent, Spliterator<S> spliterator) {
+        ForEachTask(ForEachTask<S, T> parent, Spliterator<S> spliterator) {
             super(parent);
             this.spliterator = spliterator;
             this.sink = parent.sink;
--- a/src/share/classes/java/util/stream/IntPipeline.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/IntPipeline.java	Mon Feb 25 18:11:42 2013 +0100
@@ -109,7 +109,7 @@
             return (IntConsumer) sink;
         }
         else {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(AbstractPipeline.class, "using IntStream.adapt(Sink<Integer> s)");
             return sink::accept;
         }
@@ -130,7 +130,7 @@
             return (Spliterator.OfInt) s;
         }
         else {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(AbstractPipeline.class, "using IntStream.adapt(Spliterator<Integer> s)");
             throw new UnsupportedOperationException("IntStream.adapt(Spliterator<Integer> s)");
         }
--- a/src/share/classes/java/util/stream/LongPipeline.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/LongPipeline.java	Mon Feb 25 18:11:42 2013 +0100
@@ -110,7 +110,7 @@
             return (LongConsumer) sink;
         }
         else {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(AbstractPipeline.class, "using LongStream.adapt(Sink<Long> s)");
             return sink::accept;
         }
@@ -131,7 +131,7 @@
             return (Spliterator.OfLong) s;
         }
         else {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(AbstractPipeline.class, "using LongStream.adapt(Spliterator<Long> s)");
             throw new UnsupportedOperationException("LongStream.adapt(Spliterator<Long> s)");
         }
--- a/src/share/classes/java/util/stream/MatchOp.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/MatchOp.java	Mon Feb 25 18:11:42 2013 +0100
@@ -38,7 +38,7 @@
  * @param <T> The output type of the stream pipeline
  * @since 1.8
  */
-class MatchOp<T> implements TerminalOp<T, Boolean> {
+final class MatchOp<T> implements TerminalOp<T, Boolean> {
     private final StreamShape inputShape;
     protected final MatchKind matchKind;
     protected final Supplier<BooleanTerminalSink<T>> sinkSupplier;
@@ -64,10 +64,10 @@
      * @param <T> The output type of the stream pipeline
      */
     private static abstract class BooleanTerminalSink<T> implements Sink<T> {
-        protected boolean stop;
-        protected boolean value;
+        boolean stop;
+        boolean value;
 
-        protected BooleanTerminalSink(MatchKind matchKind) {
+        BooleanTerminalSink(MatchKind matchKind) {
             value = !matchKind.shortCircuitResult;
         }
 
@@ -90,8 +90,7 @@
      */
     public static <T> MatchOp<T> match(Predicate<? super T> predicate, MatchKind matchKind) {
         class MatchSink extends BooleanTerminalSink<T> {
-
-            private MatchSink() {
+            MatchSink() {
                 super(matchKind);
             }
 
@@ -122,7 +121,7 @@
      */
     public static MatchOp<Integer> match(IntPredicate predicate, MatchKind matchKind) {
         class MatchSink extends BooleanTerminalSink<Integer> implements Sink.OfInt {
-            private MatchSink() {
+            MatchSink() {
                 super(matchKind);
             }
 
@@ -151,7 +150,7 @@
     public static MatchOp<Long> match(LongPredicate predicate, MatchKind matchKind) {
         class MatchSink extends BooleanTerminalSink<Long> implements Sink.OfLong {
 
-            private MatchSink() {
+            MatchSink() {
                 super(matchKind);
             }
 
@@ -180,7 +179,7 @@
     public static MatchOp<Double> match(DoublePredicate predicate, MatchKind matchKind) {
         class MatchSink extends BooleanTerminalSink<Double> implements Sink.OfDouble {
 
-            private MatchSink() {
+            MatchSink() {
                 super(matchKind);
             }
 
@@ -234,12 +233,12 @@
     private static class MatchTask<S, T> extends AbstractShortCircuitTask<S, T, Boolean, MatchTask<S, T>> {
         private final MatchOp<T> op;
 
-        private MatchTask(MatchOp<T> op, PipelineHelper<S, T> helper) {
+        MatchTask(MatchOp<T> op, PipelineHelper<S, T> helper) {
             super(helper);
             this.op = op;
         }
 
-        private MatchTask(MatchTask<S, T> parent, Spliterator<S> spliterator) {
+        MatchTask(MatchTask<S, T> parent, Spliterator<S> spliterator) {
             super(parent, spliterator);
             this.op = parent.op;
         }
@@ -266,7 +265,7 @@
     /**
      * Enum describing quantified match options -- all match, any match, none match
      */
-    public enum MatchKind {
+    enum MatchKind {
         /** Do all elements match the predicate? */
         ANY(true, true),
 
--- a/src/share/classes/java/util/stream/Node.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/Node.java	Mon Feb 25 18:11:42 2013 +0100
@@ -184,7 +184,7 @@
                 forEach((IntConsumer) consumer);
             }
             else {
-                if (Tripwire.enabled)
+                if (Tripwire.ENABLED)
                     Tripwire.trip(getClass(), "{0} calling Node.OfInt.forEach(Consumer)");
                 spliterator().forEach(consumer);
             }
@@ -219,7 +219,7 @@
          */
         @Override
         default void copyInto(Integer[] boxed, int offset) {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Node.OfInt.copyInto(Integer[], int)");
 
             int[] array = asIntArray();
@@ -286,7 +286,7 @@
                 forEach((LongConsumer) consumer);
             }
             else {
-                if (Tripwire.enabled)
+                if (Tripwire.ENABLED)
                     Tripwire.trip(getClass(), "{0} calling Node.OfLong.forEach(Consumer)");
                 spliterator().forEach(consumer);
             }
@@ -321,7 +321,7 @@
          */
         @Override
         default void copyInto(Long[] boxed, int offset) {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Node.OfInt.copyInto(Long[], int)");
 
             long[] array = asLongArray();
@@ -388,7 +388,7 @@
                 forEach((DoubleConsumer) consumer);
             }
             else {
-                if (Tripwire.enabled)
+                if (Tripwire.ENABLED)
                     Tripwire.trip(getClass(), "{0} calling Node.OfLong.forEach(Consumer)");
                 spliterator().forEach(consumer);
             }
@@ -425,7 +425,7 @@
          */
         @Override
         default void copyInto(Double[] boxed, int offset) {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Node.OfDouble.copyInto(Double[], int)");
 
             double[] array = asDoubleArray();
--- a/src/share/classes/java/util/stream/NodeUtils.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/NodeUtils.java	Mon Feb 25 18:11:42 2013 +0100
@@ -300,15 +300,15 @@
 
     // Reference implementations
 
-    private static class CollectorTask<T, U> extends AbstractTask<T, U, Node<U>, CollectorTask<T, U>> {
+    private static final class CollectorTask<T, U> extends AbstractTask<T, U, Node<U>, CollectorTask<T, U>> {
         private final PipelineHelper<T, U> helper;
 
-        private CollectorTask(PipelineHelper<T, U> helper) {
+        CollectorTask(PipelineHelper<T, U> helper) {
             super(helper);
             this.helper = helper;
         }
 
-        private CollectorTask(CollectorTask<T, U> parent, Spliterator<T> spliterator) {
+        CollectorTask(CollectorTask<T, U> parent, Spliterator<T> spliterator) {
             super(parent, spliterator);
             helper = parent.helper;
         }
@@ -339,7 +339,7 @@
         }
     }
 
-    private static class SizedCollectorTask<T, U> extends CountedCompleter<Void> {
+    private static final class SizedCollectorTask<T, U> extends CountedCompleter<Void> {
         private final Spliterator<T> spliterator;
         private final PipelineHelper<T, U> helper;
         private final U[] array;
@@ -347,7 +347,7 @@
         private long offset;
         private long length;
 
-        private SizedCollectorTask(Spliterator<T> spliterator, PipelineHelper<T, U> helper, U[] array) {
+        SizedCollectorTask(Spliterator<T> spliterator, PipelineHelper<T, U> helper, U[] array) {
             assert spliterator.hasCharacteristic(Spliterator.SUBSIZED);
             this.spliterator = spliterator;
             this.helper = helper;
@@ -357,7 +357,7 @@
             this.length = array.length;
         }
 
-        private SizedCollectorTask(SizedCollectorTask<T, U> parent, Spliterator<T> spliterator, long offset, long length) {
+        SizedCollectorTask(SizedCollectorTask<T, U> parent, Spliterator<T> spliterator, long offset, long length) {
             super(parent);
             assert spliterator.hasCharacteristic(Spliterator.SUBSIZED);
             this.spliterator = spliterator;
@@ -392,18 +392,18 @@
         }
     }
 
-    private static class ToArrayTask<T> extends CountedCompleter<Void> {
+    private static final class ToArrayTask<T> extends CountedCompleter<Void> {
         private final T[] array;
         private final Node<T> node;
         private final int offset;
 
-        private ToArrayTask(Node<T> node, T[] array, int offset) {
+        ToArrayTask(Node<T> node, T[] array, int offset) {
             this.array = array;
             this.node = node;
             this.offset = offset;
         }
 
-        private ToArrayTask(ToArrayTask<T> parent, Node<T> node, int offset) {
+        ToArrayTask(ToArrayTask<T> parent, Node<T> node, int offset) {
             super(parent);
             this.array = parent.array;
             this.node = node;
@@ -431,7 +431,7 @@
         }
     }
 
-    private static class ArraySink<T> implements Sink<T> {
+    private static final class ArraySink<T> implements Sink<T> {
         private final T[] array;
         private final int offset;
         private final int length;
@@ -466,15 +466,15 @@
     // primitives can unified with appropriate SAMs abstracting the details
     // of push leaf data to an array or copying node data to an array at an offset.
 
-    private static class IntCollectorTask<T> extends AbstractTask<T, Integer, Node.OfInt, IntCollectorTask<T>> {
+    private static final class IntCollectorTask<T> extends AbstractTask<T, Integer, Node.OfInt, IntCollectorTask<T>> {
         private final PipelineHelper<T, Integer> helper;
 
-        private IntCollectorTask(PipelineHelper<T, Integer> helper) {
+        IntCollectorTask(PipelineHelper<T, Integer> helper) {
             super(helper);
             this.helper = helper;
         }
 
-        private IntCollectorTask(IntCollectorTask<T> parent, Spliterator<T> spliterator) {
+        IntCollectorTask(IntCollectorTask<T> parent, Spliterator<T> spliterator) {
             super(parent, spliterator);
             helper = parent.helper;
         }
@@ -504,7 +504,7 @@
         }
     }
 
-    private static class IntSizedCollectorTask<T> extends CountedCompleter<Void> {
+    private static final class IntSizedCollectorTask<T> extends CountedCompleter<Void> {
         private final Spliterator<T> spliterator;
         private final PipelineHelper<T, Integer> helper;
         private final int[] array;
@@ -512,7 +512,7 @@
         private long offset;
         private long length;
 
-        private IntSizedCollectorTask(Spliterator<T> spliterator, PipelineHelper<T, Integer> helper, int[] array) {
+        IntSizedCollectorTask(Spliterator<T> spliterator, PipelineHelper<T, Integer> helper, int[] array) {
             assert spliterator.hasCharacteristic(Spliterator.SUBSIZED);
             this.spliterator = spliterator;
             this.helper = helper;
@@ -522,7 +522,7 @@
             this.length = array.length;
         }
 
-        private IntSizedCollectorTask(IntSizedCollectorTask<T> parent, Spliterator<T> spliterator, long offset, long length) {
+        IntSizedCollectorTask(IntSizedCollectorTask<T> parent, Spliterator<T> spliterator, long offset, long length) {
             super(parent);
             assert spliterator.hasCharacteristic(Spliterator.SUBSIZED);
             this.spliterator = spliterator;
@@ -557,18 +557,18 @@
         }
     }
 
-    private static class IntToArrayTask extends CountedCompleter<Void> {
+    private static final class IntToArrayTask extends CountedCompleter<Void> {
         private final int[] array;
         private final Node.OfInt node;
         private final int offset;
 
-        private IntToArrayTask(Node.OfInt node, int[] array, int offset) {
+        IntToArrayTask(Node.OfInt node, int[] array, int offset) {
             this.array = array;
             this.node = node;
             this.offset = offset;
         }
 
-        private IntToArrayTask(IntToArrayTask parent, Node.OfInt node, int offset) {
+        IntToArrayTask(IntToArrayTask parent, Node.OfInt node, int offset) {
             super(parent);
             this.array = parent.array;
             this.node = node;
@@ -597,7 +597,7 @@
         }
     }
 
-    private static class IntArraySink implements Sink.OfInt {
+    private static final class IntArraySink implements Sink.OfInt {
         private final int[] array;
         private final int offset;
         private final int length;
@@ -628,15 +628,15 @@
 
     // Long value implementations
 
-    private static class LongCollectorTask<T> extends AbstractTask<T, Long, Node.OfLong, LongCollectorTask<T>> {
+    private static final class LongCollectorTask<T> extends AbstractTask<T, Long, Node.OfLong, LongCollectorTask<T>> {
         private final PipelineHelper<T, Long> helper;
 
-        private LongCollectorTask(PipelineHelper<T, Long> helper) {
+        LongCollectorTask(PipelineHelper<T, Long> helper) {
             super(helper);
             this.helper = helper;
         }
 
-        private LongCollectorTask(LongCollectorTask<T> parent, Spliterator<T> spliterator) {
+        LongCollectorTask(LongCollectorTask<T> parent, Spliterator<T> spliterator) {
             super(parent, spliterator);
             helper = parent.helper;
         }
@@ -666,7 +666,7 @@
         }
     }
 
-    private static class LongSizedCollectorTask<T> extends CountedCompleter<Void> {
+    private static final class LongSizedCollectorTask<T> extends CountedCompleter<Void> {
         private final Spliterator<T> spliterator;
         private final PipelineHelper<T, Long> helper;
         private final long[] array;
@@ -674,7 +674,7 @@
         private long offset;
         private long length;
 
-        private LongSizedCollectorTask(Spliterator<T> spliterator, PipelineHelper<T, Long> helper, long[] array) {
+        LongSizedCollectorTask(Spliterator<T> spliterator, PipelineHelper<T, Long> helper, long[] array) {
             assert spliterator.hasCharacteristic(Spliterator.SUBSIZED);
             this.spliterator = spliterator;
             this.helper = helper;
@@ -684,7 +684,7 @@
             this.length = array.length;
         }
 
-        private LongSizedCollectorTask(LongSizedCollectorTask<T> parent, Spliterator<T> spliterator, long offset, long length) {
+        LongSizedCollectorTask(LongSizedCollectorTask<T> parent, Spliterator<T> spliterator, long offset, long length) {
             super(parent);
             assert spliterator.hasCharacteristic(Spliterator.SUBSIZED);
             this.spliterator = spliterator;
@@ -719,18 +719,18 @@
         }
     }
 
-    private static class LongToArrayTask extends CountedCompleter<Void> {
+    private static final class LongToArrayTask extends CountedCompleter<Void> {
         private final long[] array;
         private final Node.OfLong node;
         private final int offset;
 
-        private LongToArrayTask(Node.OfLong node, long[] array, int offset) {
+        LongToArrayTask(Node.OfLong node, long[] array, int offset) {
             this.array = array;
             this.node = node;
             this.offset = offset;
         }
 
-        private LongToArrayTask(LongToArrayTask parent, Node.OfLong node, int offset) {
+        LongToArrayTask(LongToArrayTask parent, Node.OfLong node, int offset) {
             super(parent);
             this.array = parent.array;
             this.node = node;
@@ -759,7 +759,7 @@
         }
     }
 
-    private static class LongArraySink implements Sink.OfLong {
+    private static final class LongArraySink implements Sink.OfLong {
         private final long[] array;
         private final int offset;
         private final int length;
@@ -790,15 +790,15 @@
 
     // Double value implementations
 
-    private static class DoubleCollectorTask<T> extends AbstractTask<T, Double, Node.OfDouble, DoubleCollectorTask<T>> {
+    private static final class DoubleCollectorTask<T> extends AbstractTask<T, Double, Node.OfDouble, DoubleCollectorTask<T>> {
         private final PipelineHelper<T, Double> helper;
 
-        private DoubleCollectorTask(PipelineHelper<T, Double> helper) {
+        DoubleCollectorTask(PipelineHelper<T, Double> helper) {
             super(helper);
             this.helper = helper;
         }
 
-        private DoubleCollectorTask(DoubleCollectorTask<T> parent, Spliterator<T> spliterator) {
+        DoubleCollectorTask(DoubleCollectorTask<T> parent, Spliterator<T> spliterator) {
             super(parent, spliterator);
             helper = parent.helper;
         }
@@ -828,7 +828,7 @@
         }
     }
 
-    private static class DoubleSizedCollectorTask<T> extends CountedCompleter<Void> {
+    private static final class DoubleSizedCollectorTask<T> extends CountedCompleter<Void> {
         private final Spliterator<T> spliterator;
         private final PipelineHelper<T, Double> helper;
         private final double[] array;
@@ -836,7 +836,7 @@
         private long offset;
         private long length;
 
-        private DoubleSizedCollectorTask(Spliterator<T> spliterator, PipelineHelper<T, Double> helper, double[] array) {
+        DoubleSizedCollectorTask(Spliterator<T> spliterator, PipelineHelper<T, Double> helper, double[] array) {
             assert spliterator.hasCharacteristic(Spliterator.SUBSIZED);
             this.spliterator = spliterator;
             this.helper = helper;
@@ -846,7 +846,7 @@
             this.length = array.length;
         }
 
-        private DoubleSizedCollectorTask(DoubleSizedCollectorTask<T> parent, Spliterator<T> spliterator, long offset, long length) {
+        DoubleSizedCollectorTask(DoubleSizedCollectorTask<T> parent, Spliterator<T> spliterator, long offset, long length) {
             super(parent);
             assert spliterator.hasCharacteristic(Spliterator.SUBSIZED);
             this.spliterator = spliterator;
@@ -881,18 +881,18 @@
         }
     }
 
-    private static class DoubleToArrayTask extends CountedCompleter<Void> {
+    private static final class DoubleToArrayTask extends CountedCompleter<Void> {
         private final double[] array;
         private final Node.OfDouble node;
         private final int offset;
 
-        private DoubleToArrayTask(Node.OfDouble node, double[] array, int offset) {
+        DoubleToArrayTask(Node.OfDouble node, double[] array, int offset) {
             this.array = array;
             this.node = node;
             this.offset = offset;
         }
 
-        private DoubleToArrayTask(DoubleToArrayTask parent, Node.OfDouble node, int offset) {
+        DoubleToArrayTask(DoubleToArrayTask parent, Node.OfDouble node, int offset) {
             super(parent);
             this.array = parent.array;
             this.node = node;
@@ -921,7 +921,7 @@
         }
     }
 
-    private static class DoubleArraySink implements Sink.OfDouble {
+    private static final class DoubleArraySink implements Sink.OfDouble {
         private final double[] array;
         private final int offset;
         private final int length;
--- a/src/share/classes/java/util/stream/Nodes.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/Nodes.java	Mon Feb 25 18:11:42 2013 +0100
@@ -627,6 +627,9 @@
     private static final Node EMPTY_NODE = new EmptyNode();
 
     private static class EmptyNode<T> implements Node<T> {
+
+        EmptyNode() {} // Avoid creation of special accessor
+
         @Override
         public Spliterator<T> spliterator() {
             return Spliterators.emptySpliterator();
@@ -650,9 +653,8 @@
     }
 
     private static class ArrayNode<T> implements Node<T> {
-
-        protected final T[] array;
-        protected int curSize;
+        final T[] array;
+        int curSize;
 
         @SuppressWarnings("unchecked")
         ArrayNode(long size, IntFunction<T[]> generator) {
@@ -710,9 +712,8 @@
         }
     }
 
-    private static class CollectionNode<T> implements Node<T> {
-
-        final Collection<T> c;
+    private static final class CollectionNode<T> implements Node<T> {
+        private final Collection<T> c;
 
         CollectionNode(Collection<T> c) {
             this.c = c;
@@ -755,11 +756,11 @@
         }
     }
 
-    private static class ConcNode<T> implements Node<T> {
-        final Node<T>[] nodes;
-        final long size;
+    private static final class ConcNode<T> implements Node<T> {
+        private final Node<T>[] nodes;
+        private final long size;
 
-        private ConcNode(Node<T>[] nodes) {
+        ConcNode(Node<T>[] nodes) {
             this.nodes = nodes;
             // The Node count will be required when the Node spliterator is obtained and it is cheaper
             // to aggressively calculate bottom up as the tree is built rather than later on from the top down
@@ -828,25 +829,25 @@
             implements Spliterator<T> {
         // Node we are pointing to
         // null if full traversal has occurred
-        protected N curNode;
+        N curNode;
 
         // next child of curNode to consume
-        protected int curChildIndex;
+        int curChildIndex;
 
         // The spliterator of the curNode if that node is the last node and has no children.
         // This spliterator will be delegated to for splitting and traversing.
         // null if curNode has children
-        protected S lastNodeSpliterator;
+        S lastNodeSpliterator;
 
         // spliterator used while traversing with tryAdvance
         // null if no partial traversal has occurred
-        protected S tryAdvanceSpliterator;
+        S tryAdvanceSpliterator;
 
         // node stack used when traversing to search and find leaf nodes
         // null if no partial traversal has occurred
-        private Deque<N> tryAdvanceStack;
+        Deque<N> tryAdvanceStack;
 
-        private InternalNodeSpliterator(N curNode) {
+        InternalNodeSpliterator(N curNode) {
             this.curNode = curNode;
         }
 
@@ -967,6 +968,7 @@
         }
 
         private static final class OfRef<T> extends InternalNodeSpliterator<T, Spliterator<T>, Node<T>, Consumer<? super T>> {
+
             OfRef(Node<T> curNode) {
                 super(curNode);
             }
@@ -1006,7 +1008,7 @@
         private static final class OfInt extends InternalNodeSpliterator<Integer, Spliterator.OfInt, Node.OfInt, IntConsumer>
                 implements Spliterator.OfInt {
 
-            public OfInt(Node.OfInt cur) {
+            OfInt(Node.OfInt cur) {
                 super(cur);
             }
 
@@ -1045,7 +1047,7 @@
         private static final class OfLong extends InternalNodeSpliterator<Long, Spliterator.OfLong, Node.OfLong, LongConsumer>
                 implements Spliterator.OfLong {
 
-            public OfLong(Node.OfLong cur) {
+            OfLong(Node.OfLong cur) {
                 super(cur);
             }
 
@@ -1084,7 +1086,7 @@
         private static final class OfDouble extends InternalNodeSpliterator<Double, Spliterator.OfDouble, Node.OfDouble, DoubleConsumer>
                 implements Spliterator.OfDouble {
 
-            public OfDouble(Node.OfDouble cur) {
+            OfDouble(Node.OfDouble cur) {
                 super(cur);
             }
 
@@ -1121,9 +1123,9 @@
         }
     }
 
-    private static class FixedNodeBuilder<T> extends ArrayNode<T> implements Node.Builder<T> {
+    private static final class FixedNodeBuilder<T> extends ArrayNode<T> implements Node.Builder<T> {
 
-        private FixedNodeBuilder(long size, IntFunction<T[]> generator) {
+        FixedNodeBuilder(long size, IntFunction<T[]> generator) {
             super(size, generator);
             assert size < Streams.MAX_ARRAY_SIZE;
         }
@@ -1172,9 +1174,10 @@
         }
     }
 
-    private static class SpinedNodeBuilder<T> extends SpinedBuffer<T> implements Node<T>, Node.Builder<T> {
+    private static final class SpinedNodeBuilder<T> extends SpinedBuffer<T> implements Node<T>, Node.Builder<T> {
+        private boolean building = false;
 
-        private boolean building = false;
+        SpinedNodeBuilder() {} // Avoid creation of special accessor
 
         @Override
         public Spliterator<T> spliterator() {
@@ -1243,7 +1246,10 @@
 
     private static final Node.OfDouble EMPTY_DOUBLE_NODE = new EmptyDoubleNode();
 
-    private static class EmptyIntNode extends EmptyNode<Integer> implements Node.OfInt {
+    private static final class EmptyIntNode extends EmptyNode<Integer> implements Node.OfInt {
+
+        EmptyIntNode() {} // Avoid creation of special accessor
+
         @Override
         public Spliterator.OfInt spliterator() {
             return Spliterators.emptyIntSpliterator();
@@ -1261,7 +1267,10 @@
         public void forEach(IntConsumer consumer) { }
     }
 
-    private static class EmptyLongNode extends EmptyNode<Long> implements Node.OfLong {
+    private static final class EmptyLongNode extends EmptyNode<Long> implements Node.OfLong {
+
+        EmptyLongNode() {} // Avoid creation of special accessor
+
         @Override
         public Spliterator.OfLong spliterator() {
             return Spliterators.emptyLongSpliterator();
@@ -1279,7 +1288,10 @@
         public void forEach(LongConsumer consumer) { }
     }
 
-    private static class EmptyDoubleNode extends EmptyNode<Double> implements Node.OfDouble {
+    private static final class EmptyDoubleNode extends EmptyNode<Double> implements Node.OfDouble {
+
+        EmptyDoubleNode() {} // Avoid creation of special accessor
+
         @Override
         public Spliterator.OfDouble spliterator() {
             return Spliterators.emptyDoubleSpliterator();
@@ -1301,7 +1313,7 @@
         final N[] nodes;
         final long size;
 
-        public AbstractPrimitiveConcNode(N[] nodes) {
+        AbstractPrimitiveConcNode(N[] nodes) {
             this.nodes = nodes;
             // The Node count will be required when the Node spliterator is obtained and it is cheaper
             // to aggressively calculate bottom up as the tree is built rather than later on from the top down
@@ -1340,7 +1352,6 @@
     }
 
     private static class IntArrayNode implements Node.OfInt {
-
         final int[] array;
         int curSize;
 
@@ -1400,7 +1411,6 @@
     }
 
     private static class LongArrayNode implements Node.OfLong {
-
         final long[] array;
         int curSize;
 
@@ -1460,7 +1470,6 @@
     }
 
     private static class DoubleArrayNode implements Node.OfDouble {
-
         final double[] array;
         int curSize;
 
@@ -1519,9 +1528,9 @@
         }
     }
 
-    private static class IntConcNode extends AbstractPrimitiveConcNode<Integer, Node.OfInt> implements Node.OfInt {
+    private static final class IntConcNode extends AbstractPrimitiveConcNode<Integer, Node.OfInt> implements Node.OfInt {
 
-        public IntConcNode(Node.OfInt[] nodes) {
+        IntConcNode(Node.OfInt[] nodes) {
             super(nodes);
         }
 
@@ -1552,9 +1561,9 @@
         }
     }
 
-    private static class LongConcNode extends AbstractPrimitiveConcNode<Long, Node.OfLong> implements Node.OfLong {
+    private static final class LongConcNode extends AbstractPrimitiveConcNode<Long, Node.OfLong> implements Node.OfLong {
 
-        public LongConcNode(Node.OfLong[] nodes) {
+        LongConcNode(Node.OfLong[] nodes) {
             super(nodes);
         }
 
@@ -1585,9 +1594,9 @@
         }
     }
 
-    private static class DoubleConcNode extends AbstractPrimitiveConcNode<Double, Node.OfDouble> implements Node.OfDouble {
+    private static final class DoubleConcNode extends AbstractPrimitiveConcNode<Double, Node.OfDouble> implements Node.OfDouble {
 
-        public DoubleConcNode(Node.OfDouble[] nodes) {
+        DoubleConcNode(Node.OfDouble[] nodes) {
             super(nodes);
         }
 
@@ -1618,9 +1627,9 @@
         }
     }
 
-    private static class IntFixedNodeBuilder extends IntArrayNode implements Node.Builder.OfInt {
+    private static final class IntFixedNodeBuilder extends IntArrayNode implements Node.Builder.OfInt {
 
-        private IntFixedNodeBuilder(long size) {
+        IntFixedNodeBuilder(long size) {
             super(size);
             assert size < Streams.MAX_ARRAY_SIZE;
         }
@@ -1669,9 +1678,9 @@
         }
     }
 
-    private static class LongFixedNodeBuilder extends LongArrayNode implements Node.Builder.OfLong {
+    private static final class LongFixedNodeBuilder extends LongArrayNode implements Node.Builder.OfLong {
 
-        private LongFixedNodeBuilder(long size) {
+        LongFixedNodeBuilder(long size) {
             super(size);
             assert size < Streams.MAX_ARRAY_SIZE;
         }
@@ -1720,9 +1729,9 @@
         }
     }
 
-    private static class DoubleFixedNodeBuilder extends DoubleArrayNode implements Node.Builder.OfDouble {
+    private static final class DoubleFixedNodeBuilder extends DoubleArrayNode implements Node.Builder.OfDouble {
 
-        private DoubleFixedNodeBuilder(long size) {
+        DoubleFixedNodeBuilder(long size) {
             super(size);
             assert size < Streams.MAX_ARRAY_SIZE;
         }
@@ -1771,9 +1780,11 @@
         }
     }
 
-    private static class IntSpinedNodeBuilder extends SpinedBuffer.OfInt implements Node.OfInt, Node.Builder.OfInt {
+    private static final class IntSpinedNodeBuilder extends SpinedBuffer.OfInt implements Node.OfInt, Node.Builder.OfInt {
         private boolean building = false;
 
+        IntSpinedNodeBuilder() {} // Avoid creation of special accessor
+
         @Override
         public Spliterator.OfInt spliterator() {
             assert !building : "during building";
@@ -1827,9 +1838,11 @@
         }
     }
 
-    private static class LongSpinedNodeBuilder extends SpinedBuffer.OfLong implements Node.OfLong, Node.Builder.OfLong {
+    private static final class LongSpinedNodeBuilder extends SpinedBuffer.OfLong implements Node.OfLong, Node.Builder.OfLong {
         private boolean building = false;
 
+        LongSpinedNodeBuilder() {} // Avoid creation of special accessor
+
         @Override
         public Spliterator.OfLong spliterator() {
             assert !building : "during building";
@@ -1883,9 +1896,11 @@
         }
     }
 
-    private static class DoubleSpinedNodeBuilder extends SpinedBuffer.OfDouble implements Node.OfDouble, Node.Builder.OfDouble {
+    private static final class DoubleSpinedNodeBuilder extends SpinedBuffer.OfDouble implements Node.OfDouble, Node.Builder.OfDouble {
         private boolean building = false;
 
+        DoubleSpinedNodeBuilder() {} // Avoid creation of special accessor
+
         @Override
         public Spliterator.OfDouble spliterator() {
             assert !building : "during building";
--- a/src/share/classes/java/util/stream/ReduceOp.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/ReduceOp.java	Mon Feb 25 18:11:42 2013 +0100
@@ -107,7 +107,9 @@
      * @param <U> The type of the state element
      */
     private static abstract class Box<U> {
-        protected U state;
+        U state;
+
+        Box() {} // Avoid creation of special accessor
 
         public U get() {
             return state;
@@ -602,7 +604,6 @@
         Supplier<R> supplier = collector.resultSupplier();
         ObjDoubleConsumer<R> accumulator = collector.doubleAccumulator();
         BinaryOperator<R> combiner = collector.combiner();
-
         class ReducingSink extends Box<R> implements AccumulatingSink<Double, R, ReducingSink>, Sink.OfDouble {
             @Override
             public void begin(long size) {
@@ -629,16 +630,16 @@
     }
 
     /** A {@code ForkJoinTask} for performing a parallel reduce operation */
-    private static class ReduceTask<P_IN, P_OUT, R, S extends AccumulatingSink<P_OUT, R, S>>
+    private static final class ReduceTask<P_IN, P_OUT, R, S extends AccumulatingSink<P_OUT, R, S>>
             extends AbstractTask<P_IN, P_OUT, S, ReduceTask<P_IN, P_OUT, R, S>> {
         private final Supplier<S> sinkFactory;
 
-        private ReduceTask(PipelineHelper<P_IN, P_OUT> helper, Supplier<S> sinkFactory) {
+        ReduceTask(PipelineHelper<P_IN, P_OUT> helper, Supplier<S> sinkFactory) {
             super(helper);
             this.sinkFactory = sinkFactory;
         }
 
-        private ReduceTask(ReduceTask<P_IN, P_OUT, R, S> parent, Spliterator<P_IN> spliterator) {
+        ReduceTask(ReduceTask<P_IN, P_OUT, R, S> parent, Spliterator<P_IN> spliterator) {
             super(parent, spliterator);
             this.sinkFactory = parent.sinkFactory;
         }
--- a/src/share/classes/java/util/stream/Sink.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/Sink.java	Mon Feb 25 18:11:42 2013 +0100
@@ -161,7 +161,7 @@
 
         @Override
         default void accept(Integer i) {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Sink.OfInt.accept(Integer)");
             accept(i.intValue());
         }
@@ -178,7 +178,7 @@
 
         @Override
         default void accept(Long i) {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Sink.OfLong.accept(Long)");
             accept(i.longValue());
         }
@@ -195,7 +195,7 @@
 
         @Override
         default void accept(Double i) {
-            if (Tripwire.enabled)
+            if (Tripwire.ENABLED)
                 Tripwire.trip(getClass(), "{0} calling Sink.OfDouble.accept(Double)");
             accept(i.doubleValue());
         }
--- a/src/share/classes/java/util/stream/SliceOp.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/SliceOp.java	Mon Feb 25 18:11:42 2013 +0100
@@ -34,18 +34,18 @@
  * @param <T> The input and output type of the stream pipeline
  * @since 1.8
  */
-class SliceOp<T> implements StatefulOp<T> {
+final class SliceOp<T> implements StatefulOp<T> {
     /** The number of elements to skip */
-    protected final long skip;
+    private final long skip;
 
     /** The maximum size of the resulting stream, or -1 if no limit is to be imposed */
-    protected final long limit;
+    private final long limit;
 
     /** The stream shape of the input and output streams */
-    protected final StreamShape shape;
+    private final StreamShape shape;
 
     /** The sink transform for this operation */
-    protected final AbstractPipeline.SinkWrapper sinkWrapper;
+    private final AbstractPipeline.SinkWrapper sinkWrapper;
 
     /**
      * Construct a {@code SliceOp}, which may be a skip-only, limit-only, or skip-and-limit.
@@ -193,15 +193,15 @@
         return sinkWrapper.wrapSink(flags, sink);
     }
 
-    private long getFinalSize(PipelineHelper helper, Spliterator spliterator) {
-        long size = helper.exactOutputSizeIfKnown(spliterator);
-        if (size >= 0) {
-            size = Math.max(0, size - skip);
-            if (limit >= 0)
-                size = Math.min(size, limit);
-        }
-        return size;
-    }
+//    private long getFinalSize(PipelineHelper helper, Spliterator spliterator) {
+//        long size = helper.exactOutputSizeIfKnown(spliterator);
+//        if (size >= 0) {
+//            size = Math.max(0, size - skip);
+//            if (limit >= 0)
+//                size = Math.min(size, limit);
+//        }
+//        return size;
+//    }
 
     @Override
     public <S> Node<T> evaluateParallel(PipelineHelper<S, T> helper) {
@@ -238,21 +238,21 @@
      * @param <S> Input element type to the stream pipeline
      * @param <T> Output element type from the stream pipeline
      */
-    private static class SliceTask<S, T> extends AbstractShortCircuitTask<S, T, Node<T>, SliceTask<S, T>> {
+    private static final class SliceTask<S, T> extends AbstractShortCircuitTask<S, T, Node<T>, SliceTask<S, T>> {
         private final SliceOp<T> op;
         private final long targetOffset, targetSize;
         private long thisNodeSize;
 
         private volatile boolean completed;
 
-        private SliceTask(SliceOp<T> op, PipelineHelper<S, T> helper, long offset, long size) {
+        SliceTask(SliceOp<T> op, PipelineHelper<S, T> helper, long offset, long size) {
             super(helper);
             this.op = op;
             this.targetOffset = offset;
             this.targetSize = size;
         }
 
-        private SliceTask(SliceTask<S, T> parent, Spliterator<S> spliterator) {
+        SliceTask(SliceTask<S, T> parent, Spliterator<S> spliterator) {
             super(parent, spliterator);
             this.op = parent.op;
             this.targetOffset = parent.targetOffset;
--- a/src/share/classes/java/util/stream/SortedOp.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/SortedOp.java	Mon Feb 25 18:11:42 2013 +0100
@@ -48,7 +48,7 @@
     }
 
     /** Specialized subtype for sorting reference streams */
-    public static class OfRef<T> extends SortedOp<T> {
+    static final class OfRef<T> extends SortedOp<T> {
         /** Comparator used for sorting */
         private final Comparator<? super T> comparator;
 
@@ -56,7 +56,7 @@
          * Sort using natural order of {@literal <T>} which must be
          * {@code Comparable}.
          */
-        public OfRef() {
+        OfRef() {
             // Will throw CCE when we try to sort if T is not Comparable
             this((Comparator<? super T>) Comparators.naturalOrder());
         }
@@ -66,7 +66,7 @@
          *
          * @param comparator The comparator to be used to evaluate ordering.
          */
-        public OfRef(Comparator<? super T> comparator) {
+        OfRef(Comparator<? super T> comparator) {
             super(StreamShape.REFERENCE);
             this.comparator = Objects.requireNonNull(comparator);
         }
@@ -83,6 +83,7 @@
                 return new RefSortingSink<>(sink, comparator);
         }
 
+        @Override
         public <P_IN> Node<T> evaluateParallel(PipelineHelper<P_IN, T> helper) {
             if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
                 return helper.collectOutput(false);
@@ -97,8 +98,8 @@
     }
 
     /** Specialized subtype for sorting int streams */
-    public static class OfInt extends SortedOp<Integer> {
-        public OfInt() {
+    static final class OfInt extends SortedOp<Integer> {
+        OfInt() {
             super(StreamShape.INT_VALUE);
         }
 
@@ -126,8 +127,8 @@
     }
 
     /** Specialized subtype for sorting long streams */
-    public static class OfLong extends SortedOp<Long> {
-        public OfLong() {
+    static final class OfLong extends SortedOp<Long> {
+        OfLong() {
             super(StreamShape.LONG_VALUE);
         }
 
@@ -155,8 +156,8 @@
     }
 
     /** Specialized subtype for sorting double streams */
-    public static class OfDouble extends SortedOp<Double> {
-        public OfDouble() {
+    static final class OfDouble extends SortedOp<Double> {
+        OfDouble() {
             super(StreamShape.DOUBLE_VALUE);
         }
 
@@ -199,12 +200,12 @@
     }
 
     /** {@link ForkJoinTask} for implementing sort on SIZED reference streams */
-    private static class SizedRefSortingSink<T> extends Sink.ChainedReference<T> {
+    private static final class SizedRefSortingSink<T> extends Sink.ChainedReference<T> {
         private final Comparator<? super T> comparator;
-        T[] array;
-        int offset;
+        private T[] array;
+        private int offset;
 
-        public SizedRefSortingSink(Sink sink, Comparator<? super T> comparator) {
+        SizedRefSortingSink(Sink sink, Comparator<? super T> comparator) {
             super(sink);
             this.comparator = comparator;
         }
@@ -237,11 +238,11 @@
     }
 
     /** {@link Sink} for implementing sort on reference streams */
-    private static class RefSortingSink<T> extends Sink.ChainedReference<T> {
+    private static final class RefSortingSink<T> extends Sink.ChainedReference<T> {
         private final Comparator<? super T> comparator;
-        ArrayList<T> list;
+        private ArrayList<T> list;
 
-        public RefSortingSink(Sink sink, Comparator<? super T> comparator) {
+        RefSortingSink(Sink sink, Comparator<? super T> comparator) {
             super(sink);
             this.comparator = comparator;
         }
@@ -267,11 +268,11 @@
     }
 
     /** {@link Sink} for implementing sort on SIZED int streams */
-    private static class SizedIntSortingSink extends Sink.ChainedInt {
-        int[] array;
-        int offset;
+    private static final class SizedIntSortingSink extends Sink.ChainedInt {
+        private int[] array;
+        private int offset;
 
-        public SizedIntSortingSink(Sink downstream) {
+        SizedIntSortingSink(Sink downstream) {
             super(downstream);
         }
 
@@ -299,10 +300,10 @@
     }
 
     /** {@link Sink} for implementing sort on int streams */
-    private static class IntSortingSink extends Sink.ChainedInt {
-        SpinedBuffer.OfInt b;
+    private static final class IntSortingSink extends Sink.ChainedInt {
+        private SpinedBuffer.OfInt b;
 
-        public IntSortingSink(Sink sink) {
+        IntSortingSink(Sink sink) {
             super(sink);
         }
 
@@ -328,11 +329,11 @@
     }
 
     /** {@link Sink} for implementing sort on SIZED long streams */
-    private static class SizedLongSortingSink extends Sink.ChainedLong {
-        long[] array;
-        int offset;
+    private static final class SizedLongSortingSink extends Sink.ChainedLong {
+        private long[] array;
+        private int offset;
 
-        public SizedLongSortingSink(Sink downstream) {
+        SizedLongSortingSink(Sink downstream) {
             super(downstream);
         }
 
@@ -360,10 +361,10 @@
     }
 
     /** {@link Sink} for implementing sort on long streams */
-    private static class LongSortingSink extends Sink.ChainedLong {
-        SpinedBuffer.OfLong b;
+    private static final class LongSortingSink extends Sink.ChainedLong {
+        private SpinedBuffer.OfLong b;
 
-        public LongSortingSink(Sink sink) {
+        LongSortingSink(Sink sink) {
             super(sink);
         }
 
@@ -389,11 +390,11 @@
     }
 
     /** {@link Sink} for implementing sort on SIZED double streams */
-    private static class SizedDoubleSortingSink extends Sink.ChainedDouble {
-        double[] array;
-        int offset;
+    private static final class SizedDoubleSortingSink extends Sink.ChainedDouble {
+        private double[] array;
+        private int offset;
 
-        public SizedDoubleSortingSink(Sink downstream) {
+        SizedDoubleSortingSink(Sink downstream) {
             super(downstream);
         }
 
@@ -421,11 +422,12 @@
     }
 
     /** {@link Sink} for implementing sort on double streams */
-    private static class DoubleSortingSink extends Sink.ChainedDouble {
-        SpinedBuffer.OfDouble b;
+    private static final class DoubleSortingSink extends Sink.ChainedDouble {
+        private SpinedBuffer.OfDouble b;
 
-        public DoubleSortingSink(Sink sink) {
-            super(sink);}
+        DoubleSortingSink(Sink sink) {
+            super(sink);
+        }
 
         @Override
         public void begin(long size) {
--- a/src/share/classes/java/util/stream/SpinedBuffer.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/SpinedBuffer.java	Mon Feb 25 18:11:42 2013 +0100
@@ -76,7 +76,7 @@
      * @throws IllegalArgumentException if the specified initial capacity
      *         is negative
      */
-    public SpinedBuffer(int initialCapacity) {
+    SpinedBuffer(int initialCapacity) {
         super(initialCapacity);
         curChunk = (E[]) new Object[1 << initialChunkPower];
     }
@@ -84,7 +84,7 @@
     /**
      * Constructs an empty list with an initial capacity of sixteen.
      */
-    public SpinedBuffer() {
+    SpinedBuffer() {
         this(MIN_CHUNK_SIZE);
     }
 
@@ -96,7 +96,7 @@
      * @param i the iterable whose elements are to be placed into this list
      * @throws NullPointerException if the specified iterable is null
      */
-    public SpinedBuffer(Iterable<E> i) {
+    SpinedBuffer(Iterable<E> i) {
         this();
 
         // @@@ This can be more efficient if c.toArray() is used
@@ -361,7 +361,7 @@
      * @param <A> the type primitive array of values.
      * @param <C> the type of primitive consumer.
      */
-    public abstract static class OfPrimitive<E, A, C>
+    abstract static class OfPrimitive<E, A, C>
             extends AbstractSpinedBuffer<E> implements Iterable<E> {
 
         /*
@@ -381,10 +381,10 @@
          */
 
         // The chunk we're currently writing into
-        protected A curChunk;
+        A curChunk;
 
         // All chunks, or null if there is only one chunk
-        protected A[] spine;
+        A[] spine;
 
         /**
          * Constructs an empty list with the specified initial capacity.
@@ -393,7 +393,7 @@
          * @throws IllegalArgumentException if the specified initial capacity
          *         is negative
          */
-        public OfPrimitive(int initialCapacity) {
+        OfPrimitive(int initialCapacity) {
             super(initialCapacity);
             curChunk = newArray(1 << initialChunkPower);
         }
@@ -401,7 +401,7 @@
         /**
          * Constructs an empty list with an initial capacity of sixteen.
          */
-        public OfPrimitive() {
+        OfPrimitive() {
             this(MIN_CHUNK_SIZE);
         }
 
@@ -527,7 +527,7 @@
             arrayForEach(curChunk, 0, elementIndex, consumer);
         }
 
-        protected abstract class BaseSpliterator<T_SPLITER extends Spliterator<E>> implements Spliterator<E> {
+        abstract class BaseSpliterator<T_SPLITER extends Spliterator<E>> implements Spliterator<E> {
             // The current spine index
             int splSpineIndex;
 
@@ -616,8 +616,12 @@
     /**
      * An ordered collection of {@code int} values.
      */
-    public static class OfInt extends SpinedBuffer.OfPrimitive<Integer, int[], IntConsumer> implements IntConsumer {
-        public OfInt() { }
+    static class OfInt extends SpinedBuffer.OfPrimitive<Integer, int[], IntConsumer> implements IntConsumer {
+        OfInt() { }
+
+        OfInt(int initialCapacity) {
+            super(initialCapacity);
+        }
 
         @Override
         public void forEach(Consumer<? super Integer> consumer) {
@@ -625,16 +629,12 @@
                 forEach((IntConsumer) consumer);
             }
             else {
-                if (Tripwire.enabled)
+                if (Tripwire.ENABLED)
                     Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfInt.forEach(Consumer)");
                 spliterator().forEach(consumer);
             }
         }
 
-        public OfInt(int initialCapacity) {
-            super(initialCapacity);
-        }
-
         @Override
         protected int[][] newArrayArray(int size) {
             return new int[size][];
@@ -679,22 +679,19 @@
             return Spliterators.iteratorFromSpliterator(spliterator());
         }
 
-        private class Splitr
-                extends BaseSpliterator<Spliterator.OfInt>
-                implements Spliterator.OfInt {
+        public Spliterator.OfInt spliterator() {
+            class Splitr extends BaseSpliterator<Spliterator.OfInt> implements Spliterator.OfInt {
 
-            @Override
-            void arrayForOne(int[] array, int index, IntConsumer consumer) {
-                consumer.accept(array[index]);
-            }
+                @Override
+                void arrayForOne(int[] array, int index, IntConsumer consumer) {
+                    consumer.accept(array[index]);
+                }
 
-            @Override
-            Spliterator.OfInt arraySpliterator(int[] array, int offset, int len) {
-                return Arrays.spliterator(array, offset, offset+len);
-            }
-        }
-
-        public Spliterator.OfInt spliterator() {
+                @Override
+                Spliterator.OfInt arraySpliterator(int[] array, int offset, int len) {
+                    return Arrays.spliterator(array, offset, offset+len);
+                }
+            };
             return new Splitr();
         }
 
@@ -716,8 +713,12 @@
     /**
      * An ordered collection of {@code long} values.
      */
-    public static class OfLong extends SpinedBuffer.OfPrimitive<Long, long[], LongConsumer> implements LongConsumer {
-        public OfLong() { }
+    static class OfLong extends SpinedBuffer.OfPrimitive<Long, long[], LongConsumer> implements LongConsumer {
+        OfLong() { }
+
+        OfLong(int initialCapacity) {
+            super(initialCapacity);
+        }
 
         @Override
         public void forEach(Consumer<? super Long> consumer) {
@@ -725,16 +726,12 @@
                 forEach((LongConsumer) consumer);
             }
             else {
-                if (Tripwire.enabled)
+                if (Tripwire.ENABLED)
                     Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfLong.forEach(Consumer)");
                 spliterator().forEach(consumer);
             }
         }
 
-        public OfLong(int initialCapacity) {
-            super(initialCapacity);
-        }
-
         @Override
         protected long[][] newArrayArray(int size) {
             return new long[size][];
@@ -779,21 +776,19 @@
             return Spliterators.iteratorFromSpliterator(spliterator());
         }
 
-        private class Splitr
-                extends BaseSpliterator<Spliterator.OfLong>
-                implements Spliterator.OfLong {
-            @Override
-            void arrayForOne(long[] array, int index, LongConsumer consumer) {
-                consumer.accept(array[index]);
-            }
-
-            @Override
-            Spliterator.OfLong arraySpliterator(long[] array, int offset, int len) {
-                return Arrays.spliterator(array, offset, offset+len);
-            }
-        }
 
         public Spliterator.OfLong spliterator() {
+            class Splitr extends BaseSpliterator<Spliterator.OfLong> implements Spliterator.OfLong {
+                @Override
+                void arrayForOne(long[] array, int index, LongConsumer consumer) {
+                    consumer.accept(array[index]);
+                }
+
+                @Override
+                Spliterator.OfLong arraySpliterator(long[] array, int offset, int len) {
+                    return Arrays.spliterator(array, offset, offset+len);
+                }
+            };
             return new Splitr();
         }
 
@@ -815,8 +810,12 @@
     /**
      * An ordered collection of {@code double} values.
      */
-    public static class OfDouble extends SpinedBuffer.OfPrimitive<Double, double[], DoubleConsumer> implements DoubleConsumer {
-        public OfDouble() { }
+    static class OfDouble extends SpinedBuffer.OfPrimitive<Double, double[], DoubleConsumer> implements DoubleConsumer {
+        OfDouble() { }
+
+        OfDouble(int initialCapacity) {
+            super(initialCapacity);
+        }
 
         @Override
         public void forEach(Consumer<? super Double> consumer) {
@@ -824,7 +823,7 @@
                 forEach((DoubleConsumer) consumer);
             }
             else {
-                if (Tripwire.enabled)
+                if (Tripwire.ENABLED)
                     Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfDouble.forEach(Consumer)");
                 spliterator().forEach(consumer);
             }
@@ -835,10 +834,6 @@
             return new double[size][];
         }
 
-        public OfDouble(int initialCapacity) {
-            super(initialCapacity);
-        }
-
         @Override
         protected double[] newArray(int size) {
             return new double[size];
@@ -878,21 +873,18 @@
             return Spliterators.iteratorFromSpliterator(spliterator());
         }
 
-        private class Splitr
-                extends BaseSpliterator<Spliterator.OfDouble>
-                implements Spliterator.OfDouble {
-            @Override
-            void arrayForOne(double[] array, int index, DoubleConsumer consumer) {
-                consumer.accept(array[index]);
+        public Spliterator.OfDouble spliterator() {
+            class Splitr extends BaseSpliterator<Spliterator.OfDouble> implements Spliterator.OfDouble {
+                @Override
+                void arrayForOne(double[] array, int index, DoubleConsumer consumer) {
+                    consumer.accept(array[index]);
+                }
+
+                @Override
+                Spliterator.OfDouble arraySpliterator(double[] array, int offset, int len) {
+                    return Arrays.spliterator(array, offset, offset+len);
+                }
             }
-
-            @Override
-            Spliterator.OfDouble arraySpliterator(double[] array, int offset, int len) {
-                return Arrays.spliterator(array, offset, offset+len);
-            }
-        }
-
-        public Spliterator.OfDouble spliterator() {
             return new Splitr();
         }
 
--- a/src/share/classes/java/util/stream/StreamSpliterators.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/StreamSpliterators.java	Mon Feb 25 18:11:42 2013 +0100
@@ -40,46 +40,46 @@
  */
 class StreamSpliterators {
 
-    static abstract class AbstractWrappingSpliterator<P_IN, P_OUT, T_BUFFER extends AbstractSpinedBuffer<P_OUT>>
+    private static abstract class AbstractWrappingSpliterator<P_IN, P_OUT, T_BUFFER extends AbstractSpinedBuffer<P_OUT>>
             implements Spliterator<P_OUT> {
         // True if this spliterator supports splitting
-        protected final boolean isParallel;
+        final boolean isParallel;
 
-        protected final PipelineHelper<P_IN, P_OUT> ph;
+        final PipelineHelper<P_IN, P_OUT> ph;
 
         // The source spliterator whose elements are traversed and pushed through bufferSink
-        protected final Spliterator<P_IN> spliterator;
+        final Spliterator<P_IN> spliterator;
 
         // The source of the sink chain for the pipeline where the last sink
         // is connected to buffer
         // null if no partial traverse has occurred
-        protected Sink<P_IN> bufferSink;
+        Sink<P_IN> bufferSink;
 
         // When invoked advances one element of spliterator pushing that element through
         // bufferSink and returns true, otherwise returns false if the are no more elements
         // of the spliterator to traverse
         // null if no partial traverse has occurred
-        protected BooleanSupplier pusher;
+        BooleanSupplier pusher;
 
         // The next element to consume from buffer
         // Used only for partial traversal
-        protected long nextToConsume;
+        long nextToConsume;
 
         // The buffer to push elements to when partially traversing with tryAdvance
         // null if no partial traverse has occurred
-        protected T_BUFFER buffer;
+        T_BUFFER buffer;
 
         // True if full traversal of the source spliterator (with possible cancellation) has occurred
         // When buffer is not null there still may be elements in the buffer to be consumed
-        protected boolean finished;
+        boolean finished;
 
-        private AbstractWrappingSpliterator(PipelineHelper<P_IN, P_OUT> ph, Spliterator<P_IN> spliterator, boolean parallel) {
+        AbstractWrappingSpliterator(PipelineHelper<P_IN, P_OUT> ph, Spliterator<P_IN> spliterator, boolean parallel) {
             this.spliterator = spliterator;
             this.ph = ph;
             this.isParallel = parallel;
         }
 
-        protected boolean doAdvance() {
+        boolean doAdvance() {
             if (buffer == null) {
                 if (finished)
                     return false;
@@ -101,9 +101,9 @@
             }
         }
 
-        protected abstract AbstractWrappingSpliterator<P_IN, P_OUT, ?> wrap(Spliterator<P_IN> s);
+        abstract AbstractWrappingSpliterator<P_IN, P_OUT, ?> wrap(Spliterator<P_IN> s);
 
-        protected abstract void initPartialTraversalState();
+        abstract void initPartialTraversalState();
 
         @Override
         public Spliterator<P_OUT> trySplit() {
@@ -162,7 +162,7 @@
         }
     }
 
-    static class WrappingSpliterator<P_IN, P_OUT>
+    static final class WrappingSpliterator<P_IN, P_OUT>
             extends AbstractWrappingSpliterator<P_IN, P_OUT, SpinedBuffer<P_OUT>> {
 
         WrappingSpliterator(PipelineHelper<P_IN, P_OUT> ph, Spliterator<P_IN> spliterator, boolean parallel) {
@@ -170,12 +170,12 @@
         }
 
         @Override
-        protected WrappingSpliterator<P_IN, P_OUT> wrap(Spliterator<P_IN> s) {
+        WrappingSpliterator<P_IN, P_OUT> wrap(Spliterator<P_IN> s) {
             return new WrappingSpliterator<>(ph, s, isParallel);
         }
 
         @Override
-        protected void initPartialTraversalState() {
+        void initPartialTraversalState() {
             SpinedBuffer<P_OUT> b = new SpinedBuffer<>();
             buffer = b;
             bufferSink = ph.wrapSink(b::accept);
@@ -202,7 +202,7 @@
         }
     }
 
-    static class IntWrappingSpliterator<P_IN>
+    static final class IntWrappingSpliterator<P_IN>
             extends AbstractWrappingSpliterator<P_IN, Integer, SpinedBuffer.OfInt>
             implements Spliterator.OfInt {
 
@@ -211,12 +211,12 @@
         }
 
         @Override
-        protected AbstractWrappingSpliterator<P_IN, Integer, ?> wrap(Spliterator<P_IN> s) {
+        AbstractWrappingSpliterator<P_IN, Integer, ?> wrap(Spliterator<P_IN> s) {
             return new IntWrappingSpliterator<>(ph, s, isParallel);
         }
 
         @Override
-        protected void initPartialTraversalState() {
+        void initPartialTraversalState() {
             SpinedBuffer.OfInt b = new SpinedBuffer.OfInt();
             buffer = b;
             bufferSink = ph.wrapSink((Sink.OfInt) b::accept);
@@ -248,7 +248,7 @@
         }
     }
 
-    static class LongWrappingSpliterator<P_IN>
+    static final class LongWrappingSpliterator<P_IN>
             extends AbstractWrappingSpliterator<P_IN, Long, SpinedBuffer.OfLong>
             implements Spliterator.OfLong {
 
@@ -257,12 +257,12 @@
         }
 
         @Override
-        protected AbstractWrappingSpliterator<P_IN, Long, ?> wrap(Spliterator<P_IN> s) {
+        AbstractWrappingSpliterator<P_IN, Long, ?> wrap(Spliterator<P_IN> s) {
             return new LongWrappingSpliterator<>(ph, s, isParallel);
         }
 
         @Override
-        protected void initPartialTraversalState() {
+        void initPartialTraversalState() {
             SpinedBuffer.OfLong b = new SpinedBuffer.OfLong();
             buffer = b;
             bufferSink = ph.wrapSink((Sink.OfLong) b::accept);
@@ -294,7 +294,7 @@
         }
     }
 
-    static class DoubleWrappingSpliterator<P_IN>
+    static final class DoubleWrappingSpliterator<P_IN>
             extends AbstractWrappingSpliterator<P_IN, Double, SpinedBuffer.OfDouble>
             implements Spliterator.OfDouble {
 
@@ -303,12 +303,12 @@
         }
 
         @Override
-        protected AbstractWrappingSpliterator<P_IN, Double, ?> wrap(Spliterator<P_IN> s) {
+        AbstractWrappingSpliterator<P_IN, Double, ?> wrap(Spliterator<P_IN> s) {
             return new DoubleWrappingSpliterator<>(ph, s, isParallel);
         }
 
         @Override
-        protected void initPartialTraversalState() {
+        void initPartialTraversalState() {
             SpinedBuffer.OfDouble b = new SpinedBuffer.OfDouble();
             buffer = b;
             bufferSink = ph.wrapSink((Sink.OfDouble) b::accept);
@@ -346,7 +346,7 @@
         private Spliterator<T> s;
 
         @SuppressWarnings("unchecked")
-        public DelegatingSpliterator(Supplier<? extends Spliterator<T>> supplier) {
+        DelegatingSpliterator(Supplier<? extends Spliterator<T>> supplier) {
             this.supplier = (Supplier<Spliterator<T>>) supplier;
         }
 
@@ -397,11 +397,10 @@
             return getClass().getName() + "[" + get() + "]";
         }
 
-        static class OfInt extends DelegatingSpliterator<Integer> implements Spliterator.OfInt {
-
+        static final class OfInt extends DelegatingSpliterator<Integer> implements Spliterator.OfInt {
             private Spliterator.OfInt s;
 
-            public OfInt(Supplier<Spliterator.OfInt> supplier) {
+            OfInt(Supplier<Spliterator.OfInt> supplier) {
                 super(supplier);
             }
 
@@ -429,11 +428,10 @@
             }
         }
 
-        static class OfLong extends DelegatingSpliterator<Long> implements Spliterator.OfLong {
+        static final class OfLong extends DelegatingSpliterator<Long> implements Spliterator.OfLong {
+            private Spliterator.OfLong s;
 
-            Spliterator.OfLong s;
-
-            public OfLong(Supplier<Spliterator.OfLong> supplier) {
+            OfLong(Supplier<Spliterator.OfLong> supplier) {
                 super(supplier);
             }
 
@@ -461,11 +459,10 @@
             }
         }
 
-        static class OfDouble extends DelegatingSpliterator<Double> implements Spliterator.OfDouble {
+        static final class OfDouble extends DelegatingSpliterator<Double> implements Spliterator.OfDouble {
+            private Spliterator.OfDouble s;
 
-            Spliterator.OfDouble s;
-
-            public OfDouble(Supplier<Spliterator.OfDouble> supplier) {
+            OfDouble(Supplier<Spliterator.OfDouble> supplier) {
                 super(supplier);
             }
 
--- a/src/share/classes/java/util/stream/Streams.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/Streams.java	Mon Feb 25 18:11:42 2013 +0100
@@ -477,17 +477,17 @@
     // Spliterator implementations
 
     private interface InfiniteIterator<T> extends Iterator<T> {
-        /** Always returns true*/
+        /** Always returns true */
         @Override
-        public default boolean hasNext() {
+        default boolean hasNext() {
             return true;
         }
 
-        public interface OfInt extends InfiniteIterator<Integer>, PrimitiveIterator.OfInt { }
+        interface OfInt extends InfiniteIterator<Integer>, PrimitiveIterator.OfInt { }
 
-        public interface OfLong extends InfiniteIterator<Long>, PrimitiveIterator.OfLong { }
+        interface OfLong extends InfiniteIterator<Long>, PrimitiveIterator.OfLong { }
 
-        public interface OfDouble extends InfiniteIterator<Double>, PrimitiveIterator.OfDouble { }
+        interface OfDouble extends InfiniteIterator<Double>, PrimitiveIterator.OfDouble { }
     }
 
     private static class RangeIntSpliterator implements Spliterator.OfInt {
--- a/src/share/classes/java/util/stream/TerminalOp.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/TerminalOp.java	Mon Feb 25 18:11:42 2013 +0100
@@ -68,7 +68,7 @@
      * @return the result of the evaluation
      */
     default <P_IN> R evaluateParallel(PipelineHelper<P_IN, E_IN> helper) {
-        if (Tripwire.enabled)
+        if (Tripwire.ENABLED)
             Tripwire.trip(getClass(), "{0} triggering TerminalOp.evaluateParallel serial default");
         return evaluateSequential(helper);
     }
--- a/src/share/classes/java/util/stream/Tripwire.java	Mon Feb 25 13:27:17 2013 +0100
+++ b/src/share/classes/java/util/stream/Tripwire.java	Mon Feb 25 18:11:42 2013 +0100
@@ -42,11 +42,11 @@
  *
  * @since 1.8
  */
-class Tripwire {
+final class Tripwire {
     private static final String TRIPWIRE_PROPERTY = "org.openjdk.java.util.stream.tripwire";
 
     /** Should debugging checks be enabled? */
-    public static final boolean enabled = true;
+    static final boolean ENABLED = true;
 //            = Boolean.getBoolean(TRIPWIRE_PROPERTY);
 
     /**
@@ -55,7 +55,7 @@
      * @param trippingClass Name of the class generating the message
      * @param msg A message format string of the type expected by {@link Logger}
      */
-    public static void trip(Class trippingClass, String msg) {
+    static void trip(Class<?> trippingClass, String msg) {
         Logger.getLogger(trippingClass.getName()).log(Level.WARNING, msg, trippingClass.getName());
     }
 }