[java-shib-shared] branch main updated: IDP-2083 - Treat NonnullElements as the default for collections

Scott Cantor cantor.2 at osu.edu
Fri Apr 7 17:19:49 UTC 2023


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=165034a69cefb4ff0b3f893fcdea653688bd5d00

The following commit(s) were added to refs/heads/main by this push:
     new 165034a6 IDP-2083 - Treat NonnullElements as the default for collections
165034a6 is described below

commit 165034a69cefb4ff0b3f893fcdea653688bd5d00
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Apr 7 13:19:46 2023 -0400

    IDP-2083 - Treat NonnullElements as the default for collections
    
    https://shibboleth.atlassian.net/browse/IDP-2083
    
    Allow NonnullElements to appear on packages.
    Add a NonnullBeforeExec as a companion to NonnullAfterInit.
---
 .../{NonnullElements.java => NonnullBeforeExec.java}    | 17 ++++++-----------
 .../shared/annotation/constraint/NonnullElements.java   |  5 ++++-
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullElements.java b/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullBeforeExec.java
similarity index 68%
copy from shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullElements.java
copy to shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullBeforeExec.java
index 6c52d4a5..5b56c2fd 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullElements.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullBeforeExec.java
@@ -22,19 +22,14 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Target;
 
 /**
- * Indicates that the annotated collection cannot contain any null elements:
+ * Indicates that the annotated item will not be null by the time the component's
+ * primary "do work" method is invoked.
  * 
- * <ul>
- * <li>Input collections as parameters MUST NOT contain any null elements.</li>
- * <li>Collections returned by methods WILL NOT contain any null elements, and if mutable,
- * callers MUST NOT add a null element.</li>
- * </ul>
- * 
- * <p>Behavior is undefined if these constraints are violated. Some form of exception should be
- * expected.</p>
+ * <p>This is typically used to annotate fields (or getters) that are given a value during
+ * a prepatory phase but after the component's initialization (if it has such a concept).
  */
 @Documented
- at Target({ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PARAMETER})
-public @interface NonnullElements {
+ at Target({ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD})
+public @interface NonnullBeforeExec {
 
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullElements.java b/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullElements.java
index 6c52d4a5..3ab49138 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullElements.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/NonnullElements.java
@@ -30,11 +30,14 @@ import java.lang.annotation.Target;
  * callers MUST NOT add a null element.</li>
  * </ul>
  * 
+ * <p>When applied to a package, signifies that all collections used as parameters or return
+ * values within the package are implicitly carrying this annotation.</p> 
+ * 
  * <p>Behavior is undefined if these constraints are violated. Some form of exception should be
  * expected.</p>
  */
 @Documented
- at Target({ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PARAMETER})
+ at Target({ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PARAMETER, ElementType.PACKAGE})
 public @interface NonnullElements {
 
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list