move nullaway article

This commit is contained in:
Loredana
2020-03-19 22:38:01 +02:00
parent af27b7f8a0
commit f3d7a9d5fe
6 changed files with 123 additions and 60 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);
}
}