[java-shib-shared] 01/02: IDP-2083 - Treat NonnullElements as the default for collections

Scott Cantor cantor.2 at osu.edu
Fri Apr 21 18:31:50 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=121fbd4df42bef40df60eda153bf6f57a76ca0f9

commit 121fbd4df42bef40df60eda153bf6f57a76ca0f9
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Apr 21 14:30:31 2023 -0400

    IDP-2083 - Treat NonnullElements as the default for collections
    
    https://shibboleth.atlassian.net/browse/IDP-2083
    
    Add some XML helpers to clean up more warnings.
    Review shib-support and annotate those packages.
---
 .../shared/annotation/constraint/package-info.java |  1 +
 .../shibboleth/shared/annotation/package-info.java |  5 ++-
 .../net/shibboleth/shared/codec/HTMLEncoder.java   | 15 ++++---
 .../shibboleth/shared/codec/StringDigester.java    |  5 ++-
 .../net/shibboleth/shared/codec/package-info.java  |  5 ++-
 .../shared/collection/ClassIndexedSet.java         | 20 +++++----
 .../shared/collection/IndexingObjectStore.java     | 13 +++---
 .../net/shibboleth/shared/collection/Pair.java     |  4 +-
 .../shared/collection/ValueTypeIndexedMap.java     | 22 ++++++----
 .../shibboleth/shared/collection/package-info.java |  4 +-
 .../shibboleth/shared/component/package-info.java  |  6 ++-
 .../shibboleth/shared/logic/AllMatchPredicate.java |  6 ++-
 .../shibboleth/shared/logic/AnyMatchPredicate.java |  6 ++-
 .../logic/CaseInsensitiveStringMatchPredicate.java |  3 +-
 .../net/shibboleth/shared/logic/Constraint.java    | 12 +++---
 .../shibboleth/shared/logic/FunctionSupport.java   |  2 +-
 .../shibboleth/shared/logic/NonnullFunction.java   |  2 +-
 .../shibboleth/shared/logic/RegexPredicate.java    |  1 +
 .../shared/logic/StrategyIndirectedPredicate.java  |  6 ++-
 .../shared/logic/TransformAndCheckFunction.java    | 11 +++--
 .../net/shibboleth/shared/logic/package-info.java  |  5 ++-
 .../shared/primitive/CleanerSupport.java           |  3 +-
 .../shared/primitive/DeprecationSupport.java       |  5 +--
 .../shibboleth/shared/primitive/LoggerFactory.java | 10 ++---
 .../shared/primitive/NonnullSupplier.java          |  3 +-
 .../shibboleth/shared/primitive/ObjectSupport.java |  5 ++-
 .../shibboleth/shared/primitive/StringSupport.java |  4 +-
 .../shibboleth/shared/primitive/package-info.java  |  5 ++-
 .../shibboleth/shared/resolver/CriteriaSet.java    |  9 ++--
 .../resolver/CriterionPredicateRegistry.java       |  4 +-
 .../net/shibboleth/shared/resolver/Resolver.java   |  5 +--
 .../shibboleth/shared/resolver/package-info.java   |  4 +-
 .../shared/scripting/AbstractScriptEvaluator.java  |  4 +-
 .../shibboleth/shared/scripting/package-info.java  |  4 +-
 .../shibboleth/shared/xml/AttributeSupport.java    | 36 ++++++++++------
 .../shibboleth/shared/xml/ClasspathResolver.java   |  3 +-
 .../net/shibboleth/shared/xml/ElementSupport.java  | 31 +++++++++++---
 .../java/net/shibboleth/shared/xml/ParserPool.java |  3 +-
 .../net/shibboleth/shared/xml/QNameSupport.java    | 22 ++++++++++
 .../net/shibboleth/shared/xml/SchemaBuilder.java   | 19 ++++----
 .../shibboleth/shared/xml/SerializeSupport.java    |  2 +-
 .../java/net/shibboleth/shared/xml/XMLSpace.java   |  7 ++-
 .../shared/xml/impl/BasicParserPool.java           | 50 ++++++++++++----------
 .../shibboleth/shared/xml/impl/package-info.java   |  5 ++-
 .../net/shibboleth/shared/xml/package-info.java    |  5 ++-
 45 files changed, 252 insertions(+), 150 deletions(-)

diff --git a/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/package-info.java
index 76f24000..7c4d9ccd 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/annotation/constraint/package-info.java
@@ -20,4 +20,5 @@
  * for documentation purposes only.  They do not have any effect on the executing code.  Use a JSR-303 implementation
  * if that's what you're after.
  */
+ at NonnullElements
 package net.shibboleth.shared.annotation.constraint;
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/annotation/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/annotation/package-info.java
index 8b2b7cc0..f4b90f00 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/annotation/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/annotation/package-info.java
@@ -18,4 +18,7 @@
 /** 
  * A set of annotations used to document information about methods, fields, parameters, etc.
  */
-package net.shibboleth.shared.annotation;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.shared.annotation;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/codec/HTMLEncoder.java b/shib-support/src/main/java/net/shibboleth/shared/codec/HTMLEncoder.java
index 9849f76d..d115daac 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/codec/HTMLEncoder.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/codec/HTMLEncoder.java
@@ -33,13 +33,17 @@
 
 package net.shibboleth.shared.codec;
 
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
 /**
  * An HTML encoder derived from the OWASP ESAPI project. The encoded output will be safe for an HTML interpreter as
  * unsafe characters are translated into their safe equivalent.
@@ -62,10 +66,11 @@ public final class HTMLEncoder {
     public static final char REPLACEMENT_CHAR = '\ufffd';
 
     /** Hex to replace illegal characters. */
-    @Nonnull public static final String REPLACEMENT_HEX = "fffd";
+    @Nonnull @NotEmpty public static final String REPLACEMENT_HEX = "fffd";
 
     /** Map from entity character to name. */
-    @Nonnull private static final Map<Character, String> CHARACTER_TO_ENTITY_MAP = mkCharacterToEntityMap();
+    @Nonnull @Unmodifiable @NotLive private static final Map<Character, String> CHARACTER_TO_ENTITY_MAP =
+            mkCharacterToEntityMap();
 
     /**
      * Initialize an array to mark which characters are to be encoded. Store the hex string for that character to save
@@ -214,7 +219,7 @@ public final class HTMLEncoder {
      * @return unmodifiable map from entity character to name
      */
     // Checkstyle: MethodLength|TrailingComment OFF -- copied from OWASP ESAPI.
