Community
Participate
Working Groups
Bug is reproducible with Eclipse 3.8 and 4.3 What steps will reproduce the problem? Attached project reproduces the bug. 1 _ import the project (link to correct jdk if needed) 2 _ open Implementations.java 3 _ an error appears on Object: Illegal redefinition of parameter o, inherited method from Interface.InnerInterface does not constrain this parameter What is the expected output? What do you see instead? o is defined in InnerInterface a non-null by default, so there should be no error at this point. Implementation of containing interface doesn't report the error. The bug seems to be in the incremental compiler, since error is not reported in "Problems" This is blocking to enable null analysis on complex projects... Tested code: @ParametersAreNonnullByDefault public class Implementations implements Interfaces.InnerInterface { public class Implementation implements Interfaces { @Override public Object doSomething(Object o) { return o; } } @Override public Object doSomethingElse(Object o) { // <-- incorrect error here return o; } } @ParametersAreNonnullByDefault public interface Interfaces { Object doSomething(Object o); // Adding @ParametersAreNonnullByDefault reports an error public interface InnerInterface { Object doSomethingElse(Object o); } }
I can reproduce in 4.3.1. The reconciler has a problem regarding the point in time when getAnnotationTagBits() is invoked for "Interfaces". At the time of STB.resolveTypesFor() being called for InnerInterface.doSomethingElse, we don't yet have the tagBits for the enclosing type Interfaces. Hence the default is not applied to this method. I'll take a look how we can fix this.
It turns out that this has already been fixed via bug 415269 (as of 4.4M2) *** This bug has been marked as a duplicate of bug 415269 ***
Anyway I added the test case from this bug via http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=a56497daff3e8ff98b1a39d2dc846ed662f326d8