diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-05-31 01:03:38 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-05-31 01:03:38 +0200 |
commit | 5a3e9bd8049469169410107011ad0e26b3b629e3 (patch) | |
tree | a299ccfa863901639679e165f29cc775cb14abd0 /src/core/lombok/NonNull.java | |
parent | 7bbb7cf3ca25cb8727a6ec226de1ed1fc5bf47e9 (diff) | |
download | lombok-5a3e9bd8049469169410107011ad0e26b3b629e3.tar.gz lombok-5a3e9bd8049469169410107011ad0e26b3b629e3.tar.bz2 lombok-5a3e9bd8049469169410107011ad0e26b3b629e3.zip |
Added @NonNull on parameters feature (issue 514),
including docs and changelog.
Diffstat (limited to 'src/core/lombok/NonNull.java')
-rw-r--r-- | src/core/lombok/NonNull.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/lombok/NonNull.java b/src/core/lombok/NonNull.java index 5f5d8ed2..96813170 100644 --- a/src/core/lombok/NonNull.java +++ b/src/core/lombok/NonNull.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 The Project Lombok Authors. + * Copyright (C) 2009-2013 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,12 +28,14 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Lombok is smart enough to translate any annotation named {@code @NonNull} in any casing and - * with any package name to the return type of generated getters and the parameter of generated setters and constructors, - * as well as generate the appropriate null checks in the setter and constructor. - * - * You can use this annotation for the purpose, though you can also use JSR305's annotation, findbugs's, pmd's, or IDEA's, or just - * about anyone elses. As long as it is named {@code @NonNull}. + * If put on a parameter, lombok will insert a null-check at the start of the method / constructor's body, throwing a + * {@code NullPointerException} with the parameter's name as message. If put on a field, any generated method assigning + * a value to this field will also produce these nullchecks. + * <p> + * Note that any annotation named {@code NonNull} with any casing and any package will result in nullchecks produced for + * generated methods (and the annotation will be copied to the getter return type and any parameters of generated methods), + * but <em>only</em> this annotation, if present on a parameter, will result in a null check inserted into your otherwise + * handwritten method. * * WARNING: If the java community ever does decide on supporting a single {@code @NonNull} annotation (for example via JSR305), then * this annotation will <strong>be deleted</strong> from the lombok package. If the need to update an import statement scares |