-    @Nonnull private static synchronized Map<Character, String> mkCharacterToEntityMap() {
+    @Nonnull @Unmodifiable @NotLive private static synchronized Map<Character, String> mkCharacterToEntityMap() {
         final Map<Character, String> map = new HashMap<>(252);
 
         map.put((char) 34, "quot"); /* quotation mark */
@@ -472,7 +477,7 @@ public final class HTMLEncoder {
 
         // Checkstyle: MethodLength|TrailingComment ON
 
-        return Collections.unmodifiableMap(map);
+        return CollectionSupport.copyToMap(map);
     }
 
 }
diff --git a/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java b/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
index 6185aafb..db373bd5 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
@@ -55,6 +55,7 @@ public final class StringDigester implements Function<String,String> {
     };
     
     /** The default input character set.*/
+    @SuppressWarnings("null")
     @Nonnull public static final Charset DEFAULT_INPUT_CHARSET = Charset.forName(CharEncoding.UTF_8);
     
     /** Logger. */
@@ -85,7 +86,7 @@ public final class StringDigester implements Function<String,String> {
      * @throws NoSuchAlgorithmException thrown if the digestAlgorithm is not invalid or unsupported
      */
     public StringDigester(@Nonnull @NotEmpty @ParameterName(name="algorithm") final String algorithm, 
-            @Nonnull  @ParameterName(name="format") final OutputFormat format) 
+            @Nonnull @ParameterName(name="format") final OutputFormat format) 
             throws NoSuchAlgorithmException {
        this(algorithm, format, DEFAULT_INPUT_CHARSET); 
     }
@@ -141,7 +142,7 @@ public final class StringDigester implements Function<String,String> {
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public String apply(@Nullable final String input) {
+    @Nullable public String apply(@Nullable final String input) {
         String trimmed = StringSupport.trimOrNull(input);
         if (trimmed == null) {
             log.debug("Trimmed input was null, returning null");
diff --git a/shib-support/src/main/java/net/shibboleth/shared/codec/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/codec/package-info.java
index 1768f175..54011db0 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/codec/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/codec/package-info.java
@@ -16,4 +16,7 @@
  */
 
 /** A set of helper functions for encoding/decoding data to/from different formats. */
-package net.shibboleth.shared.codec;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.shared.codec;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/ClassIndexedSet.java b/shib-support/src/main/java/net/shibboleth/shared/collection/ClassIndexedSet.java
index 189393b6..be0b942e 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/ClassIndexedSet.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/ClassIndexedSet.java
@@ -37,10 +37,10 @@ import net.shibboleth.shared.logic.Constraint;
 public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
 
     /** Storage for set members. */
-    private final HashSet<T> set;
+    @Nonnull private final HashSet<T> set;
 
     /** Storage for index of class -> member. */
-    private final HashMap<Class<? extends T>, T> index;
+    @Nonnull private final HashMap<Class<? extends T>, T> index;
 
     /**
      * Constructor.
@@ -92,7 +92,7 @@ public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
     }
 
     /** {@inheritDoc} */
-    public boolean remove(@Nullable final Object o) {
+    public boolean remove(final Object o) {
         if (o != null && set.contains(o)) {
             removeFromIndex((T) o);
             set.remove(o);
@@ -152,7 +152,7 @@ public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
      * 
      * @param o the object to remove
      */
-    private void removeFromIndex(final T o) {
+    private void removeFromIndex(@Nonnull final T o) {
         index.remove(getIndexClass(o));
     }
     
@@ -186,10 +186,10 @@ public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
     protected class ClassIndexedSetIterator implements Iterator<T> {
 
         /** The set instance over which this instance is an iterator. */
-        private final ClassIndexedSet<T> set;
+        @Nonnull private final ClassIndexedSet<T> set;
 
         /** The iterator for the owner's underlying storage. */
-        private final Iterator<T> iterator;
+        @Nonnull private final Iterator<T> iterator;
 
         /** Flag which tracks whether next() has been called at least once. */
         private boolean nextCalled;
@@ -200,7 +200,7 @@ public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
         /**
          * The element most recently returned by next(), and the target for any subsequent remove() operation.
          */
-        private T current;
+        @Nullable private T current;
 
         /**
          * Constructor.
@@ -208,7 +208,8 @@ public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
          * @param parentSet the {@link ClassIndexedSet} over which this instance is an iterator
          * @param parentIterator the iterator for the parent's underlying storage
          */
-        protected ClassIndexedSetIterator(final ClassIndexedSet<T> parentSet, final Iterator<T> parentIterator) {
+        protected ClassIndexedSetIterator(@Nonnull final ClassIndexedSet<T> parentSet,
+                @Nonnull final Iterator<T> parentIterator) {
             set = parentSet;
             iterator = parentIterator;
             current = null;
@@ -231,13 +232,14 @@ public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
 
         /** {@inheritDoc} */
         public void remove() {
-            if (!nextCalled) {
+            if (!nextCalled || current == null) {
                 throw new IllegalStateException("remove() was called before calling next()");
             }
             if (!removeStateValid) {
                 throw new IllegalStateException("remove() has already been called since the last call to next()");
             }
             iterator.remove();
+            assert current != null;
             set.removeFromIndex(current);
             removeStateValid = false;
         }
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/IndexingObjectStore.java b/shib-support/src/main/java/net/shibboleth/shared/collection/IndexingObjectStore.java
index 4c8d3b16..343a128a 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/IndexingObjectStore.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/IndexingObjectStore.java
@@ -22,6 +22,7 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import javax.annotation.Nonnull;
 import javax.annotation.concurrent.ThreadSafe;
 
 /**
@@ -55,13 +56,13 @@ import javax.annotation.concurrent.ThreadSafe;
 public class IndexingObjectStore<T> {
 
     /** Read/Write lock used to control synchronization over the backing data store. */
-    private ReadWriteLock rwLock;
+    @Nonnull private ReadWriteLock rwLock;
 
     /** Backing object data store. */
-    private Map<String, StoredObjectWrapper> objectStore;
+    @Nonnull private Map<String, StoredObjectWrapper> objectStore;
     
     /** Map of object instances to the index value used to reference them externally. */
-    private Map<T, Integer> indexStore;
+    @Nonnull private Map<T, Integer> indexStore;
     
     /** The last index sequence used. */
     private int lastIndex;
@@ -266,7 +267,7 @@ public class IndexingObjectStore<T> {
     private class StoredObjectWrapper {
 
         /** The stored object. */
-        private T object;
+        @Nonnull private T object;
 
         /** The object reference count. */
         private int referenceCount;
@@ -276,7 +277,7 @@ public class IndexingObjectStore<T> {
          * 
          * @param wrappedObject the object being wrapped
          */
-        public StoredObjectWrapper(final T wrappedObject) {
+        public StoredObjectWrapper(@Nonnull final T wrappedObject) {
             object = wrappedObject;
             referenceCount = 0;
         }
@@ -286,7 +287,7 @@ public class IndexingObjectStore<T> {
          * 
          * @return the wrapped object
          */
-        public T getObject() {
+        @Nonnull public T getObject() {
             return object;
         }
 
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/Pair.java b/shib-support/src/main/java/net/shibboleth/shared/collection/Pair.java
index 2be1a60d..4a9e728b 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/Pair.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/Pair.java
@@ -34,10 +34,10 @@ import net.shibboleth.shared.logic.Constraint;
 public class Pair<T1, T2> {
 
     /** First object in pair. */
-    private T1 first;
+    @Nullable private T1 first;
 
     /** Second object in pair. */
-    private T2 second;
+    @Nullable private T2 second;
 
     /** Constructor. */
     public Pair() {
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/ValueTypeIndexedMap.java b/shib-support/src/main/java/net/shibboleth/shared/collection/ValueTypeIndexedMap.java
index e275b89a..056c2885 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/ValueTypeIndexedMap.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/ValueTypeIndexedMap.java
@@ -24,6 +24,9 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 /**
  * Map implementation which allows subsets of entries to be retrieved based on the type of the entry value.
  * 
@@ -36,13 +39,13 @@ public class ValueTypeIndexedMap<KeyType, ValueType> implements Map<KeyType, Val
     private static class NullValue {}
 
     /** Storage for index of class -> members. */
-    private Map<Class<?>, Map<KeyType, ValueType>> index;
+    @Nonnull private Map<Class<?>, Map<KeyType, ValueType>> index;
 
     /** Storage for map members. */
-    private Map<KeyType, ValueType> map;
+    @Nonnull private Map<KeyType, ValueType> map;
 
     /** Set of valid types for this map. */
-    private Set<Class<?>> types;
+    @Nonnull private Set<Class<?>> types;
 
     /** Constructor. */
     public ValueTypeIndexedMap() {
@@ -55,7 +58,8 @@ public class ValueTypeIndexedMap<KeyType, ValueType> implements Map<KeyType, Val
      * @param newMap existing map to build from.
      * @param newTypes collection of value types to index
      */
-    public ValueTypeIndexedMap(final Map<KeyType, ValueType> newMap, final Collection<Class<?>> newTypes) {
+    public ValueTypeIndexedMap(@Nonnull final Map<KeyType, ValueType> newMap,
+            @Nonnull final Collection<Class<?>> newTypes) {
         map = newMap;
         types = new HashSet<>(newTypes);
         index = new HashMap<>();
@@ -67,7 +71,7 @@ public class ValueTypeIndexedMap<KeyType, ValueType> implements Map<KeyType, Val
      * 
      * @param newTypes collection of value types to index
      */
-    public ValueTypeIndexedMap(final Collection<Class<?>> newTypes) {
+    public ValueTypeIndexedMap(@Nonnull final Collection<Class<?>> newTypes) {
         this(new HashMap<KeyType, ValueType>(), newTypes);
     }
 
@@ -123,8 +127,8 @@ public class ValueTypeIndexedMap<KeyType, ValueType> implements Map<KeyType, Val
      * @param object object to check
      * @return true if the object is of the specified type
      */
-    private Boolean matchType(final Class<?> type, final Object object) {
-        return type.isInstance(object) || (type == NullValue.class && object == null);
+    private boolean matchType(final Class<?> type, final Object object) {
+        return type.isInstance(object) || type == NullValue.class && object == null;
     }
 
     /** {@inheritDoc} */
@@ -200,7 +204,7 @@ public class ValueTypeIndexedMap<KeyType, ValueType> implements Map<KeyType, Val
      * 
      * @param newTypes which value types are indexed
      */
-    public void setTypes(final Collection<Class<?>> newTypes) {
+    public void setTypes(@Nonnull final Collection<Class<?>> newTypes) {
         types = new HashSet<>(newTypes);
     }
 
@@ -218,7 +222,7 @@ public class ValueTypeIndexedMap<KeyType, ValueType> implements Map<KeyType, Val
      *         this map.
      */
     @SuppressWarnings("unchecked")
-    public <SubType extends ValueType> Map<KeyType, SubType> subMap(final Class<SubType> type) {
+    public <SubType extends ValueType> Map<KeyType, SubType> subMap(@Nullable final Class<SubType> type) {
         Class<?> key = type;
         if (key == null) {
             key = NullValue.class;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/collection/package-info.java
index 1608259f..caa41fe7 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/package-info.java
@@ -16,5 +16,7 @@
  */
 
 /** Additional implementations of, and helpers for working with, collections. */
+ at NonnullElements
+package net.shibboleth.shared.collection;
 
-package net.shibboleth.shared.collection;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/component/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/component/package-info.java
index f20c6239..02fbf4ec 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/component/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/component/package-info.java
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
-/** Set of interfaces used to describe basic features of "components" or "modules" within a larger system. */
+/** Set of interfaces used to describe basic features of "components" within a larger system. */
+ at NonnullElements
+package net.shibboleth.shared.component;
 
-package net.shibboleth.shared.component;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/AllMatchPredicate.java b/shib-support/src/main/java/net/shibboleth/shared/logic/AllMatchPredicate.java
index 15ed55ac..4ec42c90 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/AllMatchPredicate.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/AllMatchPredicate.java
@@ -22,6 +22,8 @@ import java.util.function.Predicate;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import net.shibboleth.shared.annotation.constraint.NullableElements;
+
 /**
  * A {@link Predicate} that checks that all items in an {@link Iterable} match a given target predicate. If the given
  * {@link Iterable} is null or contains no items this method will return <code>false</code>, otherwise it passes each
@@ -41,12 +43,12 @@ public class AllMatchPredicate<T> implements Predicate<Iterable<T>> {
      * 
      * @param target the target predicate against which all {@link Iterable} elements are evaluated
      */
-    public AllMatchPredicate(@Nonnull final java.util.function.Predicate<T> target) {
+    public AllMatchPredicate(@Nonnull final Predicate<T> target) {
         predicate = Constraint.isNotNull(target, "Target predicate cannot be null");
     }
 
     /** {@inheritDoc} */
-    public boolean test(@Nullable final Iterable<T> inputs) {
+    public boolean test(@Nullable @NullableElements final Iterable<T> inputs) {
         if (inputs == null) {
             return false;
         }
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/AnyMatchPredicate.java b/shib-support/src/main/java/net/shibboleth/shared/logic/AnyMatchPredicate.java
index d3b06085..02f5bebe 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/AnyMatchPredicate.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/AnyMatchPredicate.java
@@ -22,6 +22,8 @@ import java.util.function.Predicate;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import net.shibboleth.shared.annotation.constraint.NullableElements;
+
 /**
  * A {@link Predicate} that checks that any item in an {@link Iterable} matches a given target predicate. If the given
  * {@link Iterable} is null or contains no items this method will return <code>false</code>, otherwise it passes each
@@ -41,12 +43,12 @@ public class AnyMatchPredicate<T> implements Predicate<Iterable<T>> {
      * 
      * @param target the target predicate against which all {@link Iterable} elements are evaluated
      */
-    public AnyMatchPredicate(@Nonnull final java.util.function.Predicate<T> target) {
+    public AnyMatchPredicate(@Nonnull final Predicate<T> target) {
         predicate = Constraint.isNotNull(target, "Target predicate cannot be null");
     }
 
     /** {@inheritDoc} */
-    public boolean test(@Nullable final Iterable<T> inputs) {
+    public boolean test(@Nullable @NullableElements final Iterable<T> inputs) {
         if (inputs == null) {
             return false;
         }
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/CaseInsensitiveStringMatchPredicate.java b/shib-support/src/main/java/net/shibboleth/shared/logic/CaseInsensitiveStringMatchPredicate.java
index b2c9b6f3..20402250 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/CaseInsensitiveStringMatchPredicate.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/CaseInsensitiveStringMatchPredicate.java
@@ -20,6 +20,7 @@ package net.shibboleth.shared.logic;
 import java.util.function.Predicate;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 /**
  * A {@link Predicate} that checks that a given input string matches a target string while ignoring case. If a given
@@ -40,7 +41,7 @@ public class CaseInsensitiveStringMatchPredicate implements Predicate<CharSequen
     }
 
     /** {@inheritDoc} */
-    public boolean test(final CharSequence input) {
+    public boolean test(@Nullable final CharSequence input) {
         if (input == null) {
             return false;
         }
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/Constraint.java b/shib-support/src/main/java/net/shibboleth/shared/logic/Constraint.java
index 1f16e42f..da00351e 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/Constraint.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/Constraint.java
@@ -22,6 +22,8 @@ import java.util.Collection;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import net.shibboleth.shared.annotation.constraint.NullableElements;
+
 /**
  * A helper class for evaluating certain constraints. Any violation will thrown a {@link ConstraintViolationException}.
  */
@@ -41,7 +43,7 @@ public final class Constraint {
      * 
      * @return the checked input
      */
-    @Nullable public static <T> Collection<T> isEmpty(@Nullable final Collection<T> collection,
+    @Nullable public static <T> Collection<T> isEmpty(@Nullable @NullableElements final Collection<T> collection,
             @Nonnull final String message) {
         if (collection != null && !collection.isEmpty()) {
             throw new ConstraintViolationException(message);
@@ -228,7 +230,7 @@ public final class Constraint {
      * 
      * @return the checked input
      */
-    @Nonnull public static <T> Collection<T> isNotEmpty(@Nullable final Collection<T> collection,
+    @Nonnull public static <T> Collection<T> isNotEmpty(@Nullable @NullableElements final Collection<T> collection,
             @Nonnull final String message) {
         if (collection == null || collection.isEmpty()) {
             throw new ConstraintViolationException(message);
@@ -247,7 +249,7 @@ public final class Constraint {
      * 
      * @return the checked input
      */
-    @Nonnull public static <T> T[] isNotEmpty(@Nullable final T[] array,
+    @Nonnull public static <T> T[] isNotEmpty(@Nullable @NullableElements final T[] array,
             @Nonnull final String message) {
         if (array == null || array.length == 0) {
             throw new ConstraintViolationException(message);
@@ -265,7 +267,7 @@ public final class Constraint {
      * 
      * @return the checked input
      */
-    @Nonnull public static byte[] isNotEmpty(@Nullable final byte[] array,
+    @Nonnull public static byte[] isNotEmpty(@Nullable @NullableElements final byte[] array,
             @Nonnull final String message) {
         if (array == null || array.length == 0) {
             throw new ConstraintViolationException(message);
@@ -377,7 +379,7 @@ public final class Constraint {
      *
      * @return the given array
      */
-    @Nonnull public static <T extends Collection<?>> T noNullItems(@Nullable final T collection,
+    @Nonnull public static <T extends Collection<?>> T noNullItems(@Nullable @NullableElements final T collection,
             @Nonnull final String message) {
         if (collection == null) {
             throw new ConstraintViolationException(message);
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/FunctionSupport.java b/shib-support/src/main/java/net/shibboleth/shared/logic/FunctionSupport.java
index 5171a787..d6a34fe5 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/FunctionSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/FunctionSupport.java
@@ -45,7 +45,7 @@ public final class FunctionSupport {
      * @return the constructed function
      */
     @Nonnull public static <T1,T2> Function<T1,T2> constant(@Nullable @ParameterName(name="target") final T2 target) {
-        return (f) -> target;
+        return f -> target;
     }
 
     /**
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/NonnullFunction.java b/shib-support/src/main/java/net/shibboleth/shared/logic/NonnullFunction.java
index bc5da780..544f3b41 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/NonnullFunction.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/NonnullFunction.java
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
 
 /**
  * Implementation of {@link Function} that carries the nonnull annotation
- * on the {@link #apply(Object)} method.
+ * on the {@link #apply(Object)} method's return value.
  * 
  * @param <T> input type
  * @param <U> output type
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/RegexPredicate.java b/shib-support/src/main/java/net/shibboleth/shared/logic/RegexPredicate.java
index a976e4b3..bdb9e796 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/RegexPredicate.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/RegexPredicate.java
@@ -49,6 +49,7 @@ public class RegexPredicate implements Predicate<CharSequence> {
      * 
      * @param s the pattern to match the input against
      */
+    @SuppressWarnings("null")
     public RegexPredicate(@Nonnull @NotEmpty final String s) {
         pattern = Pattern.compile(s);
     }
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/StrategyIndirectedPredicate.java b/shib-support/src/main/java/net/shibboleth/shared/logic/StrategyIndirectedPredicate.java
index 82b48f31..8d623c93 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/StrategyIndirectedPredicate.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/StrategyIndirectedPredicate.java
@@ -27,6 +27,7 @@ import javax.annotation.Nullable;
 import com.google.common.base.Predicates;
 
 import net.shibboleth.shared.annotation.ParameterName;
+import net.shibboleth.shared.annotation.constraint.NullableElements;
 
 /**
  * Generic predicate that checks a candidate {@link Object} returned by a lookup function
@@ -63,9 +64,10 @@ public class StrategyIndirectedPredicate<T1,T2> implements Predicate<T1> {
      * @param objectStrategy  lookup strategy for object
      * @param collection a collection to test for containment
      */
+    @SuppressWarnings("null")
     public StrategyIndirectedPredicate(
             @ParameterName(name="objectStrategy") @Nonnull final Function<T1,T2> objectStrategy,
-            @ParameterName(name="collection") @Nonnull final Collection<T2> collection) {
+            @ParameterName(name="collection") @Nonnull @NullableElements final Collection<T2> collection) {
         objectLookupStrategy = Constraint.isNotNull(objectStrategy, "Object lookup strategy cannot be null");
         predicate = Predicates.in(collection);
     }
@@ -89,7 +91,7 @@ public class StrategyIndirectedPredicate<T1,T2> implements Predicate<T1> {
      * @since 7.3.0
      */
     @Nonnull public static <T1,T2> StrategyIndirectedPredicate<T1,T2> forPredicate(
-            @Nonnull final Function<T1,T2> objectStrategy, @Nonnull final java.util.function.Predicate<T2> pred) {
+            @Nonnull final Function<T1,T2> objectStrategy, @Nonnull final Predicate<T2> pred) {
         return new StrategyIndirectedPredicate<>(objectStrategy, pred);
     }
 
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/TransformAndCheckFunction.java b/shib-support/src/main/java/net/shibboleth/shared/logic/TransformAndCheckFunction.java
index 8289a0ff..3226f2ae 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/TransformAndCheckFunction.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/TransformAndCheckFunction.java
@@ -39,10 +39,10 @@ import com.google.common.base.MoreObjects;
 public class TransformAndCheckFunction<T> implements Function<T, Optional<? extends T>> {
 
     /** A function applied to input prior to being constraint checked and accepted. */
-    private final Function<T, ? extends T> preprocessor;
+    @Nonnull private final Function<T, ? extends T> preprocessor;
 
     /** A constraint which must be met in order for an input to be valid. */
-    private final Predicate<T> constraint;
+    @Nonnull private final Predicate<T> constraint;
 
     /** Whether input that does not meet the constraint should cause an error or just be silently dropped. */
     private final boolean failOnConstraintViolation;
@@ -56,10 +56,9 @@ public class TransformAndCheckFunction<T> implements Function<T, Optional<? exte
      *            just be ignored
      */
     public TransformAndCheckFunction(@Nonnull final Function<T, ? extends T> inputPreprocessor,
-            @Nonnull final Predicate<T> inputConstraint,
-            final boolean failOnInputConstraintViolation) {
-        preprocessor = Constraint.isNotNull(inputPreprocessor, "Input preprocessor can not be null");
-        constraint = Constraint.isNotNull(inputConstraint, "Input constraint can not be null");
+            @Nonnull final Predicate<T> inputConstraint, final boolean failOnInputConstraintViolation) {
+        preprocessor = Constraint.isNotNull(inputPreprocessor, "Input preprocessor cannot be null");
+        constraint = Constraint.isNotNull(inputConstraint, "Input constraint cannot be null");
         failOnConstraintViolation = failOnInputConstraintViolation;
     }
 
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/logic/package-info.java
index 6e2bb74c..6a6545b9 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/package-info.java
@@ -16,4 +16,7 @@
  */
 
 /** Classes that represent basic first order logic concepts. */
-package net.shibboleth.shared.logic;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.shared.logic;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/CleanerSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/CleanerSupport.java
index 05a1e2e5..dbe481fc 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/CleanerSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/CleanerSupport.java
@@ -41,10 +41,11 @@ public final class CleanerSupport {
      * 
      * @return the cleaner instance
      */
+    @SuppressWarnings("null")
     @Nonnull public static Cleaner getInstance(@Nonnull final Class<?> requester) {
         // Current approach here is to create a new Cleaner on each call. A given class requester/owner
         // is assumed to call only once and store in static storage.
-        LOG.debug("Creating new java.lang.ref.Cleaner instance requested by class:  {}", requester.getName());
+        LOG.debug("Creating new java.lang.ref.Cleaner instance requested by class: {}", requester.getName());
         return Cleaner.create();
     }
 
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/DeprecationSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/DeprecationSupport.java
index c7b07e4b..55249c92 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/DeprecationSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/DeprecationSupport.java
@@ -25,7 +25,6 @@ import javax.annotation.Nullable;
 
 import org.slf4j.Logger;
 
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 
 
@@ -39,10 +38,10 @@ public final class DeprecationSupport {
     @Nonnull private static final Logger LOG = LoggerFactory.getLogger(LOG_CATEGORY);
     
     /** Tracks issued warnings. */
-    @Nonnull @NonnullElements private static final Set<String> WARNED_SET = new HashSet<>();
+    @Nonnull private static final Set<String> WARNED_SET = new HashSet<>();
 
     /** Tracks issued at-risks. */
-    @Nonnull @NonnullElements private static final Set<String> AT_RISK_SET = new HashSet<>();
+    @Nonnull private static final Set<String> AT_RISK_SET = new HashSet<>();
 
     /** Constructor. */
     private DeprecationSupport() {
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/LoggerFactory.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/LoggerFactory.java
index 6b5692ad..1041e0ea 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/LoggerFactory.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/LoggerFactory.java
@@ -31,6 +31,11 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
  */
 public final class LoggerFactory {
 
+    /** Constructor. */
+    private LoggerFactory() {
+        
+    }
+
     /**
      * Get class-based logger.
      * 
@@ -55,9 +60,4 @@ public final class LoggerFactory {
         return org.slf4j.LoggerFactory.getLogger(category);
     }
 
-    /** Constructor. */
-    private LoggerFactory() {
-        
-    }
-
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/NonnullSupplier.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/NonnullSupplier.java
index 91bbd6dc..604659d0 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/NonnullSupplier.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/NonnullSupplier.java
@@ -42,10 +42,9 @@ public interface NonnullSupplier<T> extends Supplier<T> {
      * 
      * @return the input argument
      */
-    @Nonnull static public <T> NonnullSupplier<T> of(@Nonnull final T input) {
+    @Nonnull public static <T> NonnullSupplier<T> of(@Nonnull final T input) {
 
         return new NonnullSupplier<T>() {
-            @Override
             @Nonnull public T get() {
                 return input;
             }
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/ObjectSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/ObjectSupport.java
index 03fb5640..248981df 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/ObjectSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/ObjectSupport.java
@@ -19,6 +19,8 @@ package net.shibboleth.shared.primitive;
 
 import javax.annotation.Nullable;
 
+import net.shibboleth.shared.annotation.constraint.NullableElements;
+
 
 /** Helper methods for working with Objects. */
 public final class ObjectSupport {
@@ -45,7 +47,7 @@ public final class ObjectSupport {
      * 
      */
     @SafeVarargs
-    @Nullable public static <T> T firstNonNull(@Nullable final T ... objects) {
+    @Nullable public static <T> T firstNonNull(@Nullable @NullableElements final T ... objects) {
         if (objects == null) {
             return null;
         }
@@ -58,4 +60,5 @@ public final class ObjectSupport {
         
         return null;
     }
+
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
index 1b4bc96b..b361feba 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
@@ -33,6 +33,8 @@ import java.util.stream.Collectors;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import com.google.common.base.Predicates;
+
 import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NullableElements;
 import net.shibboleth.shared.collection.CollectionSupport;
@@ -181,7 +183,7 @@ public final class StringSupport {
         
         return values.stream().
                 map(StringSupport::trimOrNull).
-                filter(e->e != null).
+                filter(Predicates.notNull()).
                 collect(CollectionSupport.nonnullCollector(Collectors.toList())).get();
     }
 
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/package-info.java
index 38b3f97a..dfe95635 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/package-info.java
@@ -16,4 +16,7 @@
  */
 
 /** A set of utilities dealing with Java's primitive types. */
-package net.shibboleth.shared.primitive;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.shared.primitive;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/resolver/CriteriaSet.java b/shib-support/src/main/java/net/shibboleth/shared/resolver/CriteriaSet.java
index e13c7909..3d885b99 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/resolver/CriteriaSet.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/resolver/CriteriaSet.java
@@ -19,6 +19,7 @@ package net.shibboleth.shared.resolver;
 
 import javax.annotation.Nullable;
 
+import net.shibboleth.shared.annotation.constraint.NullableElements;
 import net.shibboleth.shared.collection.ClassIndexedSet;
 
 /** This class holds instances of {@link Criterion} which are used in resolution or evaluation operations. */
@@ -26,17 +27,14 @@ public class CriteriaSet extends ClassIndexedSet<Criterion> implements Criterion
 
     /** Constructor. */
     public CriteriaSet() {
-        super();
     }
 
     /**
      * A convenience constructor for constructing and adding criteria.
      * 
-     * @param criteria criteria to add, may be null or contain null values
+     * @param criteria criteria to add, may be null or contain null values (which are ignored)
      */
-    public CriteriaSet(@Nullable final Criterion... criteria) {
-        super();
-
+    public CriteriaSet(@Nullable @NullableElements final Criterion... criteria) {
         if (criteria == null || criteria.length == 0) {
             return;
         }
@@ -48,4 +46,5 @@ public class CriteriaSet extends ClassIndexedSet<Criterion> implements Criterion
             add(criterion);
         }
     }
+
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/resolver/CriterionPredicateRegistry.java b/shib-support/src/main/java/net/shibboleth/shared/resolver/CriterionPredicateRegistry.java
index 6c2deb6d..0a83c13e 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/resolver/CriterionPredicateRegistry.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/resolver/CriterionPredicateRegistry.java
@@ -145,7 +145,6 @@ public class CriterionPredicateRegistry<T> {
         registry.clear();
     }
 
-//CheckStyle: ReturnCount OFF
     /**
      * Load criterion -> predicate mappings from a classpath resource.
      * 
@@ -167,7 +166,6 @@ public class CriterionPredicateRegistry<T> {
             return;
         }
     }
-  //CheckStyle: ReturnCount ON
 
     /**
      * Load a set of criterion -> predicate mappings from the supplied properties set.
@@ -211,4 +209,4 @@ public class CriterionPredicateRegistry<T> {
 
     }
     
-}
+}
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/resolver/Resolver.java b/shib-support/src/main/java/net/shibboleth/shared/resolver/Resolver.java
index d2f7d70f..0212b01b 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/resolver/Resolver.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/resolver/Resolver.java
@@ -20,8 +20,6 @@ package net.shibboleth.shared.resolver;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
-
 /**
  * Generic interface for resolvers which process specified criteria and produce some implementation-specific
  * result information.
@@ -41,7 +39,7 @@ public interface Resolver<ProductType, CriteriaType> {
      * 
      * @throws ResolverException thrown if there is an error processing the specified criteria
      */
-    @Nonnull @NonnullElements Iterable<ProductType> resolve(@Nullable CriteriaType criteria) throws ResolverException;
+    @Nonnull Iterable<ProductType> resolve(@Nullable CriteriaType criteria) throws ResolverException;
     
     /**
      * Process the specified criteria and return a single instance of the product type
@@ -57,4 +55,5 @@ public interface Resolver<ProductType, CriteriaType> {
      * @throws ResolverException thrown if there is an error processing the specified criteria
      */
     @Nullable ProductType resolveSingle(@Nullable CriteriaType criteria) throws ResolverException;
+
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/resolver/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/resolver/package-info.java
index ada67261..9d81418d 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/resolver/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/resolver/package-info.java
@@ -16,5 +16,7 @@
  */
 
 /** Interfaces for searching over data. */
+ at NonnullElements
+package net.shibboleth.shared.resolver;
 
-package net.shibboleth.shared.resolver;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java b/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
index 2a8c07cb..8ec7529c 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
@@ -26,7 +26,6 @@ import javax.script.ScriptException;
 import javax.script.SimpleScriptContext;
 
 import net.shibboleth.shared.annotation.ParameterName;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.logic.Constraint;
@@ -176,8 +175,7 @@ public abstract class AbstractScriptEvaluator {
      * 
      * @since 9.0.0
      */
-    public void setContextExtenders(
-            @Nullable @NonnullElements final Collection<? extends ScriptContextExtender> extenders) {
+    public void setContextExtenders(@Nullable final Collection<? extends ScriptContextExtender> extenders) {
         
         if (extenders != null) {
             contextExtenders = CollectionSupport.copyToList(extenders);
diff --git a/shib-support/src/main/java/net/shibboleth/shared/scripting/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/scripting/package-info.java
index a30be7d3..d860e1b4 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/scripting/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/scripting/package-info.java
@@ -16,5 +16,7 @@
  */
 
 /** Classes for working with JSR-223 scripting environments. */
+ at NonnullElements
+package net.shibboleth.shared.scripting;
 
-package net.shibboleth.shared.scripting;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
index 66accebf..9af31bc5 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
@@ -54,7 +54,8 @@ public final class AttributeSupport {
         Constraint.isNotNull(element, "Element may not be null");
         Constraint.isNotNull(base, "base attribute value may not be null");
 
-        final Attr attr = constructAttribute(element.getOwnerDocument(), XMLConstants.XML_BASE_ATTRIB_NAME);
+        final Attr attr = constructAttribute(ElementSupport.ensureOwnerDocument(element),
+                XMLConstants.XML_BASE_ATTRIB_NAME);
         attr.setValue(base);
         element.setAttributeNodeNS(attr);
     }
@@ -69,7 +70,8 @@ public final class AttributeSupport {
         Constraint.isNotNull(element, "Element may not be null");
         Constraint.isNotNull(id, "id attribute value may not be null");
 
-        final Attr attr = constructAttribute(element.getOwnerDocument(), XMLConstants.XML_ID_ATTRIB_NAME);
+        final Attr attr = constructAttribute(ElementSupport.ensureOwnerDocument(element),
+                XMLConstants.XML_ID_ATTRIB_NAME);
         attr.setValue(id);
         element.setAttributeNodeNS(attr);
         element.setIdAttributeNode(attr, true);
@@ -85,7 +87,8 @@ public final class AttributeSupport {
         Constraint.isNotNull(element, "Element may not be null");
         Constraint.isNotNull(lang, "lang attribute value may not be null");
 
-        final Attr attr = constructAttribute(element.getOwnerDocument(), XMLConstants.XML_LANG_ATTRIB_NAME);
+        final Attr attr = constructAttribute(ElementSupport.ensureOwnerDocument(element),
+                XMLConstants.XML_LANG_ATTRIB_NAME);
         attr.setValue(lang);
         element.setAttributeNodeNS(attr);
     }
@@ -100,7 +103,8 @@ public final class AttributeSupport {
         Constraint.isNotNull(element, "Element may not be null");
         Constraint.isNotNull(space, "space attribute value may not be null");
 
-        final Attr attr = constructAttribute(element.getOwnerDocument(), XMLConstants.XML_SPACE_ATTRIB_NAME);
+        final Attr attr = constructAttribute(ElementSupport.ensureOwnerDocument(element),
+                XMLConstants.XML_SPACE_ATTRIB_NAME);
         attr.setValue(space.toString());
         element.setAttributeNodeNS(attr);
     }
@@ -116,7 +120,7 @@ public final class AttributeSupport {
      *            attribute
      */
     public static void appendAttribute(@Nonnull final Element element, @Nonnull final QName attributeName,
-            final List<String> attributeValues, final boolean isIDAttribute) {
+            @Nonnull final List<String> attributeValues, final boolean isIDAttribute) {
         appendAttribute(element, attributeName, StringSupport.listToStringValue(attributeValues, " "), isIDAttribute);
     }
 
@@ -200,8 +204,8 @@ public final class AttributeSupport {
     @Nonnull public static Attr constructAttribute(@Nonnull final Document owningDocument,
             @Nonnull final QName attributeName) {
         Constraint.isNotNull(attributeName, "Attribute name can not be null");
-        return constructAttribute(owningDocument, attributeName.getNamespaceURI(), attributeName.getLocalPart(),
-                attributeName.getPrefix());
+        return constructAttribute(owningDocument, attributeName.getNamespaceURI(),
+                QNameSupport.ensureLocalPart(attributeName), attributeName.getPrefix());
     }
 
     /**
@@ -257,7 +261,7 @@ public final class AttributeSupport {
     @Nullable public static String getAttributeValue(@Nonnull final Element element,
             @Nonnull final QName attributeName) {
         return getAttributeValue(element, StringSupport.trimOrNull(attributeName.getNamespaceURI()),
-                attributeName.getLocalPart());
+                QNameSupport.ensureLocalPart(attributeName));
     }
 
     /**
@@ -292,9 +296,12 @@ public final class AttributeSupport {
      */
     @Nonnull @NotEmpty public static String ensureAttributeValue(@Nonnull final Element element,
             @Nullable final String namespace, @Nonnull @NotEmpty final String attributeLocalName) {
-        return Constraint.isNotNull(StringSupport.trimOrNull(
-                getAttributeValue(element, namespace, attributeLocalName)),
-                attributeLocalName + " cannot be null or empty");
+        
+        final String value = StringSupport.trimOrNull(getAttributeValue(element, namespace, attributeLocalName));
+        if (value == null) {
+            throw new IllegalStateException(attributeLocalName + " cannot be null or empty");
+        }
+        return value;
     }
 
     
@@ -310,8 +317,11 @@ public final class AttributeSupport {
      */
     @Nonnull @NotEmpty public static String ensureAttributeValue(@Nonnull final Element element,
             @Nonnull final QName attributeName) {
-        return Constraint.isNotNull(StringSupport.trimOrNull(getAttributeValue(element, attributeName)),
-                attributeName.getLocalPart() + " cannot be null or empty");
+        final String value = StringSupport.trimOrNull(getAttributeValue(element, attributeName));
+        if (value == null) {
+            throw new IllegalStateException(QNameSupport.ensureLocalPart(attributeName) + " cannot be null or empty");
+        }
+        return value;
     }
 
     /**
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/ClasspathResolver.java b/shib-support/src/main/java/net/shibboleth/shared/xml/ClasspathResolver.java
index fdd28c0a..15a57880 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/ClasspathResolver.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/ClasspathResolver.java
@@ -32,6 +32,7 @@ import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.primitive.LoggerFactory;
 
 /**
@@ -45,7 +46,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
 public class ClasspathResolver implements EntityResolver, LSResourceResolver {
 
     /** URI scheme for classpath locations. */
-    public static final String CLASSPATH_URI_SCHEME = "classpath:";
+    @Nonnull @NotEmpty public static final String CLASSPATH_URI_SCHEME = "classpath:";
 
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(ClasspathResolver.class);
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
index dd27e516..af2f71a2 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
@@ -106,8 +106,8 @@ public final class ElementSupport {
      */
     @Nonnull public static Element constructElement(@Nonnull final Document document,
             @Nonnull final QName elementName) {
-        Constraint.isNotNull(elementName, "Element name can not be null");
-        return constructElement(document, elementName.getNamespaceURI(), elementName.getLocalPart(),
+        Constraint.isNotNull(elementName, "Element name cannot be null");
+        return constructElement(document, elementName.getNamespaceURI(), QNameSupport.ensureLocalPart(elementName),
                 elementName.getPrefix());
     }
 
@@ -132,9 +132,9 @@ public final class ElementSupport {
         final String qualifiedName;
         final String trimmedPrefix = StringSupport.trimOrNull(prefix);
         if (trimmedPrefix != null) {
-            qualifiedName = trimmedPrefix + ":" + StringSupport.trimOrNull(trimmedLocalName);
+            qualifiedName = trimmedPrefix + ":" + trimmedLocalName;
         } else {
-            qualifiedName = StringSupport.trimOrNull(trimmedLocalName);
+            qualifiedName = trimmedLocalName;
         }
 
         return document.createElementNS(StringSupport.trimOrNull(namespaceURI), qualifiedName);
@@ -171,7 +171,7 @@ public final class ElementSupport {
      */
     @Nonnull @Unmodifiable @NotLive public static List<Element> getChildElements(@Nonnull final Node root,
             @Nonnull final QName name) {
-        return getChildElementsByTagNameNS(root, name.getNamespaceURI(), name.getLocalPart());
+        return getChildElementsByTagNameNS(root, name.getNamespaceURI(), QNameSupport.ensureLocalPart(name));
     }
 
     /**
@@ -388,7 +388,7 @@ public final class ElementSupport {
      * @return true if the element has the given name, false otherwise
      */
     public static boolean isElementNamed(@Nonnull final Element e, @Nonnull final QName name) {
-        return isElementNamed(e, name.getNamespaceURI(), name.getLocalPart());
+        return isElementNamed(e, name.getNamespaceURI(), QNameSupport.ensureLocalPart(name));
     }
 
     /**
@@ -425,4 +425,23 @@ public final class ElementSupport {
         }
 
     }
+    
+    /**
+     * Return {@link Element#getOwnerDocument()}, raising an {@link IllegalStateException} if null.
+     * 
+     * @param e input Element
+     * 
+     * @return the owner Document
+     * 
+     * @since 9.0.0
+     */
+    @Nonnull public static Document ensureOwnerDocument(@Nonnull final Element e) {
+        final Document doc = e.getOwnerDocument();
+        if (doc == null) {
+            throw new IllegalStateException("Owner document was null");
+        }
+        
+        return doc;
+    }
+    
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/ParserPool.java b/shib-support/src/main/java/net/shibboleth/shared/xml/ParserPool.java
index cb3b3409..d9e416e0 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/ParserPool.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/ParserPool.java
@@ -21,7 +21,6 @@ import java.io.InputStream;
 import java.io.Reader;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.xml.parsers.DocumentBuilder;
 
 import org.w3c.dom.Document;
@@ -43,7 +42,7 @@ public interface ParserPool {
      * 
      * @param builder the builder to return
      */
-    public void returnBuilder(@Nullable DocumentBuilder builder);
+    public void returnBuilder(@Nonnull DocumentBuilder builder);
 
     /**
      * Convenience method for creating a new document with a pooled builder.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/QNameSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/QNameSupport.java
index 65f206f2..d7942b9f 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/QNameSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/QNameSupport.java
@@ -56,6 +56,7 @@ public final class QNameSupport {
             final StringTokenizer qnameTokens = new StringTokenizer(trimmedName, ":");
             nsPrefix = StringSupport.trim(qnameTokens.nextToken());
             name = qnameTokens.nextToken();
+            assert name != null;
         } else {
             nsPrefix = null;
             name = trimmedName;
@@ -93,6 +94,7 @@ public final class QNameSupport {
      * 
      * @return the QName for the element or null if the element was null
      */
+    @SuppressWarnings("null")
     @Nonnull public static QName getNodeQName(@Nonnull final Node domNode) {
         return constructQName(domNode.getNamespaceURI(), domNode.getLocalName(), domNode.getPrefix());
     }
@@ -104,6 +106,7 @@ public final class QNameSupport {
      * 
      * @return the string value of the QName
      */
+    @SuppressWarnings("null")
     @Nonnull public static String qnameToContentString(@Nonnull final QName qname) {
         Constraint.isNotNull(qname, "QName may not be null");
 
@@ -117,4 +120,23 @@ public final class QNameSupport {
 
         return buf.toString();
     }
+
+    /**
+     * Returns {@link QName#getLocalPart()}, raising an {@link IllegalStateException} if null.
+     * 
+     * @param qname input QName
+     * 
+     * @return the local part of the QName
+     * 
+     * @since 9.0.0
+     */
+    @Nonnull public static String ensureLocalPart(@Nonnull final QName qname) {
+        final String name = qname.getLocalPart();
+        if (name == null) {
+            throw new IllegalStateException("QName did not contain a local part");
+        }
+        
+        return name;
+    }
+    
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java b/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
index cdf473bf..1672bf8e 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
@@ -34,9 +34,7 @@ import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.annotation.constraint.NullableElements;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.primitive.StringSupport;
@@ -82,6 +80,7 @@ public class SchemaBuilder {
          * 
          * @return  a factory instance
          */
+        @SuppressWarnings("null")
         @Nonnull public SchemaFactory getSchemaFactory() {
             return SchemaFactory.newInstance(schemaFactoryURI);
         }
@@ -94,7 +93,7 @@ public class SchemaBuilder {
     @Nonnull private SchemaLanguage schemaLang;
 
     /** Sources of schema material compatible with JAXP. */
-    @Nonnull @NonnullElements private List<Source> sources;
+    @Nonnull private List<Source> sources;
     
     /** Mechanism for resolving nested resources like included/imported schemas. */
     @Nullable private LSResourceResolver resourceResolver;
@@ -204,14 +203,13 @@ public class SchemaBuilder {
      * 
      * @param schemaSources schema sources
      */
-    public void setSchemas(@Nonnull @NullableElements final Collection<Source> schemaSources) {
+    public void setSchemas(@Nonnull final Collection<Source> schemaSources) {
         Constraint.isNotNull(schemaSources, "Schema source file paths cannot be null");
 
         resetSchemas();
         for (final Source schemaSource : schemaSources) {
-            if (schemaSource != null) {
-                addSchema(schemaSource);
-            }
+            assert schemaSource != null;
+            addSchema(schemaSource);
         }
     }
     
@@ -224,14 +222,13 @@ public class SchemaBuilder {
      * 
      * @param schemaResources schema resources
      */
-    public void setSchemaResources(@Nonnull @NullableElements final Collection<Resource> schemaResources) {
+    public void setSchemaResources(@Nonnull final Collection<Resource> schemaResources) {
         Constraint.isNotNull(schemaResources, "Schema resources cannot be null");
 
         resetSchemas();
         for (final Resource schemaResource : schemaResources) {
-            if (schemaResource != null) {
-                addSchema(schemaResource);
-            }
+            assert schemaResource != null;
+            addSchema(schemaResource);
         }
     }
 
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/SerializeSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/SerializeSupport.java
index b30cab91..7a60c1e5 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/SerializeSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/SerializeSupport.java
@@ -41,7 +41,7 @@ import org.w3c.dom.ls.LSSerializerFilter;
 public final class SerializeSupport {
     
     /** DOM configuration parameters used by LSSerializer in pretty print format output. */
-    private static Map<String, Object> prettyPrintParams;
+    @Nonnull private static Map<String, Object> prettyPrintParams;
 
     /** Constructor. */
     private SerializeSupport() {
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/XMLSpace.java b/shib-support/src/main/java/net/shibboleth/shared/xml/XMLSpace.java
index e7046c83..90983e41 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/XMLSpace.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/XMLSpace.java
@@ -17,6 +17,8 @@
 
 package net.shibboleth.shared.xml;
 
+import javax.annotation.Nonnull;
+
 /** Enum representing the allowed values of the xml:space attribute. */
 public enum XMLSpace {
 
@@ -30,7 +32,8 @@ public enum XMLSpace {
     // and we have the mess below.
 
     /** {@inheritDoc} */
-    public String toString() {
+    @SuppressWarnings("null")
+    @Nonnull public String toString() {
         return super.toString().toLowerCase();
     }
 
@@ -44,7 +47,7 @@ public enum XMLSpace {
      * @param value the value to parse
      * @return the corresponding XMLSpaceEnum
      */
-    public static XMLSpace parseValue(final String value) {
+    public static XMLSpace parseValue(@Nonnull final String value) {
         return XMLSpace.valueOf(value.toUpperCase());
     }
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
index 43788733..2e7d58a3 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
@@ -48,8 +48,7 @@ import org.xml.sax.SAXException;
 import com.google.common.base.Predicates;
 import com.google.common.collect.Maps;
 
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.shared.annotation.constraint.NotLive;
 import net.shibboleth.shared.annotation.constraint.NullableElements;
 import net.shibboleth.shared.annotation.constraint.Unmodifiable;
@@ -62,9 +61,6 @@ import net.shibboleth.shared.primitive.StringSupport;
 import net.shibboleth.shared.xml.ParserPool;
 import net.shibboleth.shared.xml.XMLParserException;
 
-//TODO(lajoie) see if we can use either java.util.concurrent or Guava 
-// classes for the pool so we don't have to manage synchronicity
-
 /**
  * A pool of JAXP 1.3 {@link DocumentBuilder}s.
  * 
@@ -90,16 +86,16 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
     @Nullable private String securityManagerAttributeName;
 
     /** Factory used to create new builders. */
-    private DocumentBuilderFactory builderFactory;
+    @NonnullAfterInit private DocumentBuilderFactory builderFactory;
 
     /** Cache of document builders. */
-    @Nonnull @NotEmpty private final Stack<SoftReference<DocumentBuilder>> builderPool;
+    @Nonnull private final Stack<SoftReference<DocumentBuilder>> builderPool;
 
     /** Max number of builders allowed in the pool. Default value: 5 */
     private int maxPoolSize;
 
     /** Builder attributes. */
-    @Nonnull private Map<String, Object> builderAttributes;
+    @Nonnull @Unmodifiable @NotLive private Map<String, Object> builderAttributes;
 
     /** Whether the builders are coalescing. Default value: true */
     private boolean coalescing;
@@ -108,7 +104,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
     private boolean expandEntityReferences;
 
     /** Builder features. */
-    @Nonnull private Map<String, Boolean> builderFeatures;
+    @Nonnull @Unmodifiable @NotLive private Map<String, Boolean> builderFeatures;
 
     /** Whether the builders ignore comments. Default value: true */
     private boolean ignoreComments;
@@ -120,7 +116,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
     private boolean namespaceAware;
 
     /** Schema used to validate parsed content. */
-    private Schema schema;
+    @Nullable private Schema schema;
 
     /** Whether the builder should validate. Default value: false */
     private boolean dtdValidating;
@@ -319,8 +315,8 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
      * 
      * @return builder attributes used when creating builders
      */
-    @Nonnull @NonnullElements @Unmodifiable @NotLive public Map<String, Object> getBuilderAttributes() {
-        return Collections.unmodifiableMap(builderAttributes);
+    @Nonnull @NullableElements @Unmodifiable @NotLive public Map<String, Object> getBuilderAttributes() {
+        return builderAttributes;
     }
 
     /**
@@ -328,13 +324,16 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
      * 
      * @param newAttributes builder attributes used when creating builders
      */
+    @SuppressWarnings("null")
     public void setBuilderAttributes(@Nullable @NullableElements final Map<String, Object> newAttributes) {
         checkSetterPreconditions();
 
         if (newAttributes == null) {
             builderAttributes = CollectionSupport.emptyMap();
         } else {
-            builderAttributes = new HashMap<>(Maps.filterKeys(newAttributes, Predicates.notNull()));
+            // This is used because of the possibility of null values, but ensures we meet the NotLive contract.
+            builderAttributes = Collections.unmodifiableMap(
+                    new HashMap<>(Maps.filterKeys(newAttributes, Predicates.notNull())));
         }
     }
 
@@ -383,7 +382,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
      * 
      * @return the builders' features
      */
-    @Nonnull @NonnullElements @Unmodifiable @NotLive public Map<String, Boolean> getBuilderFeatures() {
+    @Nonnull @NullableElements @Unmodifiable @NotLive public Map<String, Boolean> getBuilderFeatures() {
         return builderFeatures;
     }
 
@@ -392,13 +391,16 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
      * 
      * @param newFeatures the builders' features
      */
+    @SuppressWarnings("null")
     public void setBuilderFeatures(@Nullable @NullableElements final Map<String, Boolean> newFeatures) {
         checkSetterPreconditions();
 
         if (newFeatures == null) {
             builderFeatures = CollectionSupport.emptyMap();
         } else {
-            builderFeatures = Collections.unmodifiableMap(Maps.filterKeys(newFeatures, Predicates.notNull()));
+            // This is used because of the possibility of null values, but ensures we meet the NotLive contract.
+            builderFeatures = Collections.unmodifiableMap(
+                    new HashMap<>(Maps.filterKeys(newFeatures, Predicates.notNull())));
         }
     }
 
@@ -619,7 +621,9 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
             final DocumentBuilderFactory newFactory = DocumentBuilderFactory.newInstance();
 
             for (final Map.Entry<String, Object> attribute : builderAttributes.entrySet()) {
-                newFactory.setAttribute(attribute.getKey(), attribute.getValue());
+                if (attribute.getKey() != null) {
+                    newFactory.setAttribute(attribute.getKey(), attribute.getValue());
+                }
             }
 
             for (final Map.Entry<String, Boolean> feature : builderFeatures.entrySet()) {
@@ -679,17 +683,17 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
         final HashMap<String, Boolean> features = new HashMap<>();
         features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true);
         features.put("http://apache.org/xml/features/disallow-doctype-decl", true);
-        return features;
+        return CollectionSupport.copyToMap(features);
     }
 
     /** A proxy that prevents the manages document builders retrieved from the parser pool. */
     protected class DocumentBuilderProxy extends DocumentBuilder {
 
         /** Builder being proxied. */
-        private final DocumentBuilder builder;
+        @Nonnull private final DocumentBuilder builder;
 
         /** Pool that owns this parser. */
-        private final ParserPool owningPool;
+        @Nonnull private final ParserPool owningPool;
 
         /** Track accounting state of whether this builder has been returned to the owning pool. */
         private boolean returned;
@@ -700,7 +704,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
          * @param target document builder to proxy
          * @param owner the owning pool
          */
-        public DocumentBuilderProxy(final DocumentBuilder target, final BasicParserPool owner) {
+        public DocumentBuilderProxy(@Nonnull final DocumentBuilder target, @Nonnull final BasicParserPool owner) {
             owningPool = owner;
             builder = target;
             returned = false;
@@ -808,7 +812,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
          * 
          * @return pool that owns this parser
          */
-        protected ParserPool getOwningPool() {
+        @Nonnull protected ParserPool getOwningPool() {
             return owningPool;
         }
 
@@ -817,7 +821,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
          * 
          * @return proxied document builder
          */
-        protected DocumentBuilder getProxiedBuilder() {
+        @Nonnull protected DocumentBuilder getProxiedBuilder() {
             return builder;
         }
 
@@ -847,6 +851,6 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
                 throw new IllegalStateException("DocumentBuilderProxy has already been returned to its owning pool");
             }
         }
-
     }
+    
 }
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/package-info.java
index f1a0f3eb..196013a9 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/package-info.java
@@ -18,4 +18,7 @@
 /**
  * XML implementation classes.
  */
-package net.shibboleth.shared.xml.impl;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.shared.xml.impl;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/xml/package-info.java
index b1d37cb0..9a069286 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/package-info.java
@@ -18,4 +18,7 @@
 /**
  * APIs for parsing and using XML.
  */
-package net.shibboleth.shared.xml;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.shared.xml;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;

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


More information about the commits mailing list