Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 514213

Summary: [1.8][null] Avoid creating redundant @NonNull in "Create method"-quick fixes
Product: [Eclipse Project] JDT Reporter: Till Brychcy <register.eclipse>
Component: UIAssignee: Till Brychcy <register.eclipse>
Status: RESOLVED FIXED QA Contact: Stephan Herrmann <stephan.herrmann>
Severity: normal    
Priority: P3 CC: stephan.herrmann
Version: 4.7   
Target Milestone: 4.7 M7   
Hardware: PC   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/93855
https://bugs.eclipse.org/bugs/show_bug.cgi?id=443146
https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=4a865d9b19d39a5c60658d19722fe4a665ec5478
Whiteboard:

Description Till Brychcy CLA 2017-03-25 17:34:10 EDT
1) quick fixes for @Override of a method that doesn't exist, e.g.
package test1;

import java.util.Comparator;
import java.util.List;
import java.util.Map;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

@NonNullByDefault({})
interface I1 {
}

interface I2 {1
}

class X implements I1, I2 {
	@Override
	public Comparator<List<? extends Map<@Nullable Number, String[]>>> @Nullable [] f(Number n1, @Nullable Number n2) {
		return null;
	}
}

2) quick fixes for invocation of method that doesn't exist, e.g.
package test1;

import java.util.Comparator;
import java.util.List;
import java.util.Map;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

@NonNullByDefault({})
interface I1 {
}

interface I2 {
}

class X {
	public boolean f(Number n1, @Nullable Number n2, I1 i1, I2 i2) {
		Comparator<List<? extends Map<@Nullable Number, String[]>>> @Nullable [] x1 = i1.g(n1, n2);
		Comparator<List<? extends Map<@Nullable Number, String[]>>> @Nullable [] x2 = i2.g(n1, n2);
		return x1 == x2;
	}
}
Comment 1 Eclipse Genie CLA 2017-03-25 17:40:33 EDT
New Gerrit change created: https://git.eclipse.org/r/93855
Comment 2 Stephan Herrmann CLA 2017-03-25 17:42:52 EDT
How does this relate to bug 463360?
Comment 3 Till Brychcy CLA 2017-03-25 17:49:01 EDT
(In reply to Stephan Herrmann from comment #2)
> How does this relate to bug 463360?

Looks like that one was for declaration annotations, this one is for type annotations.
Actually I now see that this is a duplicate for bug 465335
Comment 4 Till Brychcy CLA 2017-03-25 18:04:47 EDT
*** Bug 465335 has been marked as a duplicate of this bug. ***
Comment 5 Till Brychcy CLA 2017-03-31 17:37:16 EDT
In patch set 2 I've just updated the copyright years.

@Stephan, I think this is ready to be commited, can you please do that? TIA
Comment 6 Stephan Herrmann CLA 2017-04-09 08:03:49 EDT
Side-effect of reviewing this bug: bug 335012 comment 5
Comment 8 Stephan Herrmann CLA 2017-04-09 09:14:15 EDT
(In reply to Eclipse Genie from comment #7)
> Gerrit change https://git.eclipse.org/r/93855 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=4a865d9b19d39a5c60658d19722fe4a665ec5478
> 

Rebased
Reviewed
Released for 4.7 M7.