Commit 106bbaf9 authored by Emmanuel Bourg's avatar Emmanuel Bourg

Update upstream source from tag 'upstream/4.3.19'

Update to upstream version '4.3.19'
with Debian dir de6718d077842a01ea6224db1aa57ba7c5ed2db1
parents 136b827b 28270ba2
...@@ -52,7 +52,7 @@ configure(allprojects) { project -> ...@@ -52,7 +52,7 @@ configure(allprojects) { project ->
ext.hsqldbVersion = "2.3.4" ext.hsqldbVersion = "2.3.4"
ext.httpasyncVersion = "4.1.3" ext.httpasyncVersion = "4.1.3"
ext.httpclientVersion = "4.5.5" ext.httpclientVersion = "4.5.5"
ext.jackson2Version = "2.8.11.1" ext.jackson2Version = "2.8.11.2"
ext.jasperreportsVersion = "6.2.1" // our tests fail with JR-internal NPEs against 6.2.2 and higher ext.jasperreportsVersion = "6.2.1" // our tests fail with JR-internal NPEs against 6.2.2 and higher
ext.javamailVersion = "1.5.6" ext.javamailVersion = "1.5.6"
ext.jettyVersion = "9.3.14.v20161028" // as of 9.3.15, Jetty has hard Servlet 3.1 requirement ext.jettyVersion = "9.3.14.v20161028" // as of 9.3.15, Jetty has hard Servlet 3.1 requirement
...@@ -62,20 +62,20 @@ configure(allprojects) { project -> ...@@ -62,20 +62,20 @@ configure(allprojects) { project ->
ext.jtaVersion = "1.2" ext.jtaVersion = "1.2"
ext.junitVersion = "4.12" ext.junitVersion = "4.12"
ext.log4jVersion = "1.2.17" ext.log4jVersion = "1.2.17"
ext.nettyVersion = "4.1.22.Final" ext.nettyVersion = "4.1.29.Final"
ext.okhttpVersion = "2.7.5" ext.okhttpVersion = "2.7.5"
ext.okhttp3Version = "3.8.1" ext.okhttp3Version = "3.8.1"
ext.openjpaVersion = "2.4.2" ext.openjpaVersion = "2.4.2"
ext.poiVersion = "3.14" ext.poiVersion = "3.14"
ext.reactorVersion = "2.0.8.RELEASE" ext.reactorVersion = "2.0.8.RELEASE"
ext.romeVersion = "1.7.4" ext.romeVersion = "1.7.4"
ext.slf4jVersion = "1.7.21" ext.slf4jVersion = "1.7.25"
ext.snakeyamlVersion = "1.17" ext.snakeyamlVersion = "1.17"
ext.snifferVersion = "1.16" ext.snifferVersion = "1.16"
ext.testngVersion = "6.9.10" ext.testngVersion = "6.9.10"
ext.tiles2Version = "2.2.2" ext.tiles2Version = "2.2.2"
ext.tiles3Version = "3.0.7" ext.tiles3Version = "3.0.7"
ext.tomcatVersion = "8.5.29" ext.tomcatVersion = "8.5.33"
ext.tyrusVersion = "1.3.5" // constrained by WebLogic 12.1.3 support ext.tyrusVersion = "1.3.5" // constrained by WebLogic 12.1.3 support
ext.undertowVersion = "1.3.33.Final" ext.undertowVersion = "1.3.33.Final"
ext.xmlunitVersion = "1.6" ext.xmlunitVersion = "1.6"
...@@ -316,7 +316,7 @@ project("spring-core") { ...@@ -316,7 +316,7 @@ project("spring-core") {
} }
// Repackage net.sf.cglib => org.springframework.cglib // Repackage net.sf.cglib => org.springframework.cglib
rule(pattern: "net.sf.cglib.**", result: "org.springframework.cglib.@1") rule(pattern: "net.sf.cglib.**", result: "org.springframework.cglib.@1")
// As mentioned above, transform cglib"s internal asm dependencies from // As mentioned above, transform cglib's internal asm dependencies from
// org.objectweb.asm => org.springframework.asm. Doing this counts on the // org.objectweb.asm => org.springframework.asm. Doing this counts on the
// the fact that Spring and cglib depend on the same version of asm! // the fact that Spring and cglib depend on the same version of asm!
rule(pattern: "org.objectweb.asm.**", result: "org.springframework.asm.@1") rule(pattern: "org.objectweb.asm.**", result: "org.springframework.asm.@1")
...@@ -726,7 +726,7 @@ project("spring-web") { ...@@ -726,7 +726,7 @@ project("spring-web") {
} }
testCompile("com.fasterxml.jackson.datatype:jackson-datatype-joda:2.8.11") testCompile("com.fasterxml.jackson.datatype:jackson-datatype-joda:2.8.11")
testCompile("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.11") testCompile("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.11")
testCompile("com.fasterxml.jackson.module:jackson-module-kotlin:${jackson2Version}") testCompile("com.fasterxml.jackson.module:jackson-module-kotlin:2.8.11.1")
testCompile("com.squareup.okhttp3:mockwebserver:${okhttp3Version}") testCompile("com.squareup.okhttp3:mockwebserver:${okhttp3Version}")
testRuntime("com.sun.mail:javax.mail:${javamailVersion}") testRuntime("com.sun.mail:javax.mail:${javamailVersion}")
} }
......
version=4.3.15.RELEASE version=4.3.19.RELEASE
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -48,10 +48,11 @@ import java.lang.reflect.Method; ...@@ -48,10 +48,11 @@ import java.lang.reflect.Method;
public interface MethodMatcher { public interface MethodMatcher {
/** /**
* Perform static checking whether the given method matches. If this * Perform static checking whether the given method matches.
* returns {@code false} or if the {@link #isRuntime()} method * <p>If this returns {@code false} or if the {@link #isRuntime()}
* returns {@code false}, no runtime check (i.e. no. * method returns {@code false}, no runtime check (i.e. no
* {@link #matches(java.lang.reflect.Method, Class, Object[])} call) will be made. * {@link #matches(java.lang.reflect.Method, Class, Object[])} call)
* will be made.
* @param method the candidate method * @param method the candidate method
* @param targetClass the target class (may be {@code null}, in which case * @param targetClass the target class (may be {@code null}, in which case
* the candidate class must be taken to be the method's declaring class) * the candidate class must be taken to be the method's declaring class)
......
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -32,17 +32,15 @@ import org.springframework.core.ParameterNameDiscoverer; ...@@ -32,17 +32,15 @@ import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* Implementation of AspectJ ProceedingJoinPoint interface * An implementation of the AspectJ {@link ProceedingJoinPoint} interface
* wrapping an AOP Alliance MethodInvocation. * wrapping an AOP Alliance {@link org.aopalliance.intercept.MethodInvocation}.
* *
* <p><b>Note</b>: the {@code getThis()} method returns the current Spring AOP proxy. * <p><b>Note</b>: The {@code getThis()} method returns the current Spring AOP proxy.
* The {@code getTarget()} method returns the current Spring AOP target (which may be * The {@code getTarget()} method returns the current Spring AOP target (which may be
* {@code null} if there is no target), and is a plain POJO without any advice. * {@code null} if there is no target instance) as a plain POJO without any advice.
* <b>If you want to call the object and have the advice take effect, use * <b>If you want to call the object and have the advice take effect, use {@code getThis()}.</b>
* {@code getThis()}.</b> A common example is casting the object to an * A common example is casting the object to an introduced interface in the implementation of
* introduced interface in the implementation of an introduction. * an introduction. There is no such distinction between target and proxy in AspectJ itself.
*
* <p>Of course there is no such distinction between target and proxy in AspectJ.
* *
* @author Rod Johnson * @author Rod Johnson
* @author Juergen Hoeller * @author Juergen Hoeller
...@@ -56,7 +54,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint, ...@@ -56,7 +54,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
private final ProxyMethodInvocation methodInvocation; private final ProxyMethodInvocation methodInvocation;
private Object[] defensiveCopyOfArgs; private Object[] args;
/** Lazily initialized signature object */ /** Lazily initialized signature object */
private Signature signature; private Signature signature;
...@@ -75,6 +73,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint, ...@@ -75,6 +73,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
this.methodInvocation = methodInvocation; this.methodInvocation = methodInvocation;
} }
@Override @Override
public void set$AroundClosure(AroundClosure aroundClosure) { public void set$AroundClosure(AroundClosure aroundClosure) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
...@@ -115,12 +114,10 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint, ...@@ -115,12 +114,10 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
@Override @Override
public Object[] getArgs() { public Object[] getArgs() {
if (this.defensiveCopyOfArgs == null) { if (this.args == null) {
Object[] argsSource = this.methodInvocation.getArguments(); this.args = this.methodInvocation.getArguments().clone();
this.defensiveCopyOfArgs = new Object[argsSource.length];
System.arraycopy(argsSource, 0, this.defensiveCopyOfArgs, 0, argsSource.length);
} }
return this.defensiveCopyOfArgs; return this.args;
} }
@Override @Override
...@@ -128,7 +125,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint, ...@@ -128,7 +125,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
if (this.signature == null) { if (this.signature == null) {
this.signature = new MethodSignatureImpl(); this.signature = new MethodSignatureImpl();
} }
return signature; return this.signature;
} }
@Override @Override
......
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -59,6 +59,9 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac ...@@ -59,6 +59,9 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
private static final String AJC_MAGIC = "ajc$"; private static final String AJC_MAGIC = "ajc$";
private static final Class<?>[] ASPECTJ_ANNOTATION_CLASSES = new Class<?>[] {
Pointcut.class, Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class};
/** Logger available to subclasses */ /** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
...@@ -122,14 +125,12 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac ...@@ -122,14 +125,12 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
/** /**
* Find and return the first AspectJ annotation on the given method * Find and return the first AspectJ annotation on the given method
* (there <i>should</i> only be one anyway...) * (there <i>should</i> only be one anyway...).
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) { protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) {
Class<?>[] classesToLookFor = new Class<?>[] { for (Class<?> clazz : ASPECTJ_ANNOTATION_CLASSES) {
Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class, Pointcut.class}; AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) clazz);
for (Class<?> c : classesToLookFor) {
AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) c);
if (foundAnnotation != null) { if (foundAnnotation != null) {
return foundAnnotation; return foundAnnotation;
} }
...@@ -148,14 +149,13 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac ...@@ -148,14 +149,13 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
} }
/**
* Enum for AspectJ annotation types.
* @see AspectJAnnotation#getAnnotationType()
*/
protected enum AspectJAnnotationType { protected enum AspectJAnnotationType {
AtPointcut, AtPointcut, AtAround, AtBefore, AtAfter, AtAfterReturning, AtAfterThrowing
AtBefore,
AtAfter,
AtAfterReturning,
AtAfterThrowing,
AtAround
} }
...@@ -165,18 +165,18 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac ...@@ -165,18 +165,18 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
*/ */
protected static class AspectJAnnotation<A extends Annotation> { protected static class AspectJAnnotation<A extends Annotation> {
private static final String[] EXPRESSION_PROPERTIES = new String[] {"value", "pointcut"}; private static final String[] EXPRESSION_ATTRIBUTES = new String[] {"pointcut", "value"};
private static Map<Class<?>, AspectJAnnotationType> annotationTypes = private static Map<Class<?>, AspectJAnnotationType> annotationTypeMap =
new HashMap<Class<?>, AspectJAnnotationType>(); new HashMap<Class<?>, AspectJAnnotationType>(8);
static { static {
annotationTypes.put(Pointcut.class,AspectJAnnotationType.AtPointcut); annotationTypeMap.put(Pointcut.class, AspectJAnnotationType.AtPointcut);
annotationTypes.put(After.class,AspectJAnnotationType.AtAfter); annotationTypeMap.put(Around.class, AspectJAnnotationType.AtAround);
annotationTypes.put(AfterReturning.class,AspectJAnnotationType.AtAfterReturning); annotationTypeMap.put(Before.class, AspectJAnnotationType.AtBefore);
annotationTypes.put(AfterThrowing.class,AspectJAnnotationType.AtAfterThrowing); annotationTypeMap.put(After.class, AspectJAnnotationType.AtAfter);
annotationTypes.put(Around.class,AspectJAnnotationType.AtAround); annotationTypeMap.put(AfterReturning.class, AspectJAnnotationType.AtAfterReturning);
annotationTypes.put(Before.class,AspectJAnnotationType.AtBefore); annotationTypeMap.put(AfterThrowing.class, AspectJAnnotationType.AtAfterThrowing);
} }
private final A annotation; private final A annotation;
...@@ -190,44 +190,31 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac ...@@ -190,44 +190,31 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
public AspectJAnnotation(A annotation) { public AspectJAnnotation(A annotation) {
this.annotation = annotation; this.annotation = annotation;
this.annotationType = determineAnnotationType(annotation); this.annotationType = determineAnnotationType(annotation);
// We know these methods exist with the same name on each object,
// but need to invoke them reflectively as there isn't a common interface.
try { try {
this.pointcutExpression = resolveExpression(annotation); this.pointcutExpression = resolveExpression(annotation);
this.argumentNames = (String) annotation.getClass().getMethod("argNames").invoke(annotation); this.argumentNames = (String) AnnotationUtils.getValue(annotation, "argNames");
} }
catch (Exception ex) { catch (Exception ex) {
throw new IllegalArgumentException(annotation + " cannot be an AspectJ annotation", ex); throw new IllegalArgumentException(annotation + " is not a valid AspectJ annotation", ex);
} }
} }
private AspectJAnnotationType determineAnnotationType(A annotation) { private AspectJAnnotationType determineAnnotationType(A annotation) {
for (Class<?> type : annotationTypes.keySet()) { AspectJAnnotationType type = annotationTypeMap.get(annotation.annotationType());
if (type.isInstance(annotation)) { if (type != null) {
return annotationTypes.get(type); return type;
}
} }
throw new IllegalStateException("Unknown annotation type: " + annotation.toString()); throw new IllegalStateException("Unknown annotation type: " + annotation);
} }
private String resolveExpression(A annotation) throws Exception { private String resolveExpression(A annotation) {
String expression = null; for (String attributeName : EXPRESSION_ATTRIBUTES) {
for (String methodName : EXPRESSION_PROPERTIES) { String candidate = (String) AnnotationUtils.getValue(annotation, attributeName);
Method method; if (StringUtils.hasText(candidate)) {
try { return candidate;
method = annotation.getClass().getDeclaredMethod(methodName);
}
catch (NoSuchMethodException ex) {
method = null;
}
if (method != null) {
String candidate = (String) method.invoke(annotation);
if (StringUtils.hasText(candidate)) {
expression = candidate;
}
} }
} }
return expression; throw new IllegalStateException("Failed to resolve expression: " + annotation);
} }
public AspectJAnnotationType getAnnotationType() { public AspectJAnnotationType getAnnotationType() {
...@@ -268,11 +255,11 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac ...@@ -268,11 +255,11 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
if (annotation == null) { if (annotation == null) {
return null; return null;
} }
StringTokenizer strTok = new StringTokenizer(annotation.getArgumentNames(), ","); StringTokenizer nameTokens = new StringTokenizer(annotation.getArgumentNames(), ",");
if (strTok.countTokens() > 0) { if (nameTokens.countTokens() > 0) {
String[] names = new String[strTok.countTokens()]; String[] names = new String[nameTokens.countTokens()];
for (int i = 0; i < names.length; i++) { for (int i = 0; i < names.length; i++) {
names[i] = strTok.nextToken(); names[i] = nameTokens.nextToken();
} }
return names; return names;
} }
......
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -109,29 +109,22 @@ class InstantiationModelAwarePointcutAdvisorImpl ...@@ -109,29 +109,22 @@ class InstantiationModelAwarePointcutAdvisorImpl
/** /**
* The pointcut for Spring AOP to use. Actual behaviour of the pointcut will change * The pointcut for Spring AOP to use.
* depending on the state of the advice. * Actual behaviour of the pointcut will change depending on the state of the advice.
*/ */
@Override @Override
public Pointcut getPointcut() { public Pointcut getPointcut() {
return this.pointcut; return this.pointcut;
} }
/**
* This is only of interest for Spring AOP: AspectJ instantiation semantics
* are much richer. In AspectJ terminology, all a return of {@code true}
* means here is that the aspect is not a SINGLETON.
*/
@Override @Override
public boolean isPerInstance() { public boolean isLazy() {
return (getAspectMetadata().getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON); return this.lazy;
} }
/** @Override
* Return the AspectJ AspectMetadata for this advisor. public synchronized boolean isAdviceInstantiated() {
*/ return (this.instantiatedAdvice != null);
public AspectMetadata getAspectMetadata() {
return this.aspectInstanceFactory.getAspectMetadata();
} }
/** /**
...@@ -145,20 +138,26 @@ class InstantiationModelAwarePointcutAdvisorImpl ...@@ -145,20 +138,26 @@ class InstantiationModelAwarePointcutAdvisorImpl
return this.instantiatedAdvice; return this.instantiatedAdvice;
} }
@Override private Advice instantiateAdvice(AspectJExpressionPointcut pcut) {
public boolean isLazy() { return this.aspectJAdvisorFactory.getAdvice(this.aspectJAdviceMethod, pcut,
return this.lazy; this.aspectInstanceFactory, this.declarationOrder, this.aspectName);
} }
/**
* This is only of interest for Spring AOP: AspectJ instantiation semantics
* are much richer. In AspectJ terminology, all a return of {@code true}
* means here is that the aspect is not a SINGLETON.
*/
@Override @Override
public synchronized boolean isAdviceInstantiated() { public boolean isPerInstance() {
return (this.instantiatedAdvice != null); return (getAspectMetadata().getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON);
} }
/**
private Advice instantiateAdvice(AspectJExpressionPointcut pcut) { * Return the AspectJ AspectMetadata for this advisor.
return this.aspectJAdvisorFactory.getAdvice(this.aspectJAdviceMethod, pcut, */
this.aspectInstanceFactory, this.declarationOrder, this.aspectName); public AspectMetadata getAspectMetadata() {
return this.aspectInstanceFactory.getAspectMetadata();
} }
public MetadataAwareAspectInstanceFactory getAspectInstanceFactory() { public MetadataAwareAspectInstanceFactory getAspectInstanceFactory() {
...@@ -213,33 +212,26 @@ class InstantiationModelAwarePointcutAdvisorImpl ...@@ -213,33 +212,26 @@ class InstantiationModelAwarePointcutAdvisorImpl
} }
else { else {
switch (aspectJAnnotation.getAnnotationType()) { switch (aspectJAnnotation.getAnnotationType()) {
case