Commit Graph

414 Commits

Author SHA1 Message Date
Sam Brannen
6fdf5ef6ee Polish contribution
See gh-24205
2019-12-13 17:14:26 +01:00
Сергей Цыпанов
d9cae339d6 Simplify AdvisedSupport.removeAdvisor()
Closes gh-24205
2019-12-13 17:12:18 +01:00
stsypanov
484006ce90 Hoist Class.getName() from String concatenation to dodge an issue related to profile pollution 2019-12-06 17:36:07 +01:00
Sam Brannen
59e250c93c Consistent use of SCOPE_PROTOTYPE and SCOPE_SINGLETON constants
Closes gh-19905
2019-11-24 13:49:43 +01:00
Sam Brannen
769a15cb82 Polishing 2019-11-18 13:01:26 +01:00
stsypanov
f2b3953d76 Use array.clone() instead of manual array creation 2019-11-13 13:53:42 +01:00
stsypanov
f5ae3c77c6 Use Method::getParameterCount where possible 2019-11-07 18:00:15 +01:00
Sam Brannen
1a13700f8b Polish contribution
See gh-23923
2019-11-06 12:57:01 +01:00
stsypanov
9da15ee23a Improve usage of String.substring()
Closes gh-23923
2019-11-06 12:57:01 +01:00
Juergen Hoeller
d00690f43f Merge branch '5.1.x'
# Conflicts:
#	build.gradle
#	spring-context/spring-context.gradle
#	spring-test/spring-test.gradle
#	spring-web/spring-web.gradle
#	spring-webflux/spring-webflux.gradle
#	spring-webmvc/spring-webmvc.gradle
2019-09-25 23:13:49 +02:00
Juergen Hoeller
357beb24bc Polishing 2019-09-25 22:15:07 +02:00
Juergen Hoeller
bd70f10d2b Merge branch '5.1.x'
# Conflicts:
#	build.gradle
#	spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
#	spring-aspects/spring-aspects.gradle
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
#	spring-beans/src/main/java/org/springframework/beans/factory/support/GenericBeanDefinition.java
#	spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
#	spring-orm/spring-orm.gradle
#	spring-test/spring-test.gradle
2019-09-25 12:43:24 +02:00
Juergen Hoeller
bb6f9bb6d4 Polishing 2019-09-25 12:14:48 +02:00
Sam Brannen
c256af4ef7 Polishing 2019-09-19 16:31:07 +02:00
Sam Brannen
d611c7484f Fix Checkstyle violation 2019-09-19 16:21:44 +02:00
Sam Brannen
9811e21432 Merge branch '5.1.x' 2019-09-19 15:57:33 +02:00
Sam Brannen
8f6846827d Ensure ClassFilter and MethodMatcher implementations are cacheable
While resolving the regression raised in gh-23571, it came to our
attention that not all of our ClassFilter and MethodMatcher
implementations were properly cacheable with CGLIB generated proxies
due to missing (or improper) equals() and hashCode() implementations.

Although such deficiencies may not manifest themselves as bugs in Core
Spring's default arrangements, these might cause issues in custom
arrangements in user applications.

This commit addresses this by ensuring that ClassFilter and
MethodMatcher implementations properly implement equals() and
hashCode(). In addition, missing toString() implementations have been
added to improve diagnostics for logging and debugging.

Closes gh-23659
2019-09-19 15:35:17 +02:00
Sam Brannen
e1e072b75c Fix memory leak regression involving @Async methods
Spring Framework 5.2 M1 introduced a memory leak for applications using
@Async methods. Specifically, in a large test suite with multiple
ApplicationContexts that were closed (e.g., via @DirtiesContext,
@MockBean, or context cache eviction), the JVM process could run out of
memory.

Underlying cause: Due to a missing equals() implementation in Spring's
new AnnotationCandidateClassFilter, CGLIB's static cache of generated
classes indirectly retained references to BeanFactory instances for the
closed ApplicationContexts for the duration of the test suite.

This commit fixes this regression by introducing a proper equals()
implementation in AnnotationCandidateClassFilter. This commit also
introduces corresponding hashCode() and toString() implementations.

Closes gh-23571
2019-09-18 14:28:54 +02:00
Sam Brannen
2e7d344930 Polish ClassFiltersTests 2019-09-18 10:25:54 +02:00
Phillip Webb
d945ae9191 Add blank line between java and javax imports
See gh-23539

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2019-09-16 13:41:59 +02:00
Phillip Webb
deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Sam Brannen
46a37b447c Fix copyright dates
See gh-23393
2019-08-27 19:30:05 +02:00
stsypanov
78d56dc61b Use Arrays.copyOf and Arrays.copyOfRange where possible
Closes gh-23393
2019-08-27 19:18:39 +02:00
Sam Brannen
1ec9721617 Fix @since tags in ScopedProxyUtils[Tests]
See gh-23514
2019-08-27 16:01:50 +02:00
Sam Brannen
9d2a874e3f Introduce getOriginalBeanName(String) in ScopedProxyUtils
This commit introduces a utility method for retrieving the original
bean name for the target of a scoped proxy.

