diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java index 86d2e42f7e..9cdf9eb93d 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,8 +27,7 @@ import static org.junit.Assert.*; /** * Unit tests for the {@link AspectJAdviceParameterNameDiscoverer} class. * - *
See also {@link TigerAspectJAdviceParameterNameDiscovererTests} in - * the 'tiger' tree for tests relating to annotations. + *
See also {@link TigerAspectJAdviceParameterNameDiscovererTests} for tests relating to annotations. * * @author Adrian Colyer * @author Chris Beams @@ -83,27 +82,28 @@ public class AspectJAdviceParameterNameDiscovererTests { @Test public void testJoinPointOnly() { - assertParameterNames(getMethod("tjp"), "execution(* *(..))", new String[]{"thisJoinPoint"}); + assertParameterNames(getMethod("tjp"), "execution(* *(..))", new String[] {"thisJoinPoint"}); } @Test public void testJoinPointStaticPartOnly() { - assertParameterNames(getMethod("tjpsp"), "execution(* *(..))", new String[]{"thisJoinPointStaticPart"}); + assertParameterNames(getMethod("tjpsp"), "execution(* *(..))", new String[] {"thisJoinPointStaticPart"}); } @Test public void testTwoJoinPoints() { - assertException(getMethod("twoJoinPoints"), "foo()", IllegalStateException.class, "Failed to bind all argument names: 1 argument(s) could not be bound"); + assertException(getMethod("twoJoinPoints"), "foo()", IllegalStateException.class, + "Failed to bind all argument names: 1 argument(s) could not be bound"); } @Test public void testOneThrowable() { - assertParameterNames(getMethod("oneThrowable"), "foo()", null, "ex", new String[]{"ex"}); + assertParameterNames(getMethod("oneThrowable"), "foo()", null, "ex", new String[] {"ex"}); } @Test public void testOneJPAndOneThrowable() { - assertParameterNames(getMethod("jpAndOneThrowable"), "foo()", null, "ex", new String[]{"thisJoinPoint", "ex"}); + assertParameterNames(getMethod("jpAndOneThrowable"), "foo()", null, "ex", new String[] {"thisJoinPoint", "ex"}); } @Test @@ -120,7 +120,7 @@ public class AspectJAdviceParameterNameDiscovererTests { @Test public void testReturning() { - assertParameterNames(getMethod("oneObject"), "foo()", "obj", null, new String[]{"obj"}); + assertParameterNames(getMethod("oneObject"), "foo()", "obj", null, new String[] {"obj"}); } @Test @@ -137,16 +137,16 @@ public class AspectJAdviceParameterNameDiscovererTests { @Test public void testThisBindingOneCandidate() { - assertParameterNames(getMethod("oneObject"), "this(x)", new String[]{"x"}); + assertParameterNames(getMethod("oneObject"), "this(x)", new String[] {"x"}); } @Test public void testThisBindingWithAlternateTokenizations() { - assertParameterNames(getMethod("oneObject"), "this( x )", new String[]{"x"}); - assertParameterNames(getMethod("oneObject"), "this( x)", new String[]{"x"}); - assertParameterNames(getMethod("oneObject"), "this (x )", new String[]{"x"}); - assertParameterNames(getMethod("oneObject"), "this(x )", new String[]{"x"}); - assertParameterNames(getMethod("oneObject"), "foo() && this(x)", new String[]{"x"}); + assertParameterNames(getMethod("oneObject"), "this( x )", new String[] {"x"}); + assertParameterNames(getMethod("oneObject"), "this( x)", new String[] {"x"}); + assertParameterNames(getMethod("oneObject"), "this (x )", new String[] {"x"}); + assertParameterNames(getMethod("oneObject"), "this(x )", new String[] {"x"}); + assertParameterNames(getMethod("oneObject"), "foo() && this(x)", new String[] {"x"}); } @Test @@ -165,16 +165,16 @@ public class AspectJAdviceParameterNameDiscovererTests { @Test public void testTargetBindingOneCandidate() { - assertParameterNames(getMethod("oneObject"), "target(x)", new String[]{"x"}); + assertParameterNames(getMethod("oneObject"), "target(x)", new String[] {"x"}); } @Test public void testTargetBindingWithAlternateTokenizations() { - assertParameterNames(getMethod("oneObject"), "target( x )", new String[]{"x"}); - assertParameterNames(getMethod("oneObject"), "target( x)", new String[]{"x"}); - assertParameterNames(getMethod("oneObject"), "target (x )", new String[]{"x"}); - assertParameterNames(getMethod("oneObject"), "target(x )", new String[]{"x"}); - assertParameterNames(getMethod("oneObject"), "foo() && target(x)", new String[]{"x"}); + assertParameterNames(getMethod("oneObject"), "target( x )", new String[] {"x"}); + assertParameterNames(getMethod("oneObject"), "target( x)", new String[] {"x"}); + assertParameterNames(getMethod("oneObject"), "target (x )", new String[] {"x"}); + assertParameterNames(getMethod("oneObject"), "target(x )", new String[] {"x"}); + assertParameterNames(getMethod("oneObject"), "foo() && target(x)", new String[] {"x"}); } @Test @@ -193,7 +193,7 @@ public class AspectJAdviceParameterNameDiscovererTests { @Test public void testArgsBindingOneObject() { - assertParameterNames(getMethod("oneObject"), "args(x)", new String[]{"x"}); + assertParameterNames(getMethod("oneObject"), "args(x)", new String[] {"x"}); } @Test @@ -210,7 +210,7 @@ public class AspectJAdviceParameterNameDiscovererTests { @Test public void testArgsOnePrimitive() { - assertParameterNames(getMethod("onePrimitive"), "args(count)", new String[]{"count"}); + assertParameterNames(getMethod("onePrimitive"), "args(count)", new String[] {"count"}); } @Test @@ -221,62 +221,64 @@ public class AspectJAdviceParameterNameDiscovererTests { @Test public void testThisAndPrimitive() { - assertParameterNames(getMethod("oneObjectOnePrimitive"), "args(count) && this(obj)", new String[]{"obj", "count"}); + assertParameterNames(getMethod("oneObjectOnePrimitive"), "args(count) && this(obj)", new String[] {"obj", "count"}); } @Test public void testTargetAndPrimitive() { - assertParameterNames(getMethod("oneObjectOnePrimitive"), "args(count) && target(obj)", new String[]{"obj", "count"}); + assertParameterNames(getMethod("oneObjectOnePrimitive"), "args(count) && target(obj)", new String[] {"obj", "count"}); } @Test public void testThrowingAndPrimitive() { - assertParameterNames(getMethod("oneThrowableOnePrimitive"), "args(count)", null, "ex", new String[]{"ex", "count"}); + assertParameterNames(getMethod("oneThrowableOnePrimitive"), "args(count)", null, "ex", new String[] {"ex", "count"}); } @Test public void testAllTogetherNow() { - assertParameterNames(getMethod("theBigOne"), "this(foo) && args(x)", null, "ex", new String[]{"thisJoinPoint", "ex", "x", "foo"}); + assertParameterNames(getMethod("theBigOne"), "this(foo) && args(x)", null, "ex", new String[] {"thisJoinPoint", "ex", "x", "foo"}); } @Test public void testReferenceBinding() { - assertParameterNames(getMethod("onePrimitive"),"somepc(foo)",new String[] {"foo"}); + assertParameterNames(getMethod("onePrimitive"),"somepc(foo)", new String[] {"foo"}); } @Test public void testReferenceBindingWithAlternateTokenizations() { - assertParameterNames(getMethod("onePrimitive"),"call(bar *) && somepc(foo)",new String[] {"foo"}); - assertParameterNames(getMethod("onePrimitive"),"somepc ( foo )",new String[] {"foo"}); - assertParameterNames(getMethod("onePrimitive"),"somepc( foo)",new String[] {"foo"}); + assertParameterNames(getMethod("onePrimitive"),"call(bar *) && somepc(foo)", new String[] {"foo"}); + assertParameterNames(getMethod("onePrimitive"),"somepc ( foo )", new String[] {"foo"}); + assertParameterNames(getMethod("onePrimitive"),"somepc( foo)", new String[] {"foo"}); } protected Method getMethod(String name) { // assumes no overloading of test methods... Method[] candidates = this.getClass().getMethods(); - for (int i = 0; i < candidates.length; i++) { - if (candidates[i].getName().equals(name)) { - return candidates[i]; + for (Method candidate : candidates) { + if (candidate.getName().equals(name)) { + return candidate; } } fail("Bad test specification, no method '" + name + "' found in test class"); return null; } - protected void assertParameterNames(Method m, String pointcut, String[] parameterNames) { - assertParameterNames(m, pointcut, null, null, parameterNames); + protected void assertParameterNames(Method method, String pointcut, String[] parameterNames) { + assertParameterNames(method, pointcut, null, null, parameterNames); } - protected void assertParameterNames(Method m, String pointcut, String returning, String throwing, String[] parameterNames) { + protected void assertParameterNames(Method method, String pointcut, String returning, String throwing, + String[] parameterNames) { + assertEquals("bad test specification, must have same number of parameter names as method arguments", - m.getParameterCount(), parameterNames.length); + method.getParameterCount(), parameterNames.length); AspectJAdviceParameterNameDiscoverer discoverer = new AspectJAdviceParameterNameDiscoverer(pointcut); discoverer.setRaiseExceptions(true); discoverer.setReturningName(returning); discoverer.setThrowingName(throwing); - String[] discoveredNames = discoverer.getParameterNames(m); + String[] discoveredNames = discoverer.getParameterNames(method); String formattedExpectedNames = format(parameterNames); String formattedActualNames = format(discoveredNames); @@ -294,18 +296,20 @@ public class AspectJAdviceParameterNameDiscovererTests { } } - protected void assertException(Method m, String pointcut, Class> exceptionType, String message) { - assertException(m, pointcut, null, null, exceptionType, message); + protected void assertException(Method method, String pointcut, Class> exceptionType, String message) { + assertException(method, pointcut, null, null, exceptionType, message); } - protected void assertException(Method m, String pointcut, String returning, String throwing, Class> exceptionType, String message) { + protected void assertException(Method method, String pointcut, String returning, String throwing, + Class> exceptionType, String message) { + AspectJAdviceParameterNameDiscoverer discoverer = new AspectJAdviceParameterNameDiscoverer(pointcut); discoverer.setRaiseExceptions(true); discoverer.setReturningName(returning); discoverer.setThrowingName(throwing); try { - discoverer.getParameterNames(m); + discoverer.getParameterNames(method); fail("Expecting " + exceptionType.getName() + " with message '" + message + "'"); } catch (RuntimeException expected) { diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java index efb35e62c1..e3c52db8f3 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,55 +27,54 @@ import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer.Ambi * @author Adrian Colyer * @author Chris Beams */ -public class TigerAspectJAdviceParameterNameDiscovererTests - extends AspectJAdviceParameterNameDiscovererTests { +public class TigerAspectJAdviceParameterNameDiscovererTests extends AspectJAdviceParameterNameDiscovererTests { @Test public void testAtThis() { - assertParameterNames(getMethod("oneAnnotation"),"@this(a)",new String[]{"a"}); + assertParameterNames(getMethod("oneAnnotation"),"@this(a)", new String[] {"a"}); } @Test public void testAtTarget() { - assertParameterNames(getMethod("oneAnnotation"),"@target(a)",new String[]{"a"}); + assertParameterNames(getMethod("oneAnnotation"),"@target(a)", new String[] {"a"}); } @Test public void testAtArgs() { - assertParameterNames(getMethod("oneAnnotation"),"@args(a)",new String[]{"a"}); + assertParameterNames(getMethod("oneAnnotation"),"@args(a)", new String[] {"a"}); } @Test public void testAtWithin() { - assertParameterNames(getMethod("oneAnnotation"),"@within(a)",new String[]{"a"}); + assertParameterNames(getMethod("oneAnnotation"),"@within(a)", new String[] {"a"}); } @Test public void testAtWithincode() { - assertParameterNames(getMethod("oneAnnotation"),"@withincode(a)",new String[]{"a"}); + assertParameterNames(getMethod("oneAnnotation"),"@withincode(a)", new String[] {"a"}); } @Test public void testAtAnnotation() { - assertParameterNames(getMethod("oneAnnotation"),"@annotation(a)",new String[]{"a"}); + assertParameterNames(getMethod("oneAnnotation"),"@annotation(a)", new String[] {"a"}); } @Test public void testAmbiguousAnnotationTwoVars() { - assertException(getMethod("twoAnnotations"),"@annotation(a) && @this(x)",AmbiguousBindingException.class, + assertException(getMethod("twoAnnotations"),"@annotation(a) && @this(x)", AmbiguousBindingException.class, "Found 2 potential annotation variable(s), and 2 potential argument slots"); } @Test public void testAmbiguousAnnotationOneVar() { assertException(getMethod("oneAnnotation"),"@annotation(a) && @this(x)",IllegalArgumentException.class, - "Found 2 candidate annotation binding variables but only one potential argument binding slot"); + "Found 2 candidate annotation binding variables but only one potential argument binding slot"); } @Test public void testAnnotationMedley() { - assertParameterNames(getMethod("annotationMedley"),"@annotation(a) && args(count) && this(foo)",null,"ex", - new String[] {"ex","foo","count","a"}); + assertParameterNames(getMethod("annotationMedley"),"@annotation(a) && args(count) && this(foo)", + null, "ex", new String[] {"ex", "foo", "count", "a"}); } diff --git a/spring-web/src/main/java/org/springframework/http/converter/protobuf/ExtensionRegistryInitializer.java b/spring-web/src/main/java/org/springframework/http/converter/protobuf/ExtensionRegistryInitializer.java index ac08b660eb..d36a7429db 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/protobuf/ExtensionRegistryInitializer.java +++ b/spring-web/src/main/java/org/springframework/http/converter/protobuf/ExtensionRegistryInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,12 +22,12 @@ import com.google.protobuf.ExtensionRegistry; * Google Protocol Messages can contain message extensions that can be parsed if * the appropriate configuration has been registered in the {@code ExtensionRegistry}. * - * This interface provides a facility to populate the {@code ExtensionRegistry}. + *
This interface provides a facility to populate the {@code ExtensionRegistry}. * * @author Alex Antonov * @since 4.1 * @see - * com.google.protobuf.ExtensionRegistry + * com.google.protobuf.ExtensionRegistry */ public interface ExtensionRegistryInitializer { diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java index 2d033eac90..42c4a50a0a 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java @@ -75,7 +75,7 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse { public AbstractServerHttpResponse(DataBufferFactory dataBufferFactory) { - Assert.notNull(dataBufferFactory, "'dataBufferFactory' must not be null"); + Assert.notNull(dataBufferFactory, "DataBufferFactory must not be null"); this.dataBufferFactory = dataBufferFactory; this.headers = new HttpHeaders(); this.cookies = new LinkedMultiValueMap<>(); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicate.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicate.java index 000ef8d019..2679527af6 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicate.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicate.java @@ -22,7 +22,8 @@ import org.springframework.util.Assert; /** * Represents a function that evaluates on a given {@link ServerRequest}. - * Instances of this function that evaluate on common request properties can be found in {@link RequestPredicates}. + * Instances of this function that evaluate on common request properties + * can be found in {@link RequestPredicates}. * * @author Arjen Poutsma * @since 5.0 @@ -74,17 +75,17 @@ public interface RequestPredicate { /** * Transform the given request into a request used for a nested route. For instance, - * a path-based predicate can return a {@code ServerRequest} with a the path remaining after a - * match. + * a path-based predicate can return a {@code ServerRequest} with a the path remaining + * after a match. *
The default implementation returns an {@code Optional} wrapping the given path if
- * {@link #test(ServerRequest)} evaluates to {@code true}; or {@link Optional#empty()} if it
- * evaluates to {@code false}.
+ * {@link #test(ServerRequest)} evaluates to {@code true}; or {@link Optional#empty()}
+ * if it evaluates to {@code false}.
* @param request the request to be nested
* @return the nested request
* @see RouterFunctions#nest(RequestPredicate, RouterFunction)
*/
default Optional This function will be called with the following parameters:
*
- *
* // Add the following to an @Configuration class
* @Bean
* public ScriptTemplateConfigurer mustacheConfigurer() {
@@ -157,7 +156,6 @@ public class ScriptTemplateConfigurer implements ScriptTemplateConfig {
/**
* Set the render function name (mandatory).
- *
*
*