This is an automated email from the ASF dual-hosted git repository.

lprimak pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/shiro.git


The following commit(s) were added to refs/heads/3.x by this push:
     new dab015331 removed raw types from APIs fixes #1583
dab015331 is described below

commit dab015331256307b4d0c6599ba3a2e3ac1438ca2
Author: lprimak <[email protected]>
AuthorDate: Thu Jan 29 02:30:24 2026 -0600

    removed raw types from APIs
    fixes #1583
---
 .../apache/shiro/cache/AbstractCacheManager.java   |  4 +-
 .../shiro/config/ogdl/ReflectionBuilder.java       | 42 ++++++-----
 .../java/org/apache/shiro/authc/SimpleAccount.java |  2 +-
 .../java/org/apache/shiro/jndi/JndiLocator.java    |  2 +-
 .../java/org/apache/shiro/jndi/JndiTemplate.java   | 10 +--
 .../java/org/apache/shiro/realm/CachingRealm.java  |  2 +-
 .../activedirectory/ActiveDirectoryRealm.java      | 12 ++--
 .../org/apache/shiro/realm/ldap/LdapUtils.java     |  6 +-
 .../shiro/subject/MutablePrincipalCollection.java  |  2 +-
 .../shiro/subject/SimplePrincipalCollection.java   | 67 +++++++++--------
 .../org/apache/shiro/util/CollectionUtils.java     | 18 ++---
 .../test/java/org/apache/shiro/ExceptionTest.java  |  2 +-
 .../shiro/authc/ConcurrentAccessExceptionTest.java |  2 +-
 .../authc/ExcessiveAttemptsExceptionTest.java      |  2 +-
 .../authc/ExpiredCredentialsExceptionTest.java     |  2 +-
 .../authc/IncorrectCredentialsExceptionTest.java   |  2 +-
 .../shiro/authc/LockedAccountExceptionTest.java    |  2 +-
 .../shiro/authc/UnknownAccountExceptionTest.java   |  2 +-
 .../shiro/authz/AuthorizationExceptionTest.java    |  2 +-
 .../shiro/authz/HostUnauthorizedExceptionTest.java |  2 +-
 .../shiro/authz/UnauthenticatedExceptionTest.java  |  2 +-
 .../shiro/authz/UnauthorizedExceptionTest.java     |  2 +-
 .../apache/shiro/jndi/JndiObjectFactoryTest.java   | 10 +--
 .../shiro/lang/io/SerializationExceptionTest.java  |  2 +-
 .../hash/format/DefaultHashFormatFactory.java      |  8 +--
 .../shiro/event/support/EventClassComparator.java  |  8 +--
 .../support/SingleArgumentMethodEventListener.java |  6 +-
 .../shiro/event/support/TypedEventListener.java    |  2 +-
 .../org/apache/shiro/lang/io/XmlSerializer.java    | 83 ----------------------
 .../java/org/apache/shiro/lang/util/Assert.java    | 18 ++---
 .../org/apache/shiro/lang/util/LifecycleUtils.java |  6 +-
 .../org/apache/shiro/lang/util/SoftHashMap.java    | 28 ++++----
 .../org/apache/shiro/lang/util/StringUtils.java    | 17 +++--
 pom.xml                                            |  1 +
 .../org/apache/shiro/guice/BeanTypeListener.java   |  8 ++-
 .../shiro/guice/DestroyableInjectionListener.java  |  3 +-
 .../guice/InitializableInjectionListener.java      |  1 +
 .../apache/shiro/guice/LifecycleTypeListener.java  |  2 +-
 .../java/org/apache/shiro/guice/ShiroMatchers.java |  3 +-
 .../org/apache/shiro/guice/web/ShiroWebModule.java | 21 +++---
 .../guice/DestroyableInjectionListenerTest.java    |  5 +-
 .../guice/InitializableInjectionListenerTest.java  |  4 +-
 .../org/apache/shiro/guice/ShiroMatchersTest.java  |  3 +-
 .../apache/shiro/guice/aop/ShiroAopModuleTest.java |  4 +-
 .../guice/web/AbstractInjectionProviderTest.java   | 12 ++--
 .../guice/web/FilterChainResolverProviderTest.java |  2 +-
 .../guice/web/PathMatchingFilterProviderTest.java  |  8 +--
 .../guice/web/SimpleFilterChainResolverTest.java   |  2 +-
 .../shiro/cache/jcache/JCacheManagerTest.groovy    |  2 +-
 .../web/config/WebIniSecurityManagerFactory.java   |  3 +-
 .../shiro/web/session/HttpServletSession.java      |  6 +-
 .../org/apache/shiro/web/tags/PrincipalTag.java    |  3 +-
 .../org/apache/shiro/web/util/RedirectView.java    | 13 ++--
 .../java/org/apache/shiro/web/util/WebUtils.java   |  6 +-
 .../web/filter/mgt/SimpleNamedFilterListTest.java  |  4 +-
 55 files changed, 197 insertions(+), 296 deletions(-)

