You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/07/27 15:46:04 UTC
[tomcat] 01/02: Fix redundant specification of type arguments
warnings
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit abd84d2096124a597e342897e0be25bbe8a03214
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 27 16:26:05 2021 +0100
Fix redundant specification of type arguments warnings
---
.../servlet/jsp/el/ImplicitObjectELResolver.java | 20 ++++++++++----------
.../catalina/authenticator/DigestAuthenticator.java | 2 +-
.../catalina/filters/CsrfPreventionFilter.java | 2 +-
java/org/apache/catalina/realm/LockOutRealm.java | 2 +-
.../apache/catalina/tribes/util/StringManager.java | 2 +-
.../coyote/http2/Http2AsyncUpgradeHandler.java | 4 ++--
.../collections/ManagedConcurrentWeakHashMap.java | 6 +++---
java/org/apache/tomcat/util/net/Nio2Channel.java | 4 ++--
java/org/apache/tomcat/util/net/Nio2Endpoint.java | 8 ++++----
.../apache/tomcat/util/net/SecureNio2Channel.java | 4 ++--
java/org/apache/tomcat/util/res/StringManager.java | 2 +-
test/org/apache/catalina/valves/Benchmarks.java | 20 ++++++++++----------
.../websocket/drawboard/DrawboardEndpoint.java | 2 +-
13 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/java/jakarta/servlet/jsp/el/ImplicitObjectELResolver.java b/java/jakarta/servlet/jsp/el/ImplicitObjectELResolver.java
index 4e63e26..3d00c87 100644
--- a/java/jakarta/servlet/jsp/el/ImplicitObjectELResolver.java
+++ b/java/jakarta/servlet/jsp/el/ImplicitObjectELResolver.java
@@ -222,7 +222,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,Object> getApplicationScope() {
if (this.applicationScope == null) {
- this.applicationScope = new ScopeMap<Object>() {
+ this.applicationScope = new ScopeMap<>() {
@Override
protected void setAttribute(String name, Object value) {
page.getServletContext().setAttribute(name, value);
@@ -249,7 +249,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,Cookie> getCookie() {
if (this.cookie == null) {
- this.cookie = new ScopeMap<Cookie>() {
+ this.cookie = new ScopeMap<>() {
@Override
protected Enumeration<String> getAttributeNames() {
Cookie[] cookies = ((HttpServletRequest) page.getRequest()).getCookies();
@@ -283,7 +283,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,String> getHeader() {
if (this.header == null) {
- this.header = new ScopeMap<String>() {
+ this.header = new ScopeMap<>() {
@Override
protected Enumeration<String> getAttributeNames() {
return ((HttpServletRequest) page.getRequest())
@@ -302,7 +302,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,String[]> getHeaderValues() {
if (this.headerValues == null) {
- this.headerValues = new ScopeMap<String[]>() {
+ this.headerValues = new ScopeMap<>() {
@Override
protected Enumeration<String> getAttributeNames() {
return ((HttpServletRequest) page.getRequest())
@@ -331,7 +331,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,String> getInitParam() {
if (this.initParam == null) {
- this.initParam = new ScopeMap<String>() {
+ this.initParam = new ScopeMap<>() {
@Override
protected Enumeration<String> getAttributeNames() {
return page.getServletContext().getInitParameterNames();
@@ -352,7 +352,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,Object> getPageScope() {
if (this.pageScope == null) {
- this.pageScope = new ScopeMap<Object>() {
+ this.pageScope = new ScopeMap<>() {
@Override
protected void setAttribute(String name, Object value) {
page.setAttribute(name, value);
@@ -380,7 +380,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,String> getParam() {
if (this.param == null) {
- this.param = new ScopeMap<String>() {
+ this.param = new ScopeMap<>() {
@Override
protected Enumeration<String> getAttributeNames() {
return page.getRequest().getParameterNames();
@@ -397,7 +397,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,String[]> getParamValues() {
if (this.paramValues == null) {
- this.paramValues = new ScopeMap<String[]>() {
+ this.paramValues = new ScopeMap<>() {
@Override
protected String[] getAttribute(String name) {
return page.getRequest().getParameterValues(name);
@@ -414,7 +414,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,Object> getRequestScope() {
if (this.requestScope == null) {
- this.requestScope = new ScopeMap<Object>() {
+ this.requestScope = new ScopeMap<>() {
@Override
protected void setAttribute(String name, Object value) {
page.getRequest().setAttribute(name, value);
@@ -441,7 +441,7 @@ public class ImplicitObjectELResolver extends ELResolver {
public Map<String,Object> getSessionScope() {
if (this.sessionScope == null) {
- this.sessionScope = new ScopeMap<Object>() {
+ this.sessionScope = new ScopeMap<>() {
@Override
protected void setAttribute(String name, Object value) {
((HttpServletRequest) page.getRequest()).getSession()
diff --git a/java/org/apache/catalina/authenticator/DigestAuthenticator.java b/java/org/apache/catalina/authenticator/DigestAuthenticator.java
index ee926f7..a66b047 100644
--- a/java/org/apache/catalina/authenticator/DigestAuthenticator.java
+++ b/java/org/apache/catalina/authenticator/DigestAuthenticator.java
@@ -383,7 +383,7 @@ public class DigestAuthenticator extends AuthenticatorBase {
setOpaque(sessionIdGenerator.generateSessionId());
}
- nonces = new LinkedHashMap<String, DigestAuthenticator.NonceInfo>() {
+ nonces = new LinkedHashMap<>() {
private static final long serialVersionUID = 1L;
private static final long LOG_SUPPRESS_TIME = 5 * 60 * 1000;
diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
index 2392a6b..22efa40 100644
--- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java
+++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
@@ -294,7 +294,7 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
private final Map<T,T> cache;
public LruCache(final int cacheSize) {
- cache = new LinkedHashMap<T,T>() {
+ cache = new LinkedHashMap<>() {
private static final long serialVersionUID = 1L;
@Override
protected boolean removeEldestEntry(Map.Entry<T,T> eldest) {
diff --git a/java/org/apache/catalina/realm/LockOutRealm.java b/java/org/apache/catalina/realm/LockOutRealm.java
index 1eaff96..0743df6 100644
--- a/java/org/apache/catalina/realm/LockOutRealm.java
+++ b/java/org/apache/catalina/realm/LockOutRealm.java
@@ -91,7 +91,7 @@ public class LockOutRealm extends CombinedRealm {
protected synchronized void startInternal() throws LifecycleException {
// Configure the list of failed users to delete the oldest entry once it
// exceeds the specified size
- failedUsers = new LinkedHashMap<String, LockRecord>(cacheSize, 0.75f,
+ failedUsers = new LinkedHashMap<>(cacheSize, 0.75f,
true) {
private static final long serialVersionUID = 1L;
@Override
diff --git a/java/org/apache/catalina/tribes/util/StringManager.java b/java/org/apache/catalina/tribes/util/StringManager.java
index 0979c46..aeb82f4 100644
--- a/java/org/apache/catalina/tribes/util/StringManager.java
+++ b/java/org/apache/catalina/tribes/util/StringManager.java
@@ -233,7 +233,7 @@ public class StringManager {
* for removal needs to use one less than the maximum desired size
*
*/
- map = new LinkedHashMap<Locale,StringManager>(LOCALE_CACHE_SIZE, 1, true) {
+ map = new LinkedHashMap<>(LOCALE_CACHE_SIZE, 1, true) {
private static final long serialVersionUID = 1L;
@Override
protected boolean removeEldestEntry(
diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index 5d11879..4dc268a 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -52,7 +52,7 @@ public class Http2AsyncUpgradeHandler extends Http2UpgradeHandler {
super(protocol, adapter, coyoteRequest);
}
- private final CompletionHandler<Long, Void> errorCompletion = new CompletionHandler<Long, Void>() {
+ private final CompletionHandler<Long, Void> errorCompletion = new CompletionHandler<>() {
@Override
public void completed(Long result, Void attachment) {
}
@@ -61,7 +61,7 @@ public class Http2AsyncUpgradeHandler extends Http2UpgradeHandler {
error.set(t);
}
};
- private final CompletionHandler<Long, Void> applicationErrorCompletion = new CompletionHandler<Long, Void>() {
+ private final CompletionHandler<Long, Void> applicationErrorCompletion = new CompletionHandler<>() {
@Override
public void completed(Long result, Void attachment) {
}
diff --git a/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java b/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java
index 5ccad11..53f3e77 100644
--- a/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java
+++ b/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java
@@ -214,7 +214,7 @@ public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K, V> implem
@Override
public Set<Map.Entry<K, V>> entrySet() {
- return new AbstractSet<Map.Entry<K, V>>() {
+ return new AbstractSet<>() {
@Override
public boolean isEmpty() {
return map.isEmpty();
@@ -227,7 +227,7 @@ public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K, V> implem
@Override
public Iterator<Map.Entry<K, V>> iterator() {
- return new Iterator<Map.Entry<K, V>>() {
+ return new Iterator<>() {
private final Iterator<Map.Entry<Key, V>> it = map
.entrySet().iterator();
@@ -238,7 +238,7 @@ public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K, V> implem
@Override
public Map.Entry<K, V> next() {
- return new Map.Entry<K, V>() {
+ return new Map.Entry<>() {
private final Map.Entry<Key, V> en = it.next();
@SuppressWarnings("unchecked")
diff --git a/java/org/apache/tomcat/util/net/Nio2Channel.java b/java/org/apache/tomcat/util/net/Nio2Channel.java
index a2612fd..603c43f 100644
--- a/java/org/apache/tomcat/util/net/Nio2Channel.java
+++ b/java/org/apache/tomcat/util/net/Nio2Channel.java
@@ -184,7 +184,7 @@ public class Nio2Channel implements AsynchronousByteChannel {
sc.write(srcs, offset, length, timeout, unit, attachment, handler);
}
- private static final Future<Boolean> DONE = new Future<Boolean>() {
+ private static final Future<Boolean> DONE = new Future<>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
@@ -222,7 +222,7 @@ public class Nio2Channel implements AsynchronousByteChannel {
return appReadBufHandler;
}
- private static final Future<Integer> DONE_INT = new Future<Integer>() {
+ private static final Future<Integer> DONE_INT = new Future<>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index 8c3f561..f80dd5d 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -490,7 +490,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
private boolean writeNotify = false;
private CompletionHandler<Integer, SendfileData> sendfileHandler
- = new CompletionHandler<Integer, SendfileData>() {
+ = new CompletionHandler<>() {
@Override
public void completed(Integer nWrite, SendfileData attachment) {
@@ -576,7 +576,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
nioChannels = endpoint.getNioChannels();
socketBufferHandler = channel.getBufHandler();
- this.readCompletionHandler = new CompletionHandler<Integer, ByteBuffer>() {
+ this.readCompletionHandler = new CompletionHandler<>() {
@Override
public void completed(Integer nBytes, ByteBuffer attachment) {
if (log.isDebugEnabled()) {
@@ -622,7 +622,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
}
};
- this.writeCompletionHandler = new CompletionHandler<Integer, ByteBuffer>() {
+ this.writeCompletionHandler = new CompletionHandler<>() {
@Override
public void completed(Integer nBytes, ByteBuffer attachment) {
writeNotify = false;
@@ -676,7 +676,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
}
};
- gatheringWriteCompletionHandler = new CompletionHandler<Long, ByteBuffer[]>() {
+ gatheringWriteCompletionHandler = new CompletionHandler<>() {
@Override
public void completed(Long nBytes, ByteBuffer[] attachment) {
writeNotify = false;
diff --git a/java/org/apache/tomcat/util/net/SecureNio2Channel.java b/java/org/apache/tomcat/util/net/SecureNio2Channel.java
index f0e4bb7..f460304 100644
--- a/java/org/apache/tomcat/util/net/SecureNio2Channel.java
+++ b/java/org/apache/tomcat/util/net/SecureNio2Channel.java
@@ -935,7 +935,7 @@ public class SecureNio2Channel extends Nio2Channel {
if (!handshakeComplete) {
throw new IllegalStateException(sm.getString("channel.nio.ssl.incompleteHandshake"));
}
- CompletionHandler<Integer, A> readCompletionHandler = new CompletionHandler<Integer, A>() {
+ CompletionHandler<Integer, A> readCompletionHandler = new CompletionHandler<>() {
@Override
public void completed(Integer nBytes, A attach) {
if (nBytes.intValue() < 0) {
@@ -1039,7 +1039,7 @@ public class SecureNio2Channel extends Nio2Channel {
if (!handshakeComplete) {
throw new IllegalStateException(sm.getString("channel.nio.ssl.incompleteHandshake"));
}
- CompletionHandler<Integer, A> readCompletionHandler = new CompletionHandler<Integer, A>() {
+ CompletionHandler<Integer, A> readCompletionHandler = new CompletionHandler<>() {
@Override
public void completed(Integer nBytes, A attach) {
if (nBytes.intValue() < 0) {
diff --git a/java/org/apache/tomcat/util/res/StringManager.java b/java/org/apache/tomcat/util/res/StringManager.java
index d9e11bb..17132b3 100644
--- a/java/org/apache/tomcat/util/res/StringManager.java
+++ b/java/org/apache/tomcat/util/res/StringManager.java
@@ -244,7 +244,7 @@ public class StringManager {
* for removal needs to use one less than the maximum desired size
*
*/
- map = new LinkedHashMap<Locale,StringManager>(LOCALE_CACHE_SIZE, 1, true) {
+ map = new LinkedHashMap<>(LOCALE_CACHE_SIZE, 1, true) {
private static final long serialVersionUID = 1L;
@Override
protected boolean removeEldestEntry(
diff --git a/test/org/apache/catalina/valves/Benchmarks.java b/test/org/apache/catalina/valves/Benchmarks.java
index 30ea36e..9c6f774 100644
--- a/test/org/apache/catalina/valves/Benchmarks.java
+++ b/test/org/apache/catalina/valves/Benchmarks.java
@@ -75,7 +75,7 @@ public class Benchmarks {
return "ThreadLocals";
}
- private ThreadLocal<Long> currentMillisLocal = new ThreadLocal<Long>() {
+ private ThreadLocal<Long> currentMillisLocal = new ThreadLocal<>() {
@Override
protected Long initialValue() {
return Long.valueOf(0);
@@ -111,7 +111,7 @@ public class Benchmarks {
long value = 0;
}
- private ThreadLocal<MutableLong> currentMillisLocal = new ThreadLocal<MutableLong>() {
+ private ThreadLocal<MutableLong> currentMillisLocal = new ThreadLocal<>() {
@Override
protected MutableLong initialValue() {
return new MutableLong();
@@ -148,7 +148,7 @@ public class Benchmarks {
public Date currentDate;
}
- private ThreadLocal<Struct> currentStruct = new ThreadLocal<Struct>() {
+ private ThreadLocal<Struct> currentStruct = new ThreadLocal<>() {
@Override
protected Struct initialValue() {
return new Struct();
@@ -267,31 +267,31 @@ public class Benchmarks {
private ThreadLocal<String> currentDateStringLocal = new ThreadLocal<>();
- private ThreadLocal<Date> currentDateLocal = new ThreadLocal<Date>() {
+ private ThreadLocal<Date> currentDateLocal = new ThreadLocal<>() {
@Override
protected Date initialValue() {
return new Date();
}
};
- private ThreadLocal<SimpleDateFormat> dayFormatterLocal = new ThreadLocal<SimpleDateFormat>() {
+ private ThreadLocal<SimpleDateFormat> dayFormatterLocal = new ThreadLocal<>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("dd");
}
};
- private ThreadLocal<SimpleDateFormat> monthFormatterLocal = new ThreadLocal<SimpleDateFormat>() {
+ private ThreadLocal<SimpleDateFormat> monthFormatterLocal = new ThreadLocal<>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("MM");
}
};
- private ThreadLocal<SimpleDateFormat> yearFormatterLocal = new ThreadLocal<SimpleDateFormat>() {
+ private ThreadLocal<SimpleDateFormat> yearFormatterLocal = new ThreadLocal<>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy");
}
};
- private ThreadLocal<SimpleDateFormat> timeFormatterLocal = new ThreadLocal<SimpleDateFormat>() {
+ private ThreadLocal<SimpleDateFormat> timeFormatterLocal = new ThreadLocal<>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("hh:mm:ss");
@@ -353,7 +353,7 @@ public class Benchmarks {
"hh:mm:ss");
}
- private ThreadLocal<Struct> structLocal = new ThreadLocal<Struct>() {
+ private ThreadLocal<Struct> structLocal = new ThreadLocal<>() {
@Override
protected Struct initialValue() {
return new Struct();
@@ -414,7 +414,7 @@ public class Benchmarks {
"hh:mm:ss");
}
- private ThreadLocal<Struct> structLocal = new ThreadLocal<Struct>() {
+ private ThreadLocal<Struct> structLocal = new ThreadLocal<>() {
@Override
protected Struct initialValue() {
return new Struct();
diff --git a/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java b/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
index df98966..10ffd2c 100644
--- a/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
+++ b/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
@@ -165,7 +165,7 @@ public final class DrawboardEndpoint extends Endpoint {
private final MessageHandler.Whole<String> stringHandler =
- new MessageHandler.Whole<String>() {
+ new MessageHandler.Whole<>() {
@Override
public void onMessage(final String message) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org