Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 418233 - [compiler][null] Bogus error Illegal redefinition of parameter when using default nullness on an inner interface
Summary: [compiler][null] Bogus error Illegal redefinition of parameter when using def...
Status: RESOLVED DUPLICATE of bug 415269
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-27 20:15 EDT by Marco Fucci CLA
Modified: 2013-10-08 09:00 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Fucci CLA 2013-09-27 20:15:30 EDT
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);
  }
}
Comment 1 Stephan Herrmann CLA 2013-10-03 13:36:13 EDT
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.
Comment 2 Stephan Herrmann CLA 2013-10-06 13:33:03 EDT
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 ***
Comment 3 Stephan Herrmann CLA 2013-10-08 08:59:50 EDT
Anyway I added the test case from this bug via http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=a56497daff3e8ff98b1a39d2dc846ed662f326d8