Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid Eclipse warnings about lombok.NonNull when NonNullByDefault is used #2155

Merged
merged 1 commit into from Jul 8, 2019

Conversation

brychcy
Copy link
Contributor

@brychcy brychcy commented Jun 15, 2019

When annotations based null analysis is enabled in Eclipse and NonNullByDefault is in effect, @lombok.NonNull causes warning, e.g. in the following example:

import org.eclipse.jdt.annotation.NonNullByDefault;
import lombok.NonNull;

@NonNullByDefault
public class App {
	String f(@NonNull String s) {
		return s;
	}
}

two warnings are reported at the @NonNull annotation:

  • Dead code
  • Redundant null check: comparing '@NonNull String' against null

(obviously, both warnings are only reported when enabled in the Compiler preferences)

@rzwitserloot
Copy link
Collaborator

Wow, when I read this I was totally expecting a scan for the @NonNullByDefault annotation, but this is a much better way to go about it. Let me just review this first, but this is the right approach.

@rzwitserloot rzwitserloot merged commit 93540b2 into projectlombok:master Jul 8, 2019
@rzwitserloot
Copy link
Collaborator

@brychcy Can you send another PR where you add your name to the AUTHORS file? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants