JDK-8067858 : Method hiding regression
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2014-12-18
  • Updated: 2015-01-12
  • Resolved: 2015-01-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Description
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 ----------


Comments
This problem has been caused by JDK-8033718. Fixing that type-system issue caused some most specific issues - this is being tracked in JDK-8039214.
12-01-2015

Test case compiled with error as mentioned in the report with JDK 9ea. However, with JDK 8u25 and 8u40 it compiled fine.
18-12-2014