JDK-8066379 : javac 1.7/1.8 rejects to compile code though javac 1.6 accepts the code
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8u25
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2014-10-31
  • Updated: 2014-12-24
  • Resolved: 2014-12-24
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
the code fails to compile
{code}
interface StubElement<T>{
    T getPsi();
}

abstract class StubElementBase<T> implements StubElement<T> {
    @Override
    public T getPsi() {
        return null;
    }
}

abstract class MyStubbedElement<T extends StubElementBase<?> & Runnable>  {}

{code}

error message: Error:(14, 33) java: getPsi() in aa.StubElementBase cannot implement getPsi() in aa.StubElement
  return type capture#1 of ? is not compatible with capture#2 of ?

BTW

if we would omit Runnable in type parameter declaration, then the code would compile. Moreover if  StubElementBase<T> would be an interface with default method, then the code also would compile.

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

REGRESSION.  Last worked in version 6u43

REPRODUCIBILITY :
This bug can be reproduced always.


Comments
Moved to tools->javac However it is perfectly valid for later compilers to reject code that was erroneously accepted by earlier ones.
02-12-2014