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 297707d12 chore: cleaned up more warnings
297707d12 is described below
commit 297707d12491d016e83024ea175906b10f1ef2a9
Author: lprimak <[email protected]>
AuthorDate: Sun Jan 25 01:15:30 2026 -0600
chore: cleaned up more warnings
---
.../org/apache/shiro/cache/ehcache/EhCacheManager.java | 2 ++
.../java/org/apache/shiro/guice/BeanTypeListener.java | 2 +-
.../main/java/org/apache/shiro/guice/ShiroMatchers.java | 15 ++-------------
.../java/org/apache/shiro/guice/aop/ShiroAopModule.java | 12 ++++--------
4 files changed, 9 insertions(+), 22 deletions(-)
diff --git
a/support/ehcache/src/main/java/org/apache/shiro/cache/ehcache/EhCacheManager.java
b/support/ehcache/src/main/java/org/apache/shiro/cache/ehcache/EhCacheManager.java
index 985276bea..58f826b53 100644
---
a/support/ehcache/src/main/java/org/apache/shiro/cache/ehcache/EhCacheManager.java
+++
b/support/ehcache/src/main/java/org/apache/shiro/cache/ehcache/EhCacheManager.java
@@ -176,12 +176,14 @@ public class EhCacheManager implements CacheManager,
Initializable, Destroyable
}
try {
+ @SuppressWarnings("unchecked")
org.ehcache.Cache<K, V> cache = (org.ehcache.Cache<K, V>)
ensureCacheManager()
.getCache(name, Serializable.class, Serializable.class);
if (cache == null) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Cache with name '{}' does not yet exist.
Creating now.", name);
}
+ @SuppressWarnings("unchecked")
CacheConfiguration<K, V> config = (CacheConfiguration<K, V>)
new XmlConfiguration(getCacheManagerConfigFileUrl())
.newCacheConfigurationBuilderFromTemplate("default",
Serializable.class, Serializable.class)
.build();
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 c5e6ed06e..31bf69f48 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
@@ -68,7 +68,7 @@ class BeanTypeListener implements TypeListener {
static final Matcher<TypeLiteral> MATCHER =
ShiroMatchers.typeLiteral(CLASS_MATCHER);
- private static final Set<Class<?>> WRAPPER_TYPES = new
HashSet<Class<?>>(Arrays.asList(
+ private static final Set<Class<?>> WRAPPER_TYPES = new
HashSet<>(Arrays.asList(
Byte.class,
Boolean.class,
Character.class,
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 309944ae3..bb2ed26c6 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
@@ -19,27 +19,16 @@
package org.apache.shiro.guice;
import com.google.inject.TypeLiteral;
-import com.google.inject.matcher.AbstractMatcher;
import com.google.inject.matcher.Matcher;
final class ShiroMatchers {
- static Matcher<Class> anyPackage = new AbstractMatcher<Class>() {
-
- public boolean matches(Class aClass) {
- return aClass.getPackage() != null;
- }
- };
+ static Matcher<Class> anyPackage = aClass -> aClass.getPackage() != null;
private ShiroMatchers() {
}
public static Matcher<TypeLiteral> typeLiteral(final Matcher<Class>
classMatcher) {
- return new AbstractMatcher<TypeLiteral>() {
-
- public boolean matches(TypeLiteral typeLiteral) {
- return classMatcher.matches(typeLiteral.getRawType());
- }
- };
+ return typeLiteral -> classMatcher.matches(typeLiteral.getRawType());
}
}
diff --git
a/support/guice/src/main/java/org/apache/shiro/guice/aop/ShiroAopModule.java
b/support/guice/src/main/java/org/apache/shiro/guice/aop/ShiroAopModule.java
index 2b59037fa..e26f73695 100644
--- a/support/guice/src/main/java/org/apache/shiro/guice/aop/ShiroAopModule.java
+++ b/support/guice/src/main/java/org/apache/shiro/guice/aop/ShiroAopModule.java
@@ -19,7 +19,6 @@
package org.apache.shiro.guice.aop;
import com.google.inject.AbstractModule;
-import com.google.inject.matcher.AbstractMatcher;
import com.google.inject.matcher.Matchers;
import org.apache.shiro.aop.AnnotationMethodInterceptor;
import org.apache.shiro.aop.AnnotationResolver;
@@ -31,7 +30,6 @@ import
org.apache.shiro.authz.aop.RoleAnnotationMethodInterceptor;
import org.apache.shiro.authz.aop.UserAnnotationMethodInterceptor;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
/**
* Install this module to enable Shiro AOP functionality in Guice. You may
extend it to add your own Shiro
@@ -46,12 +44,10 @@ public class ShiroAopModule extends AbstractModule {
}
protected final void bindShiroInterceptor(final
AnnotationMethodInterceptor methodInterceptor) {
- bindInterceptor(Matchers.any(), new AbstractMatcher<Method>() {
- public boolean matches(Method method) {
- Class<? extends Annotation> annotation =
methodInterceptor.getHandler().getAnnotationClass();
- return method.getAnnotation(annotation) != null
- ||
method.getDeclaringClass().getAnnotation(annotation) != null;
- }
+ bindInterceptor(Matchers.any(), method -> {
+ Class<? extends Annotation> annotation =
methodInterceptor.getHandler().getAnnotationClass();
+ return method.getAnnotation(annotation) != null
+ || method.getDeclaringClass().getAnnotation(annotation) !=
null;
}, new AopAllianceMethodInterceptorAdapter(methodInterceptor));
}