This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
There's a Java bug "Problem with interfaces and covariant return type overriding", see: http://bugs.sun.com/view_bug.do?bug_id=6656332 I extended their sample a little, see below. I'm using JDK 1.6.0 (apparently this bug is fixed in 1.7). No error is indicated in the edit window. If you clean and build, you do get a compile error, as expected. The curious thing is that if you run, the code executes fine without any error messages. public class NewClass { // see http://bugs.sun.com/view_bug.do?bug_id=6656332 interface A { A m(); } interface B extends A { B m(); } interface C extends A { C m(); } interface D extends B,C { D m(); } public class X implements D { public D m() { return new X(); } public String method() { return "HELLO"; } } public X getX() { return (X) new X().m(); } public static void main(String[] args) { NewClass nc = new NewClass(); System.out.println("TEST " + nc.getX().method()); } }
You probably have "Compile On Save" on. Your source gets compiled by the NB internal compiler (which is based on 7.0 javac) and the compiled class is executed.