mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8026369: javac potentially ambiguous overload warning needs an improved scheme
Reviewed-by: vromero
This commit is contained in:
parent
14a014d430
commit
1e3c9fd67e
16 changed files with 364 additions and 82 deletions
|
@ -63,6 +63,7 @@ import java.util.stream.Collector;
|
|||
* <p>This implementation does not check for overflow of the count or the sum.
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public class LongSummaryStatistics implements LongConsumer, IntConsumer {
|
||||
private long count;
|
||||
private long sum;
|
||||
|
|
|
@ -91,6 +91,7 @@ public interface PrimitiveIterator<T, T_CONS> extends Iterator<T> {
|
|||
* An Iterator specialized for {@code int} values.
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public static interface OfInt extends PrimitiveIterator<Integer, IntConsumer> {
|
||||
|
||||
/**
|
||||
|
@ -158,6 +159,7 @@ public interface PrimitiveIterator<T, T_CONS> extends Iterator<T> {
|
|||
* An Iterator specialized for {@code long} values.
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public static interface OfLong extends PrimitiveIterator<Long, LongConsumer> {
|
||||
|
||||
/**
|
||||
|
@ -224,6 +226,7 @@ public interface PrimitiveIterator<T, T_CONS> extends Iterator<T> {
|
|||
* An Iterator specialized for {@code double} values.
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public static interface OfDouble extends PrimitiveIterator<Double, DoubleConsumer> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -659,6 +659,7 @@ public interface Spliterator<T> {
|
|||
* A Spliterator specialized for {@code int} values.
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public interface OfInt extends OfPrimitive<Integer, IntConsumer, OfInt> {
|
||||
|
||||
@Override
|
||||
|
@ -723,6 +724,7 @@ public interface Spliterator<T> {
|
|||
* A Spliterator specialized for {@code long} values.
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public interface OfLong extends OfPrimitive<Long, LongConsumer, OfLong> {
|
||||
|
||||
@Override
|
||||
|
@ -787,6 +789,7 @@ public interface Spliterator<T> {
|
|||
* A Spliterator specialized for {@code double} values.
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public interface OfDouble extends OfPrimitive<Double, DoubleConsumer, OfDouble> {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -908,18 +908,21 @@ public final class Spliterators {
|
|||
OfRef() { }
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfInt
|
||||
extends EmptySpliterator<Integer, Spliterator.OfInt, IntConsumer>
|
||||
implements Spliterator.OfInt {
|
||||
OfInt() { }
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfLong
|
||||
extends EmptySpliterator<Long, Spliterator.OfLong, LongConsumer>
|
||||
implements Spliterator.OfLong {
|
||||
OfLong() { }
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfDouble
|
||||
extends EmptySpliterator<Double, Spliterator.OfDouble, DoubleConsumer>
|
||||
implements Spliterator.OfDouble {
|
||||
|
|
|
@ -314,6 +314,7 @@ interface Node<T> {
|
|||
/**
|
||||
* Specialized {@code Node} for int elements
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
interface OfInt extends OfPrimitive<Integer, IntConsumer, int[], Spliterator.OfInt, OfInt> {
|
||||
|
||||
/**
|
||||
|
@ -391,6 +392,7 @@ interface Node<T> {
|
|||
/**
|
||||
* Specialized {@code Node} for long elements
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
interface OfLong extends OfPrimitive<Long, LongConsumer, long[], Spliterator.OfLong, OfLong> {
|
||||
|
||||
/**
|
||||
|
@ -468,6 +470,7 @@ interface Node<T> {
|
|||
/**
|
||||
* Specialized {@code Node} for double elements
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
interface OfDouble extends OfPrimitive<Double, DoubleConsumer, double[], Spliterator.OfDouble, OfDouble> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -582,6 +582,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfInt
|
||||
extends EmptyNode<Integer, int[], IntConsumer>
|
||||
implements Node.OfInt {
|
||||
|
@ -599,6 +600,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfLong
|
||||
extends EmptyNode<Long, long[], LongConsumer>
|
||||
implements Node.OfLong {
|
||||
|
@ -616,6 +618,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfDouble
|
||||
extends EmptyNode<Double, double[], DoubleConsumer>
|
||||
implements Node.OfDouble {
|
||||
|
@ -880,6 +883,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfInt
|
||||
extends ConcNode.OfPrimitive<Integer, IntConsumer, int[], Spliterator.OfInt, Node.OfInt>
|
||||
implements Node.OfInt {
|
||||
|
@ -894,6 +898,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfLong
|
||||
extends ConcNode.OfPrimitive<Long, LongConsumer, long[], Spliterator.OfLong, Node.OfLong>
|
||||
implements Node.OfLong {
|
||||
|
@ -908,6 +913,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfDouble
|
||||
extends ConcNode.OfPrimitive<Double, DoubleConsumer, double[], Spliterator.OfDouble, Node.OfDouble>
|
||||
implements Node.OfDouble {
|
||||
|
@ -1160,6 +1166,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfInt
|
||||
extends OfPrimitive<Integer, IntConsumer, int[], Spliterator.OfInt, Node.OfInt>
|
||||
implements Spliterator.OfInt {
|
||||
|
@ -1169,6 +1176,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfLong
|
||||
extends OfPrimitive<Long, LongConsumer, long[], Spliterator.OfLong, Node.OfLong>
|
||||
implements Spliterator.OfLong {
|
||||
|
@ -1178,6 +1186,7 @@ final class Nodes {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
private static final class OfDouble
|
||||
extends OfPrimitive<Double, DoubleConsumer, double[], Spliterator.OfDouble, Node.OfDouble>
|
||||
implements Spliterator.OfDouble {
|
||||
|
|
|
@ -186,6 +186,7 @@ interface Sink<T> extends Consumer<T> {
|
|||
* {@code accept(int)}, and wires {@code accept(Integer)} to bridge to
|
||||
* {@code accept(int)}.
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
interface OfInt extends Sink<Integer>, IntConsumer {
|
||||
@Override
|
||||
void accept(int value);
|
||||
|
@ -203,6 +204,7 @@ interface Sink<T> extends Consumer<T> {
|
|||
* {@code accept(long)}, and wires {@code accept(Long)} to bridge to
|
||||
* {@code accept(long)}.
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
interface OfLong extends Sink<Long>, LongConsumer {
|
||||
@Override
|
||||
void accept(long value);
|
||||
|
@ -220,6 +222,7 @@ interface Sink<T> extends Consumer<T> {
|
|||
* {@code accept(double)}, and wires {@code accept(Double)} to bridge to
|
||||
* {@code accept(double)}.
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
interface OfDouble extends Sink<Double>, DoubleConsumer {
|
||||
@Override
|
||||
void accept(double value);
|
||||
|
|
|
@ -720,6 +720,7 @@ class SpinedBuffer<E>
|
|||
/**
|
||||
* An ordered collection of {@code int} values.
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
static class OfInt extends SpinedBuffer.OfPrimitive<Integer, int[], IntConsumer>
|
||||
implements IntConsumer {
|
||||
OfInt() { }
|
||||
|
@ -785,6 +786,7 @@ class SpinedBuffer<E>
|
|||
}
|
||||
|
||||
public Spliterator.OfInt spliterator() {
|
||||
@SuppressWarnings("overloads")
|
||||
class Splitr extends BaseSpliterator<Spliterator.OfInt>
|
||||
implements Spliterator.OfInt {
|
||||
Splitr(int firstSpineIndex, int lastSpineIndex,
|
||||
|
@ -833,6 +835,7 @@ class SpinedBuffer<E>
|
|||
/**
|
||||
* An ordered collection of {@code long} values.
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
static class OfLong extends SpinedBuffer.OfPrimitive<Long, long[], LongConsumer>
|
||||
implements LongConsumer {
|
||||
OfLong() { }
|
||||
|
@ -899,6 +902,7 @@ class SpinedBuffer<E>
|
|||
|
||||
|
||||
public Spliterator.OfLong spliterator() {
|
||||
@SuppressWarnings("overloads")
|
||||
class Splitr extends BaseSpliterator<Spliterator.OfLong>
|
||||
implements Spliterator.OfLong {
|
||||
Splitr(int firstSpineIndex, int lastSpineIndex,
|
||||
|
@ -947,6 +951,7 @@ class SpinedBuffer<E>
|
|||
/**
|
||||
* An ordered collection of {@code double} values.
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
static class OfDouble
|
||||
extends SpinedBuffer.OfPrimitive<Double, double[], DoubleConsumer>
|
||||
implements DoubleConsumer {
|
||||
|
@ -1013,6 +1018,7 @@ class SpinedBuffer<E>
|
|||
}
|
||||
|
||||
public Spliterator.OfDouble spliterator() {
|
||||
@SuppressWarnings("overloads")
|
||||
class Splitr extends BaseSpliterator<Spliterator.OfDouble>
|
||||
implements Spliterator.OfDouble {
|
||||
Splitr(int firstSpineIndex, int lastSpineIndex,
|
||||
|
|
|
@ -572,6 +572,7 @@ class StreamSpliterators {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfInt
|
||||
extends OfPrimitive<Integer, IntConsumer, Spliterator.OfInt>
|
||||
implements Spliterator.OfInt {
|
||||
|
@ -581,6 +582,7 @@ class StreamSpliterators {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfLong
|
||||
extends OfPrimitive<Long, LongConsumer, Spliterator.OfLong>
|
||||
implements Spliterator.OfLong {
|
||||
|
@ -590,6 +592,7 @@ class StreamSpliterators {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfDouble
|
||||
extends OfPrimitive<Double, DoubleConsumer, Spliterator.OfDouble>
|
||||
implements Spliterator.OfDouble {
|
||||
|
@ -815,6 +818,7 @@ class StreamSpliterators {
|
|||
protected abstract T_CONS emptyConsumer();
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfInt extends OfPrimitive<Integer, Spliterator.OfInt, IntConsumer>
|
||||
implements Spliterator.OfInt {
|
||||
OfInt(Spliterator.OfInt s, long sliceOrigin, long sliceFence) {
|
||||
|
@ -839,6 +843,7 @@ class StreamSpliterators {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfLong extends OfPrimitive<Long, Spliterator.OfLong, LongConsumer>
|
||||
implements Spliterator.OfLong {
|
||||
OfLong(Spliterator.OfLong s, long sliceOrigin, long sliceFence) {
|
||||
|
@ -863,6 +868,7 @@ class StreamSpliterators {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfDouble extends OfPrimitive<Double, Spliterator.OfDouble, DoubleConsumer>
|
||||
implements Spliterator.OfDouble {
|
||||
OfDouble(Spliterator.OfDouble s, long sliceOrigin, long sliceFence) {
|
||||
|
@ -1128,6 +1134,7 @@ class StreamSpliterators {
|
|||
protected abstract T_BUFF bufferCreate(int initialCapacity);
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfInt
|
||||
extends OfPrimitive<Integer, IntConsumer, ArrayBuffer.OfInt, Spliterator.OfInt>
|
||||
implements Spliterator.OfInt, IntConsumer {
|
||||
|
@ -1163,6 +1170,7 @@ class StreamSpliterators {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfLong
|
||||
extends OfPrimitive<Long, LongConsumer, ArrayBuffer.OfLong, Spliterator.OfLong>
|
||||
implements Spliterator.OfLong, LongConsumer {
|
||||
|
@ -1198,6 +1206,7 @@ class StreamSpliterators {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static final class OfDouble
|
||||
extends OfPrimitive<Double, DoubleConsumer, ArrayBuffer.OfDouble, Spliterator.OfDouble>
|
||||
implements Spliterator.OfDouble, DoubleConsumer {
|
||||
|
|
|
@ -804,6 +804,7 @@ final class Streams {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static class OfInt
|
||||
extends ConcatSpliterator.OfPrimitive<Integer, IntConsumer, Spliterator.OfInt>
|
||||
implements Spliterator.OfInt {
|
||||
|
@ -812,6 +813,7 @@ final class Streams {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static class OfLong
|
||||
extends ConcatSpliterator.OfPrimitive<Long, LongConsumer, Spliterator.OfLong>
|
||||
implements Spliterator.OfLong {
|
||||
|
@ -820,6 +822,7 @@ final class Streams {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("overloads")
|
||||
static class OfDouble
|
||||
extends ConcatSpliterator.OfPrimitive<Double, DoubleConsumer, Spliterator.OfDouble>
|
||||
implements Spliterator.OfDouble {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue