Moved NullAwayExample.java to libraries-3.

Updated the libraries-3 README
This commit is contained in:
Greg Martin
2020-03-16 16:55:14 -04:00
parent b60b729906
commit 0a5fbbe0e7
2 changed files with 1 additions and 0 deletions
@@ -1,24 +0,0 @@
package com.baeldung.nullaway;
import com.baeldung.distinct.Person;
public class NullAwayExample {
/*
* 1- NullAway will warn about yearsToRetirement method
* 2- Uncomment @Nullable in printAge and NullAway will warn about this method
* 3- Add a standard null check to be NullAway compliant
* 4- Build will be SUCCESS
*/
static Integer getAge(/*@Nullable*/ Person person) {
return person.getAge();
}
Integer yearsToRetirement() {
Person p = null;
// ... p never gets set correctly...
return 65 - getAge(p);
}
}