Title: What does using @NonNull on a void method do?
Tags: java;lombok
Question: What's the point in Lombok annotation @NonNull for a method?
class MyClass {
@NonNull
void run() {
// code here
Are we check the instance of class MyClass (MyClass obj == null)?
Comment: @blank: This isn't on a parameter though.

Here is the accepted answer: For a void method, there's no point.
For a method with a return type, it shows that it won't return null:
@NonNull String foo() {
// I promise I won't return null herre!
Judging by the tutorial, it looks like it won't generate a check within the method to ensure that it isn't null, but it tells any caller that they can realistically expect a non-null value to be returned.
Comment for this answer: https://github.com/rzwitserloot/lombok/issues/907 - Lombok developers refused to generate `null` check for return values ((

Here is another answer: You can use @NonNull on the parameter of a method or constructor to have lombok generate a null-check statement for you.
Lombok has always treated any annotation named @NonNull on a field as a signal to generate a null-check if lombok generates an entire method or constructor for you, via for example @Data. Now, however, using lombok's own @lombok.NonNull on a parameter results in the insertion of just the null-check statement inside your own method or constructor.
Comment for this answer: ok, ok... I search here (http://homepages.ecs.vuw.ac.nz/~djp/JACK/) and I can sy that @NonNull is to avoid null objects at the method. Hope this can help....
Comment for this answer: Yes, I know. But the question is about `void method` without parameters. In my opinion if we can use such annotation in mentioned case than `Lombok` has some misleading stuff here. Because it's pointless to use @NonNull here.
Comment for this answer: @user3430490 You are just plagiarising [the docs](http://projectlombok.org/features/NonNull.html) without giving a reference or highlighting it as a quote, and without answering the question.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:01/14/15', 'FavoriteCount': 2.0, 'PostTypeId': 1, 'Tags': '<java><lombok>', 'Title': 'What does using @NonNull on a void method do?', 'ViewCount': 7182, 'id': 27947978, 'user_AboutMe': '', 'user_AccountId': 4572825.0, 'user_DisplayName': 'barbara', 'user_Reputation': 2981.0, 'user_Views': 202.0, 'user_id': 3712077.0}}