FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin x86_64
A DESCRIPTION OF THE PROBLEM :
The fix for JDK-8033718 prevents the attached code from compiling.
https://bugs.openjdk.java.net/browse/JDK-8033718
http://hg.openjdk.java.net/jdk9/dev/langtools/rev/54a460e0ac76
REGRESSION. Last worked in version 8u25
ADDITIONAL REGRESSION INFORMATION:
javac 9-dev after revision 54a460e0ac76
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The compilation succeeds with earlier versions of javac.
ACTUAL -
The compilation fails.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Test.java:9: error: reference to not is ambiguous
return UnaryFilter.<T> not(filter);
^
both method <T#1>not(Filter<? super T#1>) in Filter and method <T#2>not(Filter<? super T#2>) in UnaryFilter match
where T#1,T#2 are type-variables:
T#1 extends Number declared in method <T#1>not(Filter<? super T#1>)
T#2 extends Number declared in method <T#2>not(Filter<? super T#2>)
Test.java:3: error: reference to not is ambiguous
return UnaryFilter.<T> not(filter);
^
both method <T#1>not(Filter<? super T#1>) in Filter and method <T#2>not(Filter<? super T#2>) in UnaryFilter match
where T#1,T#2 are type-variables:
T#1 extends Number declared in method <T#1>not(Filter<? super T#1>)
T#2 extends Number declared in method <T#2>not(Filter<? super T#2>)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class UnaryFilter<S extends Number> extends Filter<S> {
public static <T extends Number> Filter<T> not(Filter<? super T> filter) {
return UnaryFilter.<T> not(filter);
}
}
class Filter<S extends Number> {
public static <T extends Number> Filter<T> not(Filter<? super T> filter) {
return UnaryFilter.<T> not(filter);
}
}
---------- END SOURCE ----------