Closes gh-23514
2019-08-27 15:46:34 +02:00
Sam Brannen
f8f3067419 Polishing 2019-08-27 12:27:18 +02:00
Sam Brannen
d357ef706f Delete unused imports
See gh-23458
2019-08-27 12:24:44 +02:00
lijuny
a0d50a546b Polish tests in spring-aop
This commit polishes tests in spring-aop by using
OrderComparator.sort() and lambda expressions instead of anonymous
classes where feasible.

Closes gh-23458
2019-08-27 12:01:30 +02:00
Sam Brannen
5105b74f6e Add missing @Nullable declaration
See gh-23514
2019-08-25 15:15:48 +02:00
Sam Brannen
9be6aa64ef Introduce getOriginalBeanName(String) in ScopedProxyUtils
This commit introduces a utility method for retrieving the original
bean name for the target of a scoped proxy.

Closes gh-23514
2019-08-25 15:13:53 +02:00
Sam Brannen
288461a541 Introduce @EnabledForTestGroups in Spring's test suite
Closes gh-23476
2019-08-17 14:47:24 +02:00
Sam Brannen
3f3e41923f Migrate rest of test suite from JUnit 4 to JUnit Jupiter
This commit migrates the rest of Spring's test suite to JUnit Jupiter,
except spring-test which will be migrated in a separate commit.

See gh-23451
2019-08-17 11:36:58 +02:00
Juergen Hoeller
9bd3a535cd Avoid UndeclaredThrowableStrategy with 1.8 bytecode level (CGLIB 3.3)
ClassLoaderAwareUndeclaredThrowableStrategy fails with a VerifyError on recent JDKs after the CGLIB 3.3 upgrade. The alternative is to replace it with a plain ClassLoaderAwareGeneratorStrategy (extracted from CglibSubclassingInstantiationStrategy) and custom UndeclaredThrowableException handling in CglibMethodInvocation.

See gh-23453
2019-08-14 00:14:14 +02:00
Сергей Цыпанов
1728bf17fc Avoid unnecessary boxing where primitives can be used
Closes gh-23267
2019-07-10 16:51:18 +02:00
Issam El-atif
57fa09b80d Fix typo
See gh-23142
2019-06-17 11:40:45 +02:00
stsypanov
49873a30c5 Simplify String concatenation 2019-06-12 17:32:35 +02:00
Sebastien Deleuze
098ac0bbb8 Annotate Object#equals parameter with @Nullable
Closes gh-23093
2019-06-06 14:18:30 +02:00
Sam Brannen
bdf3960283 Suppress warnings in Gradle build 2019-05-27 12:15:50 +02:00
Phillip Webb
9d74da006c Migrate JUnit 4 assertions to AssertJ
Migrate all existing JUnit 4 `assert...` based assertions to AssertJ
and add a checkstyle rule to ensure they don't return.

See gh-23022
2019-05-23 15:52:49 -07:00
Phillip Webb
95a9d46a87 Migrate Hamcrest assertions to AssertJ
Migrate all existing `assertThat(..., Matcher)` assertions to AssertJ
and add checkstyle rules to ensure they don't return.

See gh-23022
2019-05-23 15:49:59 -07:00
Juergen Hoeller
171e8f56a3 Merge branch '5.1.x' 2019-05-20 22:27:37 +02:00
Juergen Hoeller
75d751d968 Polishing 2019-05-20 22:19:11 +02:00
stsypanov
6f07a504b8 A couple of trivial simplifications 2019-05-20 21:41:15 +02:00
Phillip Webb
02850f357f Migrate exception checking tests to use AssertJ
Migrate tests that use `@Test(expectedException=...)` or
`try...fail...catch` to use AssertJ's `assertThatException`
instead.
2019-05-20 10:47:53 -07:00
Phillip Webb
816bbee8de Remove '.*' imports from tests
Organize test imports to expand all '.*' static imports into
fully qualified imports.

This update will allow us to use additional checkstyle rules in
the future, and will also help if we migrate fully to AssertJ.
2019-05-08 09:55:09 -07:00
Phil Webb
d7320de871 Migrate away from ExpectedException (#22922)
* Add limited checkstyles to test code

Add a limited set of checkstyle rules to the test codebase to improve
code consistency.

* Fix checksyle violations in test code

* Organize imports to fix checkstyle for test code

* Migrate to assertThatExceptionOfType

Migrate aware from ExpectedException rules to AssertJ exception
assertions. Also include a checkstyle rules to ensure that the
the ExpectedException is not accidentally used in the future.

See gh-22894
2019-05-08 16:25:52 +02:00
Sam Brannen
ccb01e663a Merge branch '5.1.x' 2019-05-07 13:03:45 +02:00
Sam Brannen
4aaec942c4 Introduce HTTPS mappings in spring.schemas files
Closes gh-22903
2019-05-07 12:56:42 +02:00
Sam Brannen
c79fdfb668 Use assertThat from Hamcrest instead of JUnit 4
org.junit.Assert.assertThat() is deprecated as of JUnit 4.13.

See gh-22894
2019-05-05 18:09:11 +02:00
Сергей Цыпанов
18af3892dd Make inner classes static where possible
Closes gh-22804
2019-04-17 19:05:24 +02:00