diff --git 
a/cache/src/main/java/org/apache/shiro/cache/AbstractCacheManager.java 
b/cache/src/main/java/org/apache/shiro/cache/AbstractCacheManager.java
index 62550c258..9f27fd6bb 100644
--- a/cache/src/main/java/org/apache/shiro/cache/AbstractCacheManager.java
+++ b/cache/src/main/java/org/apache/shiro/cache/AbstractCacheManager.java
@@ -94,7 +94,7 @@ public abstract class AbstractCacheManager implements 
CacheManager, Destroyable
      */
     public void destroy() throws Exception {
         while (!caches.isEmpty()) {
-            for (Cache cache : caches.values()) {
+            for (Cache<?, ?> cache : caches.values()) {
                 LifecycleUtils.destroy(cache);
             }
             caches.clear();
@@ -108,7 +108,7 @@ public abstract class AbstractCacheManager implements 
CacheManager, Destroyable
                 .append(caches.size())
                 .append(" cache(s)): [");
         int i = 0;
-        for (Cache cache : values) {
+        for (Cache<?, ?> cache : values) {
             if (i > 0) {
                 sb.append(", ");
             }
diff --git 
a/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java 
b/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java
index e6de827af..aa350452e 100644
--- 
a/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java
+++ 
b/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java
@@ -371,13 +371,13 @@ public class ReflectionBuilder {
         objects.put(name, instance);
     }
 
-    protected void applyProperty(String key, String value, Map objects) {
+    protected void applyProperty(String key, String value, Map<?, ?> objects) {
 
         int index = key.indexOf('.');
 
         if (index >= 0) {
             String name = key.substring(0, index);
-            String property = key.substring(index + 1, key.length());
+            String property = key.substring(index + 1);
 
             if (GLOBAL_PROPERTY_PREFIX.equalsIgnoreCase(name)) {
                 applyGlobalProperty(objects, property, value);
@@ -391,7 +391,7 @@ public class ReflectionBuilder {
         }
     }
 
-    protected void applyGlobalProperty(Map objects, String property, String 
value) {
+    protected void applyGlobalProperty(Map<?, ?> objects, String property, 
String value) {
         for (Object instance : objects.values()) {
             try {
                 PropertyDescriptor pd = 
beanUtilsBean.getPropertyUtils().getPropertyDescriptor(instance, property);
@@ -407,7 +407,7 @@ public class ReflectionBuilder {
         }
     }
 
-    protected void applySingleProperty(Map objects, String name, String 
property, String value) {
+    protected void applySingleProperty(Map<?, ?> objects, String name, String 
property, String value) {
         Object instance = objects.get(name);
         if (property.equals("class")) {
             throw new IllegalArgumentException("Property keys should not 
contain 'class' properties since these "
@@ -455,7 +455,7 @@ public class ReflectionBuilder {
         String id = getId(reference);
         LOGGER.debug("Encountered object reference '{}'.  Looking up object 
with id '{}'", reference, id);
         final Object referencedObject = getReferencedObject(id);
-        if (referencedObject instanceof Factory factory) {
+        if (referencedObject instanceof Factory<?> factory) {
             return factory.getInstance();
         }
         return referencedObject;
@@ -492,15 +492,15 @@ public class ReflectionBuilder {
         //SHIRO-423: check to see if the value is a referenced Set already, 
and if so, return it immediately:
         if (tokens.length == 1 && isReference(tokens[0])) {
             Object reference = resolveReference(tokens[0]);
-            if (reference instanceof Set set) {
+            if (reference instanceof Set<?> set) {
                 return set;
             }
         }
 
-        Set<String> setTokens = new 
LinkedHashSet<String>(Arrays.asList(tokens));
+        Set<String> setTokens = new LinkedHashSet<>(Arrays.asList(tokens));
 
         //now convert into correct values and/or references:
-        Set<Object> values = new LinkedHashSet<Object>(setTokens.size());
+        Set<Object> values = new LinkedHashSet<>(setTokens.size());
         for (String token : setTokens) {
             Object value = resolveValue(token);
             values.add(value);
@@ -518,12 +518,12 @@ public class ReflectionBuilder {
         //SHIRO-423: check to see if the value is a referenced Map already, 
and if so, return it immediately:
         if (tokens.length == 1 && isReference(tokens[0])) {
             Object reference = resolveReference(tokens[0]);
-            if (reference instanceof Map map) {
+            if (reference instanceof Map<?, ?> map) {
                 return map;
             }
         }
 
-        Map<String, String> mapTokens = new LinkedHashMap<String, 
String>(tokens.length);
+        Map<String, String> mapTokens = new LinkedHashMap<>(tokens.length);
         for (String token : tokens) {
             String[] kvPair = StringUtils.split(token, 
MAP_KEY_VALUE_DELIMITER);
             if (kvPair == null || kvPair.length != 2) {
@@ -536,7 +536,7 @@ public class ReflectionBuilder {
         }
 
         //now convert into correct values and/or references:
-        Map<Object, Object> map = new LinkedHashMap<Object, 
Object>(mapTokens.size());
+        Map<Object, Object> map = new LinkedHashMap<>(mapTokens.size());
         for (Map.Entry<String, String> entry : mapTokens.entrySet()) {
             Object key = resolveValue(entry.getKey());
             Object value = resolveValue(entry.getValue());
@@ -556,13 +556,13 @@ public class ReflectionBuilder {
         //SHIRO-423: check to see if the value is a referenced Collection 
already, and if so, return it immediately:
         if (tokens.length == 1 && isReference(tokens[0])) {
             Object reference = resolveReference(tokens[0]);
-            if (reference instanceof Collection collection) {
+            if (reference instanceof Collection<?> collection) {
                 return collection;
             }
         }
 
         //now convert into correct values and/or references:
-        List<Object> values = new ArrayList<Object>(tokens.length);
+        List<Object> values = new ArrayList<>(tokens.length);
         for (String token : tokens) {
             Object value = resolveValue(token);
             values.add(value);
@@ -579,13 +579,13 @@ public class ReflectionBuilder {
         //SHIRO-423: check to see if the value is a referenced List already, 
and if so, return it immediately:
         if (tokens.length == 1 && isReference(tokens[0])) {
             Object reference = resolveReference(tokens[0]);
-            if (reference instanceof List list) {
+            if (reference instanceof List<?> list) {
                 return list;
             }
         }
 
         //now convert into correct values and/or references:
-        List<Object> values = new ArrayList<Object>(tokens.length);
+        List<Object> values = new ArrayList<>(tokens.length);
         for (String token : tokens) {
             Object value = resolveValue(token);
             values.add(value);
@@ -670,11 +670,10 @@ public class ReflectionBuilder {
                     @SuppressWarnings("unchecked")
                     var map = (Map<Object, Object>) getProperty(object, 
mapPropertyPath);
                     Object mapKey = resolveValue(keyString);
-                    //noinspection unchecked
                     map.put(mapKey, value);
                 } else {
                     //must be an array property.  Convert the key string to an 
index:
-                    int index = Integer.valueOf(keyString);
+                    int index = Integer.parseInt(keyString);
                     setIndexedProperty(object, mapPropertyPath, index, value);
                 }
             }
@@ -683,12 +682,12 @@ public class ReflectionBuilder {
             //recursively call this method with the remaining property path
             Object referencedValue = null;
             if (isTypedProperty(object, mapPropertyPath, Map.class)) {
-                Map map = (Map) getProperty(object, mapPropertyPath);
+                Map<?, ?> map = (Map<?, ?>) getProperty(object, 
mapPropertyPath);
                 Object mapKey = resolveValue(keyString);
                 referencedValue = map.get(mapKey);
             } else {
                 //must be an array property:
-                int index = Integer.valueOf(keyString);
+                int index = Integer.parseInt(keyString);
                 referencedValue = getIndexedProperty(object, mapPropertyPath, 
index);
             }
 
@@ -1051,12 +1050,11 @@ public class ReflectionBuilder {
     //////////////////////////
     // CollectionUtils cannot be removed from shiro-core until 2.0 as it has a 
dependency on PrincipalCollection
 
-    private static boolean isEmpty(Map m) {
+    private static boolean isEmpty(Map<?, ?> m) {
         return m == null || m.isEmpty();
     }
 
-    private static boolean isEmpty(Collection c) {
+    private static boolean isEmpty(Collection<?> c) {
         return c == null || c.isEmpty();
     }
-
 }
diff --git a/core/src/main/java/org/apache/shiro/authc/SimpleAccount.java 
b/core/src/main/java/org/apache/shiro/authc/SimpleAccount.java
index 3dfacf561..959dfe135 100644
--- a/core/src/main/java/org/apache/shiro/authc/SimpleAccount.java
+++ b/core/src/main/java/org/apache/shiro/authc/SimpleAccount.java
@@ -186,7 +186,7 @@ public class SimpleAccount implements Account, 
MergableAuthenticationInfo, Salte
      * @param permissions the permissions assigned to this account directly 
(not those assigned to any of the realms).
      */
 
-    public SimpleAccount(Collection principals, Object credentials, String 
realmName,
+    public SimpleAccount(Collection<?> principals, Object credentials, String 
realmName,
                          Set<String> roleNames, Set<Permission> permissions) {
         this.authcInfo = new 
SimpleAuthenticationInfo(ImmutablePrincipalCollection.ofSinglePrincipal(principals,
 realmName),
                 credentials);
diff --git a/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java 
b/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java
index 85bae8bd6..f16ee970b 100644
--- a/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java
+++ b/core/src/main/java/org/apache/shiro/jndi/JndiLocator.java
@@ -133,7 +133,7 @@ public class JndiLocator {
      * @throws NamingException if the JNDI lookup failed
      * @see #setResourceRef
      */
-    protected Object lookup(String jndiName, Class requiredType) throws 
NamingException {
+    protected Object lookup(String jndiName, Class<?> requiredType) throws 
NamingException {
         if (jndiName == null) {
             throw new IllegalArgumentException("jndiName argument must not be 
null");
         }
diff --git a/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java 
b/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java
index 4600a802f..c4062bd6c 100644
--- a/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java
+++ b/core/src/main/java/org/apache/shiro/jndi/JndiTemplate.java
@@ -113,11 +113,11 @@ public class JndiTemplate {
     @SuppressWarnings({"unchecked"})
     protected Context createInitialContext() throws NamingException {
         Properties env = getEnvironment();
-        Hashtable icEnv = null;
+        Hashtable<String, String> icEnv = null;
         if (env != null) {
-            icEnv = new Hashtable(env.size());
-            for (Enumeration en = env.propertyNames(); en.hasMoreElements(); ) 
{
-                String key = (String) en.nextElement();
+            icEnv = new Hashtable<>(env.size());
+            for (Enumeration<String> en = (Enumeration<String>) 
env.propertyNames(); en.hasMoreElements(); ) {
+                String key = en.nextElement();
                 icEnv.put(key, env.getProperty(key));
             }
         }
@@ -160,7 +160,7 @@ public class JndiTemplate {
      * @throws NamingException if there is no object with the given
      *                         name bound to JNDI
      */
-    public Object lookup(String name, Class requiredType) throws 
NamingException {
+    public Object lookup(String name, Class<?> requiredType) throws 
NamingException {
         Object jndiObject = lookup(name);
         if (requiredType != null && !requiredType.isInstance(jndiObject)) {
             String msg = "Jndi object acquired under name '" + name + "' is of 
type ["
diff --git a/core/src/main/java/org/apache/shiro/realm/CachingRealm.java 
b/core/src/main/java/org/apache/shiro/realm/CachingRealm.java
index fbe47cf3b..bcb98bf74 100644
--- a/core/src/main/java/org/apache/shiro/realm/CachingRealm.java
+++ b/core/src/main/java/org/apache/shiro/realm/CachingRealm.java
@@ -200,7 +200,7 @@ public abstract class CachingRealm implements Realm, 
Nameable, CacheManagerAware
     protected Object getAvailablePrincipal(PrincipalCollection principals) {
         Object primary = null;
         if (!isEmpty(principals)) {
-            Collection thisPrincipals = principals.fromRealm(getName());
+            Collection<?> thisPrincipals = principals.fromRealm(getName());
             if (!CollectionUtils.isEmpty(thisPrincipals)) {
                 primary = thisPrincipals.iterator().next();
             } else {
diff --git 
a/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
 
b/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
index 86c398e83..0794ae98c 100644
--- 
a/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
+++ 
b/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
@@ -162,7 +162,7 @@ public class ActiveDirectoryRealm extends AbstractLdapRealm 
{
 
     protected Set<String> getRoleNamesForUser(String username, LdapContext 
ldapContext) throws NamingException {
         Set<String> roleNames;
-        roleNames = new LinkedHashSet<String>();
+        roleNames = new LinkedHashSet<>();
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
@@ -171,10 +171,10 @@ public class ActiveDirectoryRealm extends 
AbstractLdapRealm {
 
         Object[] searchArguments = new Object[] {userPrincipalName};
 
-        NamingEnumeration answer = ldapContext.search(searchBase, 
searchFilter, searchArguments, searchControls);
+        NamingEnumeration<SearchResult> answer = 
ldapContext.search(searchBase, searchFilter, searchArguments, searchControls);
 
         while (answer.hasMoreElements()) {
-            SearchResult sr = (SearchResult) answer.next();
+            SearchResult sr = answer.next();
 
             if (LOGGER.isDebugEnabled()) {
                 LOGGER.debug("Retrieving group names for user [" + 
sr.getName() + "]");
@@ -183,9 +183,9 @@ public class ActiveDirectoryRealm extends AbstractLdapRealm 
{
             Attributes attrs = sr.getAttributes();
 
             if (attrs != null) {
-                NamingEnumeration ae = attrs.getAll();
+                NamingEnumeration<? extends Attribute> ae = attrs.getAll();
                 while (ae.hasMore()) {
-                    Attribute attr = (Attribute) ae.next();
+                    Attribute attr = ae.next();
 
                     if (attr.getID().equals("memberOf")) {
 
@@ -212,7 +212,7 @@ public class ActiveDirectoryRealm extends AbstractLdapRealm 
{
      * @return a collection of roles that are implied by the given role names.
      */
     protected Collection<String> getRoleNamesForGroups(Collection<String> 
groupNames) {
-        Set<String> roleNames = new HashSet<String>(groupNames.size());
+        Set<String> roleNames = new HashSet<>(groupNames.size());
 
         if (groupRolesMap != null) {
             for (String groupName : groupNames) {
diff --git a/core/src/main/java/org/apache/shiro/realm/ldap/LdapUtils.java 
b/core/src/main/java/org/apache/shiro/realm/ldap/LdapUtils.java
index e03998c57..33d812c6d 100644
--- a/core/src/main/java/org/apache/shiro/realm/ldap/LdapUtils.java
+++ b/core/src/main/java/org/apache/shiro/realm/ldap/LdapUtils.java
@@ -69,8 +69,8 @@ public final class LdapUtils {
      * @throws javax.naming.NamingException if there is an LDAP error while 
reading the values.
      */
     public static Collection<String> getAllAttributeValues(Attribute attr) 
throws NamingException {
-        Set<String> values = new HashSet<String>();
-        NamingEnumeration ne = null;
+        Set<String> values = new HashSet<>();
+        NamingEnumeration<?> ne = null;
         try {
             ne = attr.getAll();
             while (ne.hasMore()) {
@@ -89,7 +89,7 @@ public final class LdapUtils {
      * [1] <a 
href="https://issues.apache.org/jira/browse/SHIRO-127?focusedCommentId=12891380
      * 
&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12891380">SHIRO-127</a>
      */
-    public static void closeEnumeration(NamingEnumeration ne) {
+    public static void closeEnumeration(NamingEnumeration<?> ne) {
         try {
             if (ne != null) {
                 ne.close();
diff --git 
a/core/src/main/java/org/apache/shiro/subject/MutablePrincipalCollection.java 
b/core/src/main/java/org/apache/shiro/subject/MutablePrincipalCollection.java
index b1cdd871b..bb6869995 100644
--- 
a/core/src/main/java/org/apache/shiro/subject/MutablePrincipalCollection.java
+++ 
b/core/src/main/java/org/apache/shiro/subject/MutablePrincipalCollection.java
@@ -46,7 +46,7 @@ public interface MutablePrincipalCollection extends 
PrincipalCollection {
      * @param principals the principals to be added.
      * @param realmName  the realm these principals came from.
      */
-    void addAll(Collection principals, String realmName);
+    void addAll(Collection<?> principals, String realmName);
 
     /**
      * Adds all of the principals from the given principal collection to this 
collection.
diff --git 
a/core/src/main/java/org/apache/shiro/subject/SimplePrincipalCollection.java 
b/core/src/main/java/org/apache/shiro/subject/SimplePrincipalCollection.java
index b48848048..4f847de0b 100644
--- a/core/src/main/java/org/apache/shiro/subject/SimplePrincipalCollection.java
+++ b/core/src/main/java/org/apache/shiro/subject/SimplePrincipalCollection.java
@@ -62,7 +62,7 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
     private static final long serialVersionUID = -6305224034025797558L;
 
     //TODO - complete JavaDoc
-    private Map<String, Set> realmPrincipals;
+    private Map<String, Set<Object>> realmPrincipals;
 
     //cached toString() result, as this can be printed many times in logging
     private transient String cachedToString;
@@ -71,14 +71,14 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
     }
 
     public SimplePrincipalCollection(Object principal, String realmName) {
-        if (principal instanceof Collection collection) {
+        if (principal instanceof Collection<?> collection) {
             addAll(collection, realmName);
         } else {
             add(principal, realmName);
         }
     }
 
-    public SimplePrincipalCollection(Collection principals, String realmName) {
+    public SimplePrincipalCollection(Collection<?> principals, String 
realmName) {
         addAll(principals, realmName);
     }
 
@@ -86,16 +86,11 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
         addAll(principals);
     }
 
-    protected Collection getPrincipalsLazy(String realmName) {
+    protected Collection<Object> getPrincipalsLazy(String realmName) {
         if (realmPrincipals == null) {
-            realmPrincipals = new LinkedHashMap<String, Set>();
+            realmPrincipals = new LinkedHashMap<>();
         }
-        Set principals = realmPrincipals.get(realmName);
-        if (principals == null) {
-            principals = new LinkedHashSet();
-            realmPrincipals.put(realmName, principals);
-        }
-        return principals;
+        return realmPrincipals.computeIfAbsent(realmName, k -> new 
LinkedHashSet<>());
     }
 
     /**
@@ -125,7 +120,7 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
         getPrincipalsLazy(realmName).add(principal);
     }
 
-    public void addAll(Collection principals, String realmName) {
+    public void addAll(Collection<?> principals, String realmName) {
         if (realmName == null) {
             throw new NullPointerException("realmName argument cannot be 
null.");
         }
@@ -153,8 +148,8 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
         if (realmPrincipals == null || realmPrincipals.isEmpty()) {
             return null;
         }
-        Collection<Set> values = realmPrincipals.values();
-        for (Set set : values) {
+        Collection<Set<Object>> values = realmPrincipals.values();
+        for (Set<Object> set : values) {
             for (Object o : set) {
                 if (type.isAssignableFrom(o.getClass())) {
                     return (T) o;
@@ -166,11 +161,11 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
 
     public <T> Collection<T> byType(Class<T> type) {
         if (realmPrincipals == null || realmPrincipals.isEmpty()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
-        Set<T> typed = new LinkedHashSet<T>();
-        Collection<Set> values = realmPrincipals.values();
-        for (Set set : values) {
+        Set<T> typed = new LinkedHashSet<>();
+        Collection<Set<Object>> values = realmPrincipals.values();
+        for (Set<?> set : values) {
             for (Object o : set) {
                 if (type.isAssignableFrom(o.getClass())) {
                     typed.add((T) o);
@@ -178,41 +173,41 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
             }
         }
         if (typed.isEmpty()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
         return Collections.unmodifiableSet(typed);
     }
 
-    public List asList() {
-        Set all = asSet();
+    public List<Object> asList() {
+        Set<?> all = asSet();
         if (all.isEmpty()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
-        return Collections.unmodifiableList(new ArrayList(all));
+        return Collections.unmodifiableList(new ArrayList<>(all));
     }
 
-    public Set asSet() {
+    public Set<Object> asSet() {
         if (realmPrincipals == null || realmPrincipals.isEmpty()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
-        Set aggregated = new LinkedHashSet();
-        Collection<Set> values = realmPrincipals.values();
-        for (Set set : values) {
+        Set<Object> aggregated = new LinkedHashSet<>();
+        Collection<Set<Object>> values = realmPrincipals.values();
+        for (Set<Object> set : values) {
             aggregated.addAll(set);
         }
         if (aggregated.isEmpty()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
         return Collections.unmodifiableSet(aggregated);
     }
 
-    public Collection fromRealm(String realmName) {
+    public Collection<Object> fromRealm(String realmName) {
         if (realmPrincipals == null || realmPrincipals.isEmpty()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
-        Set principals = realmPrincipals.get(realmName);
+        Set<Object> principals = realmPrincipals.get(realmName);
         if (principals == null || principals.isEmpty()) {
-            principals = Collections.EMPTY_SET;
+            principals = Collections.emptySet();
         }
         return Collections.unmodifiableSet(principals);
     }
@@ -237,7 +232,7 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
         }
     }
 
-    public Iterator iterator() {
+    public Iterator<Object> iterator() {
         return asSet().iterator();
     }
 
@@ -287,6 +282,7 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
      * @param out output stream provided by Java serialization
      * @throws IOException if there is a stream error
      */
+    @Serial
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
         boolean principalsExist = !CollectionUtils.isEmpty(realmPrincipals);
@@ -308,11 +304,12 @@ public class SimplePrincipalCollection implements 
MutablePrincipalCollection {
      * @throws IOException            if there is an input/output problem
      * @throws ClassNotFoundException if the underlying Map implementation 
class is not available to the classloader.
      */
+    @Serial
     private void readObject(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
         in.defaultReadObject();
         boolean principalsExist = in.readBoolean();
         if (principalsExist) {
-            this.realmPrincipals = (Map<String, Set>) in.readObject();
+            this.realmPrincipals = (Map<String, Set<Object>>) in.readObject();
         }
     }
 }
diff --git a/core/src/main/java/org/apache/shiro/util/CollectionUtils.java 
b/core/src/main/java/org/apache/shiro/util/CollectionUtils.java
index a1b37d301..67a6de104 100644
--- a/core/src/main/java/org/apache/shiro/util/CollectionUtils.java
+++ b/core/src/main/java/org/apache/shiro/util/CollectionUtils.java
@@ -62,7 +62,7 @@ public final class CollectionUtils {
      * {@code false} otherwise.
      * @since 1.0
      */
-    public static boolean isEmpty(Collection c) {
+    public static boolean isEmpty(Collection<?> c) {
         return c == null || c.isEmpty();
     }
 
@@ -75,7 +75,7 @@ public final class CollectionUtils {
      * {@code false} otherwise.
      * @since 1.0
      */
-    public static boolean isEmpty(Map m) {
+    public static boolean isEmpty(Map<?, ?> m) {
         return m == null || m.isEmpty();
     }
 
@@ -86,7 +86,7 @@ public final class CollectionUtils {
      * @return the size of the specified collection or {@code 0} if the 
collection is {@code null}.
      * @since 1.2
      */
-    public static int size(Collection c) {
+    public static int size(Collection<?> c) {
         return c != null ? c.size() : 0;
     }
 
@@ -97,7 +97,7 @@ public final class CollectionUtils {
      * @return the size of the specified map or {@code 0} if the map is {@code 
null}.
      * @since 1.2
      */
-    public static int size(Map m) {
+    public static int size(Map<?, ?> m) {
         return m != null ? m.size() : 0;
     }
 
@@ -127,16 +127,6 @@ public final class CollectionUtils {
         return Arrays.asList(elements);
     }
 
-    /*public static <E> Deque<E> asDeque(E... elements) {
-        if (elements == null || elements.length == 0) {
-            return new ArrayDeque<E>();
-        }
-        // Avoid integer overflow when a large array is passed in
-        int capacity = computeListCapacity(elements.length);
-        ArrayDeque<E> deque = new ArrayDeque<E>(capacity);
-        Collections.addAll(deque, elements);
-        return deque;
-    }*/
     @SuppressWarnings("checkstyle:MagicNumber")
     static int computeListCapacity(int arraySize) {
         return (int) Math.min(5L + arraySize + (arraySize / 10), 
Integer.MAX_VALUE);
diff --git a/core/src/test/java/org/apache/shiro/ExceptionTest.java 
b/core/src/test/java/org/apache/shiro/ExceptionTest.java
index c9fb1ebaf..2643037b7 100644
--- a/core/src/test/java/org/apache/shiro/ExceptionTest.java
+++ b/core/src/test/java/org/apache/shiro/ExceptionTest.java
@@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
 @SuppressWarnings({"ThrowableInstanceNeverThrown"})
 public abstract class ExceptionTest {
 
-    protected abstract Class getExceptionClass();
+    protected abstract Class<?> getExceptionClass();
 
     @Test
     void testNoArgConstructor() {
diff --git 
a/core/src/test/java/org/apache/shiro/authc/ConcurrentAccessExceptionTest.java 
b/core/src/test/java/org/apache/shiro/authc/ConcurrentAccessExceptionTest.java
index 28a45d942..079785e07 100644
--- 
a/core/src/test/java/org/apache/shiro/authc/ConcurrentAccessExceptionTest.java
+++ 
b/core/src/test/java/org/apache/shiro/authc/ConcurrentAccessExceptionTest.java
@@ -30,7 +30,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class ConcurrentAccessExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return ConcurrentAccessException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authc/ExcessiveAttemptsExceptionTest.java 
b/core/src/test/java/org/apache/shiro/authc/ExcessiveAttemptsExceptionTest.java
index bfc5d9b9f..f25f0373c 100644
--- 
a/core/src/test/java/org/apache/shiro/authc/ExcessiveAttemptsExceptionTest.java
+++ 
b/core/src/test/java/org/apache/shiro/authc/ExcessiveAttemptsExceptionTest.java
@@ -30,7 +30,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class ExcessiveAttemptsExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return ExcessiveAttemptsException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authc/ExpiredCredentialsExceptionTest.java
 
b/core/src/test/java/org/apache/shiro/authc/ExpiredCredentialsExceptionTest.java
index 0b2caa18c..eef1337e7 100644
--- 
a/core/src/test/java/org/apache/shiro/authc/ExpiredCredentialsExceptionTest.java
+++ 
b/core/src/test/java/org/apache/shiro/authc/ExpiredCredentialsExceptionTest.java
@@ -30,7 +30,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class ExpiredCredentialsExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return ExpiredCredentialsException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authc/IncorrectCredentialsExceptionTest.java
 
b/core/src/test/java/org/apache/shiro/authc/IncorrectCredentialsExceptionTest.java
index c35d8f68c..730223663 100644
--- 
a/core/src/test/java/org/apache/shiro/authc/IncorrectCredentialsExceptionTest.java
+++ 
b/core/src/test/java/org/apache/shiro/authc/IncorrectCredentialsExceptionTest.java
@@ -30,7 +30,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class IncorrectCredentialsExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return IncorrectCredentialsException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authc/LockedAccountExceptionTest.java 
b/core/src/test/java/org/apache/shiro/authc/LockedAccountExceptionTest.java
index fbfbaa4ae..a4c94c1f6 100644
--- a/core/src/test/java/org/apache/shiro/authc/LockedAccountExceptionTest.java
+++ b/core/src/test/java/org/apache/shiro/authc/LockedAccountExceptionTest.java
@@ -30,7 +30,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class LockedAccountExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return LockedAccountException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authc/UnknownAccountExceptionTest.java 
b/core/src/test/java/org/apache/shiro/authc/UnknownAccountExceptionTest.java
index f00fedec2..93a5393f5 100644
--- a/core/src/test/java/org/apache/shiro/authc/UnknownAccountExceptionTest.java
+++ b/core/src/test/java/org/apache/shiro/authc/UnknownAccountExceptionTest.java
@@ -30,7 +30,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class UnknownAccountExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return UnknownAccountException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authz/AuthorizationExceptionTest.java 
b/core/src/test/java/org/apache/shiro/authz/AuthorizationExceptionTest.java
index bcc487a0c..26855a07f 100644
--- a/core/src/test/java/org/apache/shiro/authz/AuthorizationExceptionTest.java
+++ b/core/src/test/java/org/apache/shiro/authz/AuthorizationExceptionTest.java
@@ -26,7 +26,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class AuthorizationExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return AuthorizationException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authz/HostUnauthorizedExceptionTest.java 
b/core/src/test/java/org/apache/shiro/authz/HostUnauthorizedExceptionTest.java
index 06876e421..edbeb242b 100644
--- 
a/core/src/test/java/org/apache/shiro/authz/HostUnauthorizedExceptionTest.java
+++ 
b/core/src/test/java/org/apache/shiro/authz/HostUnauthorizedExceptionTest.java
@@ -26,7 +26,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class HostUnauthorizedExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return HostUnauthorizedException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authz/UnauthenticatedExceptionTest.java 
b/core/src/test/java/org/apache/shiro/authz/UnauthenticatedExceptionTest.java
index e47fb10bf..ef6954d6c 100644
--- 
a/core/src/test/java/org/apache/shiro/authz/UnauthenticatedExceptionTest.java
+++ 
b/core/src/test/java/org/apache/shiro/authz/UnauthenticatedExceptionTest.java
@@ -26,7 +26,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class UnauthenticatedExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return UnauthenticatedException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/authz/UnauthorizedExceptionTest.java 
b/core/src/test/java/org/apache/shiro/authz/UnauthorizedExceptionTest.java
index c45bb33f9..a15959295 100644
--- a/core/src/test/java/org/apache/shiro/authz/UnauthorizedExceptionTest.java
+++ b/core/src/test/java/org/apache/shiro/authz/UnauthorizedExceptionTest.java
@@ -26,7 +26,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class UnauthorizedExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return UnauthorizedException.class;
     }
 }
diff --git 
a/core/src/test/java/org/apache/shiro/jndi/JndiObjectFactoryTest.java 
b/core/src/test/java/org/apache/shiro/jndi/JndiObjectFactoryTest.java
index 092e19105..65526aee2 100644
--- a/core/src/test/java/org/apache/shiro/jndi/JndiObjectFactoryTest.java
+++ b/core/src/test/java/org/apache/shiro/jndi/JndiObjectFactoryTest.java
@@ -29,17 +29,17 @@ import static 
org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOf
  * This test makes the assumption that {@link JndiLocator} is tested elsewhere 
and only makes an attempt to test the
  * functionality added by {@link JndiObjectFactory}.
  */
-public class JndiObjectFactoryTest {
+class JndiObjectFactoryTest {
     @Test
     void testGetInstanceWithType() throws Exception {
         final String name = "my/jndi/resource";
         final String returnValue = "jndiString";
         JndiObjectFactory<String> underTest = new JndiObjectFactory<String>() {
             @Override
-            protected Object lookup(String jndiName, Class requiredType) 
throws NamingException {
+            protected Object lookup(String jndiName, Class<?> requiredType) 
throws NamingException {
                 assertThat(jndiName).isEqualTo(name);
                 assertThat(requiredType).isEqualTo(String.class);
-                return new String(returnValue);
+                return returnValue;
             }
         };
 
@@ -57,7 +57,7 @@ public class JndiObjectFactoryTest {
             @Override
             protected Object lookup(String jndiName) throws NamingException {
                 assertThat(jndiName).isEqualTo(name);
-                return new String(returnValue);
+                return returnValue;
             }
         };
 
@@ -72,7 +72,7 @@ public class JndiObjectFactoryTest {
             final String name = "my/jndi/resource";
             JndiObjectFactory<String> underTest = new 
JndiObjectFactory<String>() {
                 @Override
-                protected Object lookup(String jndiName, Class requiredType) 
throws NamingException {
+                protected Object lookup(String jndiName, Class<?> 
requiredType) throws NamingException {
                     throw new NamingException("No resource named " + jndiName);
                 }
             };
diff --git 
a/core/src/test/java/org/apache/shiro/lang/io/SerializationExceptionTest.java 
b/core/src/test/java/org/apache/shiro/lang/io/SerializationExceptionTest.java
index 29fe20d1f..c43ddc3f4 100644
--- 
a/core/src/test/java/org/apache/shiro/lang/io/SerializationExceptionTest.java
+++ 
b/core/src/test/java/org/apache/shiro/lang/io/SerializationExceptionTest.java
@@ -26,7 +26,7 @@ import org.apache.shiro.ExceptionTest;
  */
 public class SerializationExceptionTest extends ExceptionTest {
 
-    protected Class getExceptionClass() {
+    protected Class<?> getExceptionClass() {
         return SerializationException.class;
     }
 }
diff --git 
a/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/format/DefaultHashFormatFactory.java
 
b/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/format/DefaultHashFormatFactory.java
index d4f26d2c0..00079bee9 100644
--- 
a/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/format/DefaultHashFormatFactory.java
+++ 
b/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/format/DefaultHashFormatFactory.java
@@ -185,9 +185,9 @@ public class DefaultHashFormatFactory implements 
HashFormatFactory {
      * @param token the string token from which a class name will be 
heuristically determined.
      * @return the discovered HashFormat class implementation or {@code null} 
if no class could be heuristically determined.
      */
-    protected Class getHashFormatClass(String token) {
+    protected Class<?> getHashFormatClass(String token) {
 
-        Class clazz = null;
+        Class<?> clazz = null;
 
         //check to see if the token is a configured FQCN alias.  This is 
faster than searching packages,
         //so we try this first:
@@ -324,7 +324,7 @@ public class DefaultHashFormatFactory implements 
HashFormatFactory {
         return null;
     }
 
-    protected final void assertHashFormatImpl(Class clazz) {
+    protected final void assertHashFormatImpl(Class<?> clazz) {
         if (!HashFormat.class.isAssignableFrom(clazz) || clazz.isInterface()) {
             throw new IllegalArgumentException("Discovered class [" + 
clazz.getName() + "] is not a "
                     + HashFormat.class.getName() + " implementation.");
@@ -332,7 +332,7 @@ public class DefaultHashFormatFactory implements 
HashFormatFactory {
 
     }
 
-    protected final HashFormat newHashFormatInstance(Class clazz) {
+    protected final HashFormat newHashFormatInstance(Class<?> clazz) {
         assertHashFormatImpl(clazz);
         return (HashFormat) ClassUtils.newInstance(clazz);
     }
diff --git 
a/event/src/main/java/org/apache/shiro/event/support/EventClassComparator.java 
b/event/src/main/java/org/apache/shiro/event/support/EventClassComparator.java
index 0fcbba3b4..c85445375 100644
--- 
a/event/src/main/java/org/apache/shiro/event/support/EventClassComparator.java
+++ 
b/event/src/main/java/org/apache/shiro/event/support/EventClassComparator.java
@@ -47,10 +47,8 @@ import java.util.Comparator;
  *
  * @since 1.3
  */
-public class EventClassComparator implements Comparator<Class> {
-
-    @SuppressWarnings("unchecked")
-    public int compare(Class a, Class b) {
+public class EventClassComparator implements Comparator<Class<?>> {
+    public int compare(Class<?> a, Class<?> b) {
         if (a == null) {
             if (b == null) {
                 return 0;
@@ -59,7 +57,7 @@ public class EventClassComparator implements 
Comparator<Class> {
             }
         } else if (b == null) {
             return 1;
-        } else if (a == b || a.equals(b)) {
+        } else if (a == b) {
             return 0;
         } else {
             if (a.isAssignableFrom(b)) {
diff --git 
a/event/src/main/java/org/apache/shiro/event/support/SingleArgumentMethodEventListener.java
 
b/event/src/main/java/org/apache/shiro/event/support/SingleArgumentMethodEventListener.java
index 9475a7ed3..48d59c4bb 100644
--- 
a/event/src/main/java/org/apache/shiro/event/support/SingleArgumentMethodEventListener.java
+++ 
b/event/src/main/java/org/apache/shiro/event/support/SingleArgumentMethodEventListener.java
@@ -59,7 +59,7 @@ public class SingleArgumentMethodEventListener implements 
TypedEventListener {
         return event != null && getEventType().isInstance(event);
     }
 
-    public Class getEventType() {
+    public Class<?> getEventType() {
         return getMethodArgumentType(getMethod());
     }
 
@@ -72,8 +72,8 @@ public class SingleArgumentMethodEventListener implements 
TypedEventListener {
         }
     }
 
-    protected Class getMethodArgumentType(Method method) {
-        Class[] paramTypes = method.getParameterTypes();
+    protected Class<?> getMethodArgumentType(Method method) {
+        Class<?>[] paramTypes = method.getParameterTypes();
         if (paramTypes.length != 1) {
             //the default implementation expects a single typed argument and 
nothing more:
             String msg = "Event handler methods must accept a single 
argument.";
diff --git 
a/event/src/main/java/org/apache/shiro/event/support/TypedEventListener.java 
b/event/src/main/java/org/apache/shiro/event/support/TypedEventListener.java
index f266bf398..2b2fe4a30 100644
--- a/event/src/main/java/org/apache/shiro/event/support/TypedEventListener.java
+++ b/event/src/main/java/org/apache/shiro/event/support/TypedEventListener.java
@@ -23,5 +23,5 @@ package org.apache.shiro.event.support;
  */
 public interface TypedEventListener extends EventListener {
 
-    Class getEventType();
+    Class<?> getEventType();
 }
diff --git a/lang/src/main/java/org/apache/shiro/lang/io/XmlSerializer.java 
b/lang/src/main/java/org/apache/shiro/lang/io/XmlSerializer.java
deleted file mode 100644
index f577c9c02..000000000
--- a/lang/src/main/java/org/apache/shiro/lang/io/XmlSerializer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.shiro.lang.io;
-
-import java.beans.XMLDecoder;
-import java.beans.XMLEncoder;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-
-/**
- * Serializer implementation that uses the JavaBeans
- * {@link java.beans.XMLEncoder XMLEncoder} and {@link java.beans.XMLDecoder 
XMLDecoder} to serialize
- * and deserialize, respectively.
- * <p/>
- * <b>NOTE:</b> The JavaBeans XMLEncoder/XMLDecoder only successfully 
encode/decode objects when they are
- * JavaBeans compatible!
- *
- * @since 0.9
- * @deprecated This class should not be used directly because of insecure 
XMLEncoder/XMLDecoder usage.
- */
-@Deprecated(forRemoval = true)
-public class XmlSerializer implements Serializer {
-
-    /**
-     * Serializes the specified <code>source</code> into a byte[] array by 
using the
-     * {@link java.beans.XMLEncoder XMLEncoder} to encode the object out to a
-     * {@link java.io.ByteArrayOutputStream ByteArrayOutputStream}, where the 
resulting byte[] array is returned.
-     *
-     * @param source the Object to convert into a byte[] array.
-     * @return the byte[] array representation of the XML encoded output.
-     */
-    public byte[] serialize(Object source) {
-        if (source == null) {
-            String msg = "argument cannot be null.";
-            throw new IllegalArgumentException(msg);
-        }
-
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(bos));
-        encoder.writeObject(source);
-        encoder.close();
-
-        return bos.toByteArray();
-    }
-
-    /**
-     * Deserializes the specified <code>serialized</code> source back into an 
Object by using a
-     * {@link java.io.ByteArrayInputStream ByteArrayInputStream} to wrap the 
argument and then decode this
-     * stream via an {@link java.beans.XMLDecoder XMLDecoder}, where the
-     * {@link java.beans.XMLDecoder#readObject() readObject} call results in 
the original Object to return.
-     *
-     * @param serialized the byte[] array representation of the XML encoded 
output.
-     * @return the original source Object in reconstituted form.
-     */
-    public Object deserialize(byte[] serialized) {
-        if (serialized == null) {
-            throw new IllegalArgumentException("Argument cannot be null.");
-        }
-        ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
-        XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(bis));
-        Object o = decoder.readObject();
-        decoder.close();
-        return o;
-    }
-}
diff --git a/lang/src/main/java/org/apache/shiro/lang/util/Assert.java 
b/lang/src/main/java/org/apache/shiro/lang/util/Assert.java
index 0f8bb4af5..b932f6284 100644
--- a/lang/src/main/java/org/apache/shiro/lang/util/Assert.java
+++ b/lang/src/main/java/org/apache/shiro/lang/util/Assert.java
@@ -282,7 +282,7 @@ public abstract class Assert {
      * @param message    the exception message to use if the assertion fails
      * @throws IllegalArgumentException if the collection is <code>null</code> 
or has no elements
      */
-    public static void notEmpty(Collection collection, String message) {
+    public static void notEmpty(Collection<?> collection, String message) {
         if (isEmpty(collection)) {
             throw new IllegalArgumentException(message);
         }
@@ -296,7 +296,7 @@ public abstract class Assert {
      * @param collection the collection to check
      * @throws IllegalArgumentException if the collection is <code>null</code> 
or has no elements
      */
-    public static void notEmpty(Collection collection) {
+    public static void notEmpty(Collection<?> collection) {
         notEmpty(collection,
                 "[Assertion failed] - this collection must not be empty: it 
must contain at least 1 element");
     }
@@ -310,7 +310,7 @@ public abstract class Assert {
      * @param message the exception message to use if the assertion fails
      * @throws IllegalArgumentException if the map is <code>null</code> or has 
no entries
      */
-    public static void notEmpty(Map map, String message) {
+    public static void notEmpty(Map<?, ?> map, String message) {
         if (isEmpty(map)) {
             throw new IllegalArgumentException(message);
         }
@@ -324,7 +324,7 @@ public abstract class Assert {
      * @param map the map to check
      * @throws IllegalArgumentException if the map is <code>null</code> or has 
no entries
      */
-    public static void notEmpty(Map map) {
+    public static void notEmpty(Map<?, ?> map) {
         notEmpty(map, "[Assertion failed] - this map must not be empty; it 
must contain at least one entry");
     }
 
@@ -338,7 +338,7 @@ public abstract class Assert {
      * @throws IllegalArgumentException if the object is not an instance of 
clazz
      * @see Class#isInstance
      */
-    public static void isInstanceOf(Class clazz, Object obj) {
+    public static void isInstanceOf(Class<?> clazz, Object obj) {
         isInstanceOf(clazz, obj, "");
     }
 
@@ -355,7 +355,7 @@ public abstract class Assert {
      * @throws IllegalArgumentException if the object is not an instance of 
clazz
      * @see Class#isInstance
      */
-    public static void isInstanceOf(Class type, Object obj, String message) {
+    public static void isInstanceOf(Class<?> type, Object obj, String message) 
{
         notNull(type, "Type to check against must not be null");
         if (!type.isInstance(obj)) {
             throw new IllegalArgumentException(message
@@ -372,7 +372,7 @@ public abstract class Assert {
      * @param subType   the sub type to check
      * @throws IllegalArgumentException if the classes are not assignable
      */
-    public static void isAssignable(Class superType, Class subType) {
+    public static void isAssignable(Class<?> superType, Class<?> subType) {
         isAssignable(superType, subType, "");
     }
 
@@ -432,11 +432,11 @@ public abstract class Assert {
     //////////////////////////
     // CollectionUtils cannot be removed from shiro-core until 2.0 as it has a 
dependency on PrincipalCollection
 
-    private static boolean isEmpty(Map m) {
+    private static boolean isEmpty(Map<?, ?> m) {
         return m == null || m.isEmpty();
     }
 
-    private static boolean isEmpty(Collection c) {
+    private static boolean isEmpty(Collection<?> c) {
         return c == null || c.isEmpty();
     }
 
diff --git a/lang/src/main/java/org/apache/shiro/lang/util/LifecycleUtils.java 
b/lang/src/main/java/org/apache/shiro/lang/util/LifecycleUtils.java
index d1dde1eeb..5ca87ec12 100644
--- a/lang/src/main/java/org/apache/shiro/lang/util/LifecycleUtils.java
+++ b/lang/src/main/java/org/apache/shiro/lang/util/LifecycleUtils.java
@@ -53,7 +53,7 @@ public abstract class LifecycleUtils {
      * @throws ShiroException if unable to initialize one or more instances.
      * @since 0.9
      */
-    public static void init(Collection c) throws ShiroException {
+    public static void init(Collection<?> c) throws ShiroException {
         if (c == null || c.isEmpty()) {
             return;
         }
@@ -65,7 +65,7 @@ public abstract class LifecycleUtils {
     public static void destroy(Object o) {
         if (o instanceof Destroyable destroyable) {
             destroy(destroyable);
-        } else if (o instanceof Collection collection) {
+        } else if (o instanceof Collection<?> collection) {
             destroy(collection);
         }
     }
@@ -90,7 +90,7 @@ public abstract class LifecycleUtils {
      * @param c the collection of objects to destroy.
      * @since 0.9
      */
-    public static void destroy(Collection c) {
+    public static void destroy(Collection<?> c) {
         if (c == null || c.isEmpty()) {
             return;
         }
diff --git a/lang/src/main/java/org/apache/shiro/lang/util/SoftHashMap.java 
b/lang/src/main/java/org/apache/shiro/lang/util/SoftHashMap.java
index a5a33b8c5..782750630 100644
--- a/lang/src/main/java/org/apache/shiro/lang/util/SoftHashMap.java
+++ b/lang/src/main/java/org/apache/shiro/lang/util/SoftHashMap.java
@@ -108,14 +108,13 @@ public class SoftHashMap<K, V> implements Map<K, V> {
      * @param retentionSize the total number of most recent entries in the map 
that will be strongly referenced
      *                      (retained), preventing them from being eagerly 
garbage collected by the JVM.
      */
-    @SuppressWarnings({"unchecked"})
     public SoftHashMap(int retentionSize) {
         super();
         this.retentionSize = Math.max(0, retentionSize);
-        queue = new ReferenceQueue<V>();
+        queue = new ReferenceQueue<>();
         strongReferencesLock = new ReentrantLock();
-        map = new ConcurrentHashMap<K, SoftValue<V, K>>();
-        strongReferences = new ConcurrentLinkedQueue<V>();
+        map = new ConcurrentHashMap<>();
+        strongReferences = new ConcurrentLinkedQueue<>();
     }
 
     /**
@@ -198,8 +197,8 @@ public class SoftHashMap<K, V> implements Map<K, V> {
      */
     @SuppressWarnings({"unchecked", "SuspiciousMethodCalls"})
     private void processQueue() {
-        SoftValue sv;
-        while ((sv = (SoftValue) queue.poll()) != null) {
+        SoftValue<K, ? super V> sv;
+        while ((sv = (SoftValue<K, ? super V>) queue.poll()) != null) {
             // we can access private data!
             map.remove(sv.key);
         }
@@ -217,8 +216,8 @@ public class SoftHashMap<K, V> implements Map<K, V> {
 
     public boolean containsValue(Object value) {
         processQueue();
-        Collection values = values();
-        return values != null && values.contains(value);
+        Collection<?> values = values();
+        return values.contains(value);
     }
 
     public void putAll(Map<? extends K, ? extends V> m) {
@@ -236,14 +235,13 @@ public class SoftHashMap<K, V> implements Map<K, V> {
         return map.keySet();
     }
 
-    @SuppressWarnings("unchecked")
     public Collection<V> values() {
         processQueue();
         Collection<K> keys = map.keySet();
         if (keys.isEmpty()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
-        Collection<V> values = new ArrayList<V>(keys.size());
+        Collection<V> values = new ArrayList<>(keys.size());
         for (K key : keys) {
             V v = get(key);
             if (v != null) {
@@ -259,7 +257,7 @@ public class SoftHashMap<K, V> implements Map<K, V> {
     public V put(K key, V value) {
         // throw out garbage collected values first
         processQueue();
-        SoftValue<V, K> sv = new SoftValue<V, K>(value, key, queue);
+        SoftValue<V, K> sv = new SoftValue<>(value, key, queue);
         SoftValue<V, K> previous = map.put(key, sv);
         addToStrongReferences(value);
         return previous != null ? previous.get() : null;
@@ -290,17 +288,15 @@ public class SoftHashMap<K, V> implements Map<K, V> {
         return map.size();
     }
 
-    @SuppressWarnings("unchecked")
     public Set<Map.Entry<K, V>> entrySet() {
         // throw out garbage collected values first
         processQueue();
         Collection<K> keys = map.keySet();
         if (keys.isEmpty()) {
-            //noinspection unchecked
-            return Collections.EMPTY_SET;
+            return Collections.emptyNavigableSet();
         }
 
-        Map<K, V> kvPairs = new HashMap<K, V>(keys.size());
+        Map<K, V> kvPairs = new HashMap<>(keys.size());
         for (K key : keys) {
             V v = get(key);
             if (v != null) {
diff --git a/lang/src/main/java/org/apache/shiro/lang/util/StringUtils.java 
b/lang/src/main/java/org/apache/shiro/lang/util/StringUtils.java
index a3a1256fb..7ff091c41 100644
--- a/lang/src/main/java/org/apache/shiro/lang/util/StringUtils.java
+++ b/lang/src/main/java/org/apache/shiro/lang/util/StringUtils.java
@@ -105,7 +105,7 @@ public final class StringUtils {
      * @see #hasText(String)
      */
     public static boolean hasLength(String str) {
-        return (str != null && str.length() > 0);
+        return (str != null && !str.isEmpty());
     }
 
 
@@ -207,7 +207,7 @@ public final class StringUtils {
      * @return a single string, delimited by the specified {@code delimiter}.
      * @since 1.2
      */
-    public static String toDelimitedString(Collection c, String delimiter) {
+    public static String toDelimitedString(Collection<?> c, String delimiter) {
         if (c == null || c.isEmpty()) {
             return EMPTY_STRING;
         }
@@ -264,13 +264,13 @@ public final class StringUtils {
             return null;
         }
         StringTokenizer st = new StringTokenizer(str, delimiters);
-        List tokens = new ArrayList();
+        List<String> tokens = new ArrayList<>();
         while (st.hasMoreTokens()) {
             String token = st.nextToken();
             if (trimTokens) {
                 token = token.trim();
             }
-            if (!ignoreEmptyTokens || token.length() > 0) {
+            if (!ignoreEmptyTokens || !token.isEmpty()) {
                 tokens.add(token);
             }
         }
@@ -287,12 +287,11 @@ public final class StringUtils {
      * @return the String array (<code>null</code> if the passed-in
      * Collection was <code>null</code>)
      */
-    @SuppressWarnings({"unchecked"})
-    public static String[] toStringArray(Collection collection) {
+    public static String[] toStringArray(Collection<String> collection) {
         if (collection == null) {
             return null;
         }
-        return (String[]) collection.toArray(new String[collection.size()]);
+        return collection.toArray(new String[collection.size()]);
     }
 
     public static String[] splitKeyValue(String aLine) throws ParseException {
@@ -515,7 +514,7 @@ public final class StringUtils {
      * @since 1.2
      */
     public static String uppercaseFirstChar(String in) {
-        if (in == null || in.length() == 0) {
+        if (in == null || in.isEmpty()) {
             return in;
         }
         int length = in.length();
@@ -545,7 +544,7 @@ public final class StringUtils {
             return Collections.singleton(elements[0]);
         }
 
-        LinkedHashSet<E> set = new LinkedHashSet<E>(elements.length * 4 / 3 + 
1);
+        LinkedHashSet<E> set = new LinkedHashSet<>(elements.length * 4 / 3 + 
1);
         Collections.addAll(set, elements);
         return set;
     }
diff --git a/pom.xml b/pom.xml
index 2a50df367..f7c1b54de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -578,6 +578,7 @@
                     <compilerArgs>
                         <arg>-Xlint:deprecation</arg>
                         <arg>-Xlint:unchecked</arg>
+                        <arg>-Xlint:rawtypes</arg>
                     </compilerArgs>
                     <annotationProcessorPaths>
                         <annotationProcessorPath>
diff --git 
a/support/guice/src/main/java/org/apache/shiro/guice/BeanTypeListener.java 
b/support/guice/src/main/java/org/apache/shiro/guice/BeanTypeListener.java
index 31bf69f48..26ecd2def 100644
--- a/support/guice/src/main/java/org/apache/shiro/guice/BeanTypeListener.java
+++ b/support/guice/src/main/java/org/apache/shiro/guice/BeanTypeListener.java
@@ -61,11 +61,15 @@ class BeanTypeListener implements TypeListener {
 
     static final Key<?> MAP_KEY = Key.get(Types.mapOf(TypeLiteral.class, 
BeanTypeKey.class), Names.named(BEAN_TYPE_MAP_NAME));
 
+    @SuppressWarnings("rawtypes")
     private static final Matcher<Class> SHIRO_MATCHER = 
Matchers.inSubpackage(SHIRO_PACKAGE.getName());
+    @SuppressWarnings("rawtypes")
     private static final Matcher<Class> SHIRO_GUICE_MATCHER = 
Matchers.inSubpackage(SHIRO_GUICE_PACKAGE.getName());
+    @SuppressWarnings("rawtypes")
     private static final Matcher<Class> CLASS_MATCHER = 
ShiroMatchers.anyPackage
             .and(SHIRO_MATCHER.and(Matchers.not(SHIRO_GUICE_MATCHER)));
 
+    @SuppressWarnings("rawtypes")
     static final Matcher<TypeLiteral> MATCHER = 
ShiroMatchers.typeLiteral(CLASS_MATCHER);
 
     private static final Set<Class<?>> WRAPPER_TYPES = new 
HashSet<>(Arrays.asList(
@@ -125,6 +129,7 @@ class BeanTypeListener implements TypeListener {
     }
 
     private static Key<?> getMappedKey(Injector injector, Key<?> key) {
+        @SuppressWarnings("rawtypes")
         Map<TypeLiteral, BeanTypeKey> beanTypeMap = getBeanTypeMap(injector);
         if (key.getAnnotation() == null && 
beanTypeMap.containsKey(key.getTypeLiteral())) {
             return beanTypeMap.get(key.getTypeLiteral()).key;
@@ -133,7 +138,7 @@ class BeanTypeListener implements TypeListener {
         }
     }
 
-    @SuppressWarnings({"unchecked"})
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private static Map<TypeLiteral, BeanTypeKey> getBeanTypeMap(Injector 
injector) {
         return (Map<TypeLiteral, BeanTypeKey>) injector.getInstance(MAP_KEY);
     }
@@ -165,6 +170,7 @@ class BeanTypeListener implements TypeListener {
         beanTypeMapBinding(binder).addBinding(typeLiteral).toInstance(new 
BeanTypeKey(key));
     }
 
+    @SuppressWarnings("rawtypes")
     private static MapBinder<TypeLiteral, BeanTypeKey> 
beanTypeMapBinding(Binder binder) {
         return MapBinder.newMapBinder(binder, TypeLiteral.class, 
BeanTypeKey.class, Names.named(BEAN_TYPE_MAP_NAME));
     }
diff --git 
a/support/guice/src/main/java/org/apache/shiro/guice/DestroyableInjectionListener.java
 
b/support/guice/src/main/java/org/apache/shiro/guice/DestroyableInjectionListener.java
index e99b09d8a..4d425bb37 100644
--- 
a/support/guice/src/main/java/org/apache/shiro/guice/DestroyableInjectionListener.java
+++ 
b/support/guice/src/main/java/org/apache/shiro/guice/DestroyableInjectionListener.java
@@ -30,9 +30,10 @@ import org.apache.shiro.lang.util.Destroyable;
  * @param <I>
  */
 class DestroyableInjectionListener<I extends Destroyable> implements 
InjectionListener<I> {
+    @SuppressWarnings("rawtypes")
     public static final Matcher<TypeLiteral> MATCHER = 
ShiroMatchers.typeLiteral(Matchers.subclassesOf(Destroyable.class));
 
-    private DestroyableRegistry registry;
+    private final DestroyableRegistry registry;
 
     DestroyableInjectionListener(DestroyableRegistry registry) {
         this.registry = registry;
diff --git 
a/support/guice/src/main/java/org/apache/shiro/guice/InitializableInjectionListener.java
 
b/support/guice/src/main/java/org/apache/shiro/guice/InitializableInjectionListener.java
index 3b076c0ba..efa7c0f99 100644
--- 
a/support/guice/src/main/java/org/apache/shiro/guice/InitializableInjectionListener.java
+++ 
b/support/guice/src/main/java/org/apache/shiro/guice/InitializableInjectionListener.java
@@ -30,6 +30,7 @@ import org.apache.shiro.lang.util.Initializable;
  * @param <I>
  */
 class InitializableInjectionListener<I extends Initializable> implements 
InjectionListener<I> {
+    @SuppressWarnings("rawtypes")
     public static final Matcher<TypeLiteral> MATCHER = 
ShiroMatchers.typeLiteral(Matchers.subclassesOf(Initializable.class));
 
     public void afterInjection(Initializable injectee) {
diff --git 
a/support/guice/src/main/java/org/apache/shiro/guice/LifecycleTypeListener.java 
b/support/guice/src/main/java/org/apache/shiro/guice/LifecycleTypeListener.java
index 4c8cc60cb..7a7d97719 100644
--- 
a/support/guice/src/main/java/org/apache/shiro/guice/LifecycleTypeListener.java
+++ 
b/support/guice/src/main/java/org/apache/shiro/guice/LifecycleTypeListener.java
@@ -27,7 +27,7 @@ import org.apache.shiro.lang.util.Destroyable;
 import org.apache.shiro.lang.util.Initializable;
 
 class LifecycleTypeListener implements TypeListener {
-
+    @SuppressWarnings("rawtypes")
     public static final Matcher<TypeLiteral> MATCHER
             = 
InitializableInjectionListener.MATCHER.or(DestroyableInjectionListener.MATCHER);
 
diff --git 
a/support/guice/src/main/java/org/apache/shiro/guice/ShiroMatchers.java 
b/support/guice/src/main/java/org/apache/shiro/guice/ShiroMatchers.java
index bb2ed26c6..82e3ac13b 100644
--- a/support/guice/src/main/java/org/apache/shiro/guice/ShiroMatchers.java
+++ b/support/guice/src/main/java/org/apache/shiro/guice/ShiroMatchers.java
@@ -22,12 +22,13 @@ import com.google.inject.TypeLiteral;
 import com.google.inject.matcher.Matcher;
 
 final class ShiroMatchers {
-
+    @SuppressWarnings("rawtypes")
     static Matcher<Class> anyPackage = aClass -> aClass.getPackage() != null;
 
     private ShiroMatchers() {
     }
 
+    @SuppressWarnings("rawtypes")
     public static Matcher<TypeLiteral> typeLiteral(final Matcher<Class> 
classMatcher) {
         return typeLiteral -> classMatcher.matches(typeLiteral.getRawType());
     }
diff --git 
a/support/guice/src/main/java/org/apache/shiro/guice/web/ShiroWebModule.java 
b/support/guice/src/main/java/org/apache/shiro/guice/web/ShiroWebModule.java
index d33ec0c60..b3917c163 100644
--- a/support/guice/src/main/java/org/apache/shiro/guice/web/ShiroWebModule.java
+++ b/support/guice/src/main/java/org/apache/shiro/guice/web/ShiroWebModule.java
@@ -96,10 +96,10 @@ public abstract class ShiroWebModule extends ShiroModule {
      * FilterChainResolver uses iterator order when searching for a matching 
chain.
      */
     private final Map<String, FilterConfig<? extends Filter>[]> filterChains =
-            new LinkedHashMap<String, FilterConfig<? extends Filter>[]>();
+            new LinkedHashMap<>();
     private final ServletContext servletContext;
 
-    public ShiroWebModule(ServletContext servletContext) {
+    protected ShiroWebModule(ServletContext servletContext) {
         this.servletContext = servletContext;
     }
 
@@ -143,7 +143,7 @@ public abstract class ShiroWebModule extends ShiroModule {
         // add default matching route if not already set
         if (!filterChains.containsKey("/**")) {
             // no config, this will add only the global filters
-            this.addFilterChain("/**", new FilterConfig[0]);
+            this.addFilterChain("/**", new FilterConfig<?>[0]);
         }
 
         bind(FilterChainResolver.class).toProvider(new 
FilterChainResolverProvider(setupFilterChainConfigs()));
@@ -180,10 +180,7 @@ public abstract class ShiroWebModule extends ShiroModule {
                 String config = filterConfig.getConfigValue();
 
                 // initialize key in filterToPathToConfig, if it doesn't exist
-                if (filterToPathToConfig.get(key) == null) {
-                    // Fix for SHIRO-621: REST filter bypassing matched path
-                    filterToPathToConfig.put((key), new LinkedHashMap<String, 
String>());
-                }
+                filterToPathToConfig.computeIfAbsent(key, k -> new 
LinkedHashMap<>());
                 // now set the value
                 filterToPathToConfig.get(key).put(path, config);
 
@@ -200,7 +197,9 @@ public abstract class ShiroWebModule extends ShiroModule {
             }
 
             // map the current path to all of its Keys
-            resultConfigMap.put(path, keysForPath.toArray(new 
Key[keysForPath.size()]));
+            @SuppressWarnings("rawtypes")
+            var newKey = new Key[keysForPath.size()];
+            resultConfigMap.put(path, keysForPath.toArray(newKey));
         }
 
         // now we find only the PathMatchingFilter and configure bindings
@@ -276,7 +275,7 @@ public abstract class ShiroWebModule extends ShiroModule {
     @SuppressWarnings("unchecked")
     protected final void addFilterChain(String pattern, Key<? extends Filter> 
key) {
         // check for legacy API
-        if (key instanceof FilterConfigKey configKey) {
+        if (key instanceof FilterConfigKey<?> configKey) {
             addLegacyFilterChain(pattern, configKey);
         } else {
             addFilterChain(pattern, new FilterConfig<Filter>((Key<Filter>) 
key, ""));
@@ -387,7 +386,7 @@ public abstract class ShiroWebModule extends ShiroModule {
         }
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private void addLegacyFilterChain(String pattern, FilterConfigKey 
filterConfigKey) {
         FilterConfig<Filter> filterConfig = new 
FilterConfig<>(filterConfigKey.getKey(), filterConfigKey.getConfigValue());
         addFilterChain(pattern, filterConfig);
@@ -403,7 +402,7 @@ public abstract class ShiroWebModule extends ShiroModule {
      * @param keys
      */
     @Deprecated
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "rawtypes"})
     protected final void addFilterChain(String pattern, Key<? extends 
Filter>... keys) {
 
         // We need to extract the keys and FilterConfigKey and convert to the 
new format.
diff --git 
a/support/guice/src/test/java/org/apache/shiro/guice/DestroyableInjectionListenerTest.java
 
b/support/guice/src/test/java/org/apache/shiro/guice/DestroyableInjectionListenerTest.java
index b4b440add..ba3c4090b 100644
--- 
a/support/guice/src/test/java/org/apache/shiro/guice/DestroyableInjectionListenerTest.java
+++ 
b/support/guice/src/test/java/org/apache/shiro/guice/DestroyableInjectionListenerTest.java
@@ -25,8 +25,7 @@ import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 
-public class DestroyableInjectionListenerTest {
-
+class DestroyableInjectionListenerTest {
     @Test
     void testAfterInjection() throws Exception {
         DestroyableInjectionListener.DestroyableRegistry registry =
@@ -37,7 +36,7 @@ public class DestroyableInjectionListenerTest {
 
         replay(registry, destroyable);
 
-        DestroyableInjectionListener underTest = new 
DestroyableInjectionListener(registry);
+        DestroyableInjectionListener<?> underTest = new 
DestroyableInjectionListener<>(registry);
         underTest.afterInjection(destroyable);
 
         verify(registry, destroyable);
diff --git 
a/support/guice/src/test/java/org/apache/shiro/guice/InitializableInjectionListenerTest.java
 
b/support/guice/src/test/java/org/apache/shiro/guice/InitializableInjectionListenerTest.java
index bf229c06e..48bbd508d 100644
--- 
a/support/guice/src/test/java/org/apache/shiro/guice/InitializableInjectionListenerTest.java
+++ 
b/support/guice/src/test/java/org/apache/shiro/guice/InitializableInjectionListenerTest.java
@@ -26,7 +26,7 @@ import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 
 
-public class InitializableInjectionListenerTest {
+class InitializableInjectionListenerTest {
     @Test
     void testAfterInjection() throws Exception {
         Initializable initializable = createMock(Initializable.class);
@@ -35,7 +35,7 @@ public class InitializableInjectionListenerTest {
 
         replay(initializable);
 
-        InitializableInjectionListener underTest = new 
InitializableInjectionListener();
+        InitializableInjectionListener<?> underTest = new 
InitializableInjectionListener<>();
         underTest.afterInjection(initializable);
 
         verify(initializable);
diff --git 
a/support/guice/src/test/java/org/apache/shiro/guice/ShiroMatchersTest.java 
b/support/guice/src/test/java/org/apache/shiro/guice/ShiroMatchersTest.java
index ab36c72d2..6b7da9d61 100644
--- a/support/guice/src/test/java/org/apache/shiro/guice/ShiroMatchersTest.java
+++ b/support/guice/src/test/java/org/apache/shiro/guice/ShiroMatchersTest.java
@@ -28,8 +28,9 @@ import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 
-public class ShiroMatchersTest {
+class ShiroMatchersTest {
     @Test
+    @SuppressWarnings("rawtypes")
     void testTypeLiteral() throws Exception {
         Matcher<Class> classMatcher = createMock(Matcher.class);
         expect(classMatcher.matches(MatchingClass.class)).andReturn(true);
diff --git 
a/support/guice/src/test/java/org/apache/shiro/guice/aop/ShiroAopModuleTest.java
 
b/support/guice/src/test/java/org/apache/shiro/guice/aop/ShiroAopModuleTest.java
index d569eb0a8..0bc91b8d4 100644
--- 
a/support/guice/src/test/java/org/apache/shiro/guice/aop/ShiroAopModuleTest.java
+++ 
b/support/guice/src/test/java/org/apache/shiro/guice/aop/ShiroAopModuleTest.java
@@ -93,8 +93,8 @@ public class ShiroAopModuleTest {
         boolean calledCustom = false;
 
         for (Element e : Elements.getElements(underTest)) {
-            if (e instanceof Binding binding) {
-                Key key = binding.getKey();
+            if (e instanceof Binding<?> binding) {
+                Key<?> key = binding.getKey();
                 if 
(Named.class.isAssignableFrom(key.getAnnotation().annotationType())
                         && "configureInterceptors".equals(((Named) 
key.getAnnotation()).value())
                         && 
key.getTypeLiteral().getRawType().equals(Object.class)) {
diff --git 
a/support/guice/src/test/java/org/apache/shiro/guice/web/AbstractInjectionProviderTest.java
 
b/support/guice/src/test/java/org/apache/shiro/guice/web/AbstractInjectionProviderTest.java
index e32c415f6..b15a6ac15 100644
--- 
a/support/guice/src/test/java/org/apache/shiro/guice/web/AbstractInjectionProviderTest.java
+++ 
b/support/guice/src/test/java/org/apache/shiro/guice/web/AbstractInjectionProviderTest.java
@@ -39,13 +39,13 @@ import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 
-public class AbstractInjectionProviderTest {
+class AbstractInjectionProviderTest {
 
-    static Key keyC1 = Key.get(Object.class, Names.named("constructor1"));
-    static Key keyC2 = Key.get(Object.class, Names.named("constructor2"));
-    static Key keyV1 = Key.get(Object.class, Names.named("val1"));
-    static Key keyV2 = Key.get(Object.class, Names.named("val2"));
-    static Key keyF1 = Key.get(Object.class, Names.named("field1"));
+    static Key<Object> keyC1 = Key.get(Object.class, 
Names.named("constructor1"));
+    static Key<Object> keyC2 = Key.get(Object.class, 
Names.named("constructor2"));
+    static Key<Object> keyV1 = Key.get(Object.class, Names.named("val1"));
+    static Key<Object> keyV2 = Key.get(Object.class, Names.named("val2"));
+    static Key<Object> keyF1 = Key.get(Object.class, Names.named("field1"));
 
     @Test
     @SuppressWarnings("unchecked")
diff --git 
a/support/guice/src/test/java/org/apache/shiro/guice/web/FilterChainResolverProviderTest.java
 
b/support/guice/src/test/java/org/apache/shiro/guice/web/FilterChainResolverProviderTest.java
index 1b69adec3..39cafbf16 100644
--- 
a/support/guice/src/test/java/org/apache/shiro/guice/web/FilterChainResolverProviderTest.java
+++ 
b/support/guice/src/test/java/org/apache/shiro/guice/web/FilterChainResolverProviderTest.java
@@ -49,7 +49,7 @@ public class FilterChainResolverProviderTest {
     private FilterChainResolverProvider underTest;
 
     @BeforeEach
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public void setup() {
         chains = new LinkedHashMap<>();
 
diff --git 
a/support/guice/src/test/java/org/apache/shiro/guice/web/PathMatchingFilterProviderTest.java
 
b/support/guice/src/test/java/org/apache/shiro/guice/web/PathMatchingFilterProviderTest.java
index 09f192900..df3798c26 100644
--- 
a/support/guice/src/test/java/org/apache/shiro/guice/web/PathMatchingFilterProviderTest.java
+++ 
b/support/guice/src/test/java/org/apache/shiro/guice/web/PathMatchingFilterProviderTest.java
@@ -30,9 +30,8 @@ import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 
-public class PathMatchingFilterProviderTest {
+class PathMatchingFilterProviderTest {
     @Test
-    @SuppressWarnings("unchecked")
     void testPostProcess() {
         PathMatchingFilter filter = createMock(PathMatchingFilter.class);
 
@@ -45,12 +44,11 @@ public class PathMatchingFilterProviderTest {
         pathConfigMap.put("/1", "first");
         pathConfigMap.put("/2", "second");
 
-        PathMatchingFilterProvider underTest = new 
PathMatchingFilterProvider(Key.get(PathMatchingFilter.class), pathConfigMap);
+        PathMatchingFilterProvider<PathMatchingFilter> underTest =
+                new 
PathMatchingFilterProvider<>(Key.get(PathMatchingFilter.class), pathConfigMap);
 
         underTest.postProcess(filter);
 
         verify(filter);
     }
-
-
 }
diff --git 
a/support/guice/src/test/java/org/apache/shiro/guice/web/SimpleFilterChainResolverTest.java
 
b/support/guice/src/test/java/org/apache/shiro/guice/web/SimpleFilterChainResolverTest.java
index be9c9bd39..e5768f793 100644
--- 
a/support/guice/src/test/java/org/apache/shiro/guice/web/SimpleFilterChainResolverTest.java
+++ 
b/support/guice/src/test/java/org/apache/shiro/guice/web/SimpleFilterChainResolverTest.java
@@ -49,7 +49,7 @@ import static org.easymock.EasyMock.same;
 public class SimpleFilterChainResolverTest {
 
     @Test
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "rawtypes"})
     void testGetChain() throws Exception {
         // test that it uses the pattern matcher - check
         // test that the FIRST chain found is the one that gets returned - 
check
diff --git 
a/support/jcache/src/test/groovy/org/apache/shiro/cache/jcache/JCacheManagerTest.groovy
 
b/support/jcache/src/test/groovy/org/apache/shiro/cache/jcache/JCacheManagerTest.groovy
index f1c1e40ca..b2737c575 100644
--- 
a/support/jcache/src/test/groovy/org/apache/shiro/cache/jcache/JCacheManagerTest.groovy
+++ 
b/support/jcache/src/test/groovy/org/apache/shiro/cache/jcache/JCacheManagerTest.groovy
@@ -133,7 +133,7 @@ class JCacheManagerTest {
         assertThat cacheManager.jCacheManager, nullValue()
     }
 
-    static <T extends Throwable> T expectThrows(Class<T> exceptionClass, 
Closure closure) {
+    static <T extends Throwable> T expectThrows(Class<T> exceptionClass, 
Closure<?> closure) {
         try {
             closure.run()
         } catch (Throwable t) {
diff --git 
a/web/src/main/java/org/apache/shiro/web/config/WebIniSecurityManagerFactory.java
 
b/web/src/main/java/org/apache/shiro/web/config/WebIniSecurityManagerFactory.java
index 9bbdb4540..3a93b1911 100644
--- 
a/web/src/main/java/org/apache/shiro/web/config/WebIniSecurityManagerFactory.java
+++ 
b/web/src/main/java/org/apache/shiro/web/config/WebIniSecurityManagerFactory.java
@@ -18,13 +18,13 @@
  */
 package org.apache.shiro.web.config;
 
+import jakarta.servlet.Filter;
 import org.apache.shiro.config.Ini;
 import org.apache.shiro.ini.IniSecurityManagerFactory;
 import org.apache.shiro.mgt.SecurityManager;
 import org.apache.shiro.web.filter.mgt.DefaultFilter;
 import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
 
-import jakarta.servlet.Filter;
 import java.util.Map;
 
 /**
@@ -70,6 +70,7 @@ public class WebIniSecurityManagerFactory extends 
IniSecurityManagerFactory {
     @SuppressWarnings({"unchecked"})
     @Override
     protected Map<String, ?> createDefaults(Ini ini, Ini.Section mainSection) {
+        @SuppressWarnings("rawtypes")
         Map defaults = super.createDefaults(ini, mainSection);
         //add the default filters:
         Map<String, Filter> defaultFilters = 
DefaultFilter.createInstanceMap(null);
diff --git 
a/web/src/main/java/org/apache/shiro/web/session/HttpServletSession.java 
b/web/src/main/java/org/apache/shiro/web/session/HttpServletSession.java
index 8c9003107..039767d3c 100644
--- a/web/src/main/java/org/apache/shiro/web/session/HttpServletSession.java
+++ b/web/src/main/java/org/apache/shiro/web/session/HttpServletSession.java
@@ -43,7 +43,7 @@ public class HttpServletSession implements Session {
     private static final String HOST_SESSION_KEY = 
HttpServletSession.class.getName() + ".HOST_SESSION_KEY";
     private static final String TOUCH_OBJECT_SESSION_KEY = 
HttpServletSession.class.getName() + ".TOUCH_OBJECT_SESSION_KEY";
 
-    private HttpSession httpSession;
+    private final HttpSession httpSession;
 
     public HttpServletSession(HttpSession httpSession, String host) {
         if (httpSession == null) {
@@ -120,10 +120,10 @@ public class HttpServletSession implements Session {
 
     public Collection<Object> getAttributeKeys() throws 
InvalidSessionException {
         try {
-            Enumeration namesEnum = httpSession.getAttributeNames();
+            Enumeration<?> namesEnum = httpSession.getAttributeNames();
             Collection<Object> keys = null;
             if (namesEnum != null) {
-                keys = new ArrayList<Object>();
+                keys = new ArrayList<>();
                 while (namesEnum.hasMoreElements()) {
                     keys.add(namesEnum.nextElement());
                 }
diff --git a/web/src/main/java/org/apache/shiro/web/tags/PrincipalTag.java 
b/web/src/main/java/org/apache/shiro/web/tags/PrincipalTag.java
index 632adcceb..864fedbe0 100644
--- a/web/src/main/java/org/apache/shiro/web/tags/PrincipalTag.java
+++ b/web/src/main/java/org/apache/shiro/web/tags/PrincipalTag.java
@@ -151,12 +151,11 @@ public class PrincipalTag extends SecureTag {
         return SKIP_BODY;
     }
 
-    @SuppressWarnings({"unchecked"})
     private Object getPrincipalFromClassName() {
         Object principal = null;
 
         try {
-            Class cls = Class.forName(type);
+            Class<?> cls = Class.forName(type);
             principal = getSubject().getPrincipals().oneByType(cls);
         } catch (ClassNotFoundException e) {
             if (LOGGER.isErrorEnabled()) {
diff --git a/web/src/main/java/org/apache/shiro/web/util/RedirectView.java 
b/web/src/main/java/org/apache/shiro/web/util/RedirectView.java
index bbb494e63..8d703b165 100644
--- a/web/src/main/java/org/apache/shiro/web/util/RedirectView.java
+++ b/web/src/main/java/org/apache/shiro/web/util/RedirectView.java
@@ -188,7 +188,7 @@ public class RedirectView {
      * @see #sendRedirect
      */
     public final void renderMergedOutputModel(
-            Map model, HttpServletRequest request, HttpServletResponse 
response) throws IOException {
+            Map<String, ?> model, HttpServletRequest request, 
HttpServletResponse response) throws IOException {
 
         // Prepare name URL.
         StringBuilder targetUrl = new StringBuilder();
@@ -215,7 +215,7 @@ public class RedirectView {
      * @see #queryProperties
      * @see #urlEncode(String, String)
      */
-    protected void appendQueryProperties(StringBuilder targetUrl, Map model, 
String encodingScheme)
+    protected void appendQueryProperties(StringBuilder targetUrl, Map<String, 
?> model, String encodingScheme)
             throws UnsupportedEncodingException {
 
         // Extract anchor fragment, if any.
@@ -230,18 +230,17 @@ public class RedirectView {
 
         // If there aren't already some parameters, we need a "?".
         boolean first = (getUrl().indexOf('?') < 0);
-        Map queryProps = queryProperties(model);
+        Map<String, ?> queryProps = queryProperties(model);
 
         if (queryProps != null) {
-            for (Object o : queryProps.entrySet()) {
+            for (Map.Entry<String, ?> entry : queryProps.entrySet()) {
                 if (first) {
                     targetUrl.append('?');
                     first = false;
                 } else {
                     targetUrl.append('&');
                 }
-                Map.Entry entry = (Map.Entry) o;
-                String encodedKey = urlEncode(entry.getKey().toString(), 
encodingScheme);
+                String encodedKey = urlEncode(entry.getKey(), encodingScheme);
                 String encodedValue =
                         (entry.getValue() != null ? 
urlEncode(entry.getValue().toString(), encodingScheme) : "");
                 targetUrl.append(encodedKey).append('=').append(encodedValue);
@@ -280,7 +279,7 @@ public class RedirectView {
      * @return the name-value pairs for query strings.
      * @see #appendQueryProperties
      */
-    protected Map queryProperties(Map model) {
+    protected Map<String, ?> queryProperties(Map<String, ?> model) {
         return model;
     }
 
diff --git a/web/src/main/java/org/apache/shiro/web/util/WebUtils.java 
b/web/src/main/java/org/apache/shiro/web/util/WebUtils.java
index 4cb1a0b54..dec232bdf 100644
--- a/web/src/main/java/org/apache/shiro/web/util/WebUtils.java
+++ b/web/src/main/java/org/apache/shiro/web/util/WebUtils.java
@@ -558,7 +558,7 @@ public final class WebUtils {
      * @throws java.io.IOException if thrown by response methods.
      */
     public static void issueRedirect(ServletRequest request, ServletResponse 
response, String url,
-                                     Map queryParams, boolean contextRelative,
+                                     Map<String, ?> queryParams, boolean 
contextRelative,
                                      boolean http10Compatible) throws 
IOException {
         RedirectView view = new RedirectView(url, contextRelative, 
http10Compatible);
         view.renderMergedOutputModel(queryParams, toHttp(request), 
toHttp(response));
@@ -588,7 +588,7 @@ public final class WebUtils {
      * @throws java.io.IOException if thrown by response methods.
      */
     public static void issueRedirect(ServletRequest request,
-                                     ServletResponse response, String url, Map 
queryParams) throws IOException {
+                                     ServletResponse response, String url, 
Map<String, ?> queryParams) throws IOException {
         issueRedirect(request, response, url, queryParams, true, true);
     }
 
@@ -604,7 +604,7 @@ public final class WebUtils {
      * @throws java.io.IOException if thrown by response methods.
      */
     public static void issueRedirect(ServletRequest request,
-                                     ServletResponse response, String url, Map 
queryParams, boolean contextRelative)
+                                     ServletResponse response, String url, 
Map<String, ?> queryParams, boolean contextRelative)
             throws IOException {
         issueRedirect(request, response, url, queryParams, contextRelative, 
true);
     }
diff --git 
a/web/src/test/java/org/apache/shiro/web/filter/mgt/SimpleNamedFilterListTest.java
 
b/web/src/test/java/org/apache/shiro/web/filter/mgt/SimpleNamedFilterListTest.java
index 0c5ca3f8f..5d9dbaad5 100644
--- 
a/web/src/test/java/org/apache/shiro/web/filter/mgt/SimpleNamedFilterListTest.java
+++ 
b/web/src/test/java/org/apache/shiro/web/filter/mgt/SimpleNamedFilterListTest.java
@@ -116,11 +116,11 @@ public class SimpleNamedFilterListTest {
         assertThat(list).isEmpty();
 
         list.add(singleFilter);
-        Iterator i = list.iterator();
+        Iterator<Filter> i = list.iterator();
         assertThat(i.hasNext()).isTrue();
         assertThat(singleFilter).isEqualTo(i.next());
 
-        ListIterator li = list.listIterator();
+        ListIterator<Filter> li = list.listIterator();
         assertThat(li.hasNext()).isTrue();
         assertThat(singleFilter).isEqualTo(li.next());
 


Reply via email to