From 7c4aea4bc31ad1c96449d218c8833349ac9dfb83 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Sat, 22 Mar 2014 07:20:10 +0100 Subject: [PATCH] Fixing CorsConfigTest failure under Java 8. Motivation: When running the build with Java 8 the following error occurred: java: reference to preflightResponseHeader is ambiguous both method preflightResponseHeader(java.lang.CharSequence,java.lang.Iterable) in io.netty.handler.codec.http.cors.CorsConfig.Builder and method preflightResponseHeader(java.lang.String,java.util.concurrent.Callable) in io.netty.handler.codec.http.cors.CorsConfig.Builder match The offending class was CorsConfigTest and its shouldThrowIfValueIsNull which contained the following line: withOrigin("*").preflightResponseHeader("HeaderName", null).build(); Modifications: Updated the offending method with to supply a type, and object array, to avoid the error. Result: After this I was able to build with Java 7 and Java 8 --- .../java/io/netty/handler/codec/http/cors/CorsConfigTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec-http/src/test/java/io/netty/handler/codec/http/cors/CorsConfigTest.java b/codec-http/src/test/java/io/netty/handler/codec/http/cors/CorsConfigTest.java index 6919b6fcf3..e0dfed8962 100644 --- a/codec-http/src/test/java/io/netty/handler/codec/http/cors/CorsConfigTest.java +++ b/codec-http/src/test/java/io/netty/handler/codec/http/cors/CorsConfigTest.java @@ -101,7 +101,7 @@ public class CorsConfigTest { @Test (expected = IllegalArgumentException.class) public void shouldThrowIfValueIsNull() { - withOrigin("*").preflightResponseHeader("HeaderName", null).build(); + withOrigin("*").preflightResponseHeader("HeaderName", new Object[]{null}).build(); } }