javac fails the following test:
/*
* @test @(#)T4720356a.java 1.1 02/07/26
* @bug 4720356
* @summary compiler fails to check cross-package overriding
* @author gafter
*
* @compile/fail T4720356a.java T4720356b.java
*/
package p1;
public class T4720356a {
void m() {}
}
class T4720356c extends p2.T4720356b {
// conflicting return type, even though a.m() not inherited
public int m() { return 1; }
}
package p2;
public class T4720356b extends p1.T4720356a {
public int m() { return 1; }
}
/*
* @test @(#)T4720356a.java 1.1 02/07/26
* @bug 4720356
* @summary compiler fails to check cross-package overriding
* @author gafter
*
* @compile/fail T4720356a.java T4720356b.java
*/
package p1;
public class T4720356a {
void m() {}
}
class T4720356c extends p2.T4720356b {
// conflicting return type, even though a.m() not inherited
public int m() { return 1; }
}
package p2;
public class T4720356b extends p1.T4720356a {
public int m() { return 1; }
}
- duplicates
-
JDK-4728115 Compiler allows incompatible methods to override methods in indirect superclass
- Closed