Hi,

I had reported this issue with attached test with behavior I observed, Brian 
and me agreed that SuppressWarnings on either one as in this test case should 
be sufficient.

Cheers,
Henry



On Sep 24, 2013, at 10:14 AM, Paul Sandoz <paul.san...@oracle.com> wrote:

> Hi,
> 
> There is a new warning about overloads on methods with functional interfaces, 
> but it appears to be over-agressive as Doug pointed out to me off-list.
> 
> If i enable this when compiling tl (make JAVAC_WARNINGS:=-Xlint:overloads) 
> then one can observe warnings such as on the primitive spliterators:
> 
> /Users/sandoz/Projects/jdk8/tl/jdk/src/share/classes/java/util/Spliterator.java:642:
>  warning: [overloads] tryAdvance(IntConsumer) in OfInt is potentially 
> ambiguous with tryAdvance(Consumer<? super Integer>) in OfInt
>        boolean tryAdvance(IntConsumer action);
>                ^
> /Users/sandoz/Projects/jdk8/tl/jdk/src/share/classes/java/util/Spliterator.java:645:
>  warning: [overloads] forEachRemaining(IntConsumer) in OfInt is potentially 
> ambiguous with forEachRemaining(Consumer<? super Integer>) in OfInt
>        default void forEachRemaining(IntConsumer action) {
> 
> The warnings propagate down to implementations, for example:
> 
> /Users/sandoz/Projects/jdk8/tl/jdk/src/share/classes/java/util/Random.java:1025:
>  warning: [overloads] tryAdvance(IntConsumer) in RandomIntsSpliterator is 
> potentially ambiguous with tryAdvance(Consumer<? super T>) in Spliterator
>        public boolean tryAdvance(IntConsumer consumer) {
>                       ^
>  where T is a type-variable:
>    T extends Object declared in interface Spliterator
> /Users/sandoz/Projects/jdk8/tl/jdk/src/share/classes/java/util/Random.java:1036:
>  warning: [overloads] forEachRemaining(IntConsumer) in RandomIntsSpliterator 
> is potentially ambiguous with forEachRemaining(Consumer<? super T>) in 
> Spliterator
>        public void forEachRemaining(IntConsumer consumer) {
> 
> (Incidentally it does not appear all warnings are reported, warnings for the 
> double implementations are missing.)
> 
> If I write a SuppressWarnings on Spliterator.OfInt:
> 
>    @SuppressWarnings("overloads")
>    public interface OfInt extends OfPrimitive<Integer, IntConsumer, OfInt> {
> 
> then that stops the first set of warnings (above) but the warnings are still 
> propagated to the second set for Random (or in general implementations or 
> extensions of). That seems over aggressive and more of an annoyance than 
> helpful. Can we change this?
> 
> Paul.

Reply via email to