On Sat, 2019-02-16 at 08:45 -0500, Gary Gregory wrote:
> 

...


> This is what Eclipse says for one of the call sites:
> 
> Description Resource Path Location Type
> 
> LookupRegistry is a raw type. References to generic type
> LookupRegistry<T>
> should be parameterized AsyncServerBootstrap.java
> /httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap line
> 334 Java
> Problem
> 
> Supplier is a raw type. References to generic type Supplier<T> should
> be
> parameterized AsyncServerBootstrap.java
> /httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap line
> 331 Java
> Problem
> 
> Type safety: The expression of type new Supplier(){} needs unchecked
> conversion to conform to
> Supplier<LookupRegistry<Supplier<AsyncServerExchangeHandler>>>
> AsyncServerBootstrap.java
> /httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap line
> 331 Java
> Problem
> 
> Gary
> 


Index: 
httpcore5/src/test/java/org/apache/hc/core5/http/impl/bootstrap/TestAsyncServerBootstrapLookupRegistry.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- 
httpcore5/src/test/java/org/apache/hc/core5/http/impl/bootstrap/TestAsyncServerBootstrapLookupRegistry.java
 (revision e3b474456dda8b978f1a0eabdfa71e6e308a37cd)
+++ 
httpcore5/src/test/java/org/apache/hc/core5/http/impl/bootstrap/TestAsyncServerBootstrapLookupRegistry.java
 (date 1550326220000)
@@ -26,6 +26,7 @@
  */
 package org.apache.hc.core5.http.impl.bootstrap;
 
+import org.apache.hc.core5.function.Supplier;
 import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
 import org.apache.hc.core5.http.protocol.LookupRegistry;
 import org.junit.Test;
@@ -39,23 +40,21 @@
 
     @Test
     public void testCreateCustomLookupRegistry() {
-        AsyncServerBootstrap.bootstrap().setLookupRegistry(new 
LookupRegistry<AsyncServerExchangeHandler>() {
+        AsyncServerBootstrap.bootstrap().setLookupRegistry(new 
LookupRegistry<Supplier<AsyncServerExchangeHandler>>() {
 
             @Override
-            public void register(final String pattern, final 
AsyncServerExchangeHandler obj) {
-                // noop
+            public void register(String pattern, 
Supplier<AsyncServerExchangeHandler> obj) {
             }
 
             @Override
-            public AsyncServerExchangeHandler lookup(final String value) {
-                // noop
+            public Supplier<AsyncServerExchangeHandler> lookup(String value) {
                 return null;
             }
 
             @Override
-            public void unregister(final String pattern) {
-                // noop
+            public void unregister(String pattern) {
             }
+
         }).create();
     }
 }
Index: 
httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- 
httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
   (revision e3b474456dda8b978f1a0eabdfa71e6e308a37cd)
+++ 
httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
   (date 1550326094000)
@@ -77,7 +77,7 @@
     private final List<HandlerEntry<Supplier<AsyncServerExchangeHandler>>> 
handlerList;
     private final List<FilterEntry<AsyncFilterHandler>> filters;
     private String canonicalHostName;
-    private LookupRegistry<AsyncServerExchangeHandler> lookupRegistry;
+    private LookupRegistry<Supplier<AsyncServerExchangeHandler>> 
lookupRegistry;
     private IOReactorConfig ioReactorConfig;
     private H1Config h1Config;
     private CharCodingConfig charCodingConfig;
@@ -184,7 +184,7 @@
      * @return this
      * @since 5.0
      */
-    public final AsyncServerBootstrap setLookupRegistry(final 
LookupRegistry<AsyncServerExchangeHandler> lookupRegistry) {
+    public final AsyncServerBootstrap setLookupRegistry(final 
LookupRegistry<Supplier<AsyncServerExchangeHandler>> lookupRegistry) {
         this.lookupRegistry = lookupRegistry;
         return this;
     }
@@ -328,11 +328,12 @@
     public HttpAsyncServer create() {
         final RequestHandlerRegistry<Supplier<AsyncServerExchangeHandler>> 
registry = new RequestHandlerRegistry<>(
                 canonicalHostName != null ? canonicalHostName : 
InetAddressUtils.getCanonicalLocalHostName(),
-                new Supplier() {
+                new 
Supplier<LookupRegistry<Supplier<AsyncServerExchangeHandler>>>() {
 
                     @Override
-                    public LookupRegistry get() {
-                        return lookupRegistry != null ? lookupRegistry : 
UriPatternType.newMatcher(UriPatternType.URI_PATTERN);
+                    public 
LookupRegistry<Supplier<AsyncServerExchangeHandler>> get() {
+                        return lookupRegistry != null ? lookupRegistry :
+                                
UriPatternType.<Supplier<AsyncServerExchangeHandler>>newMatcher(UriPatternType.URI_PATTERN);
                     }
 
                 });



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to