Commit Graph

188 Commits

Author SHA1 Message Date
Juergen Hoeller b00c31a620 Use non-lenient constructor resolution mode for @Bean methods
Since @Bean methods are never used with externally specified constructor argument values but rather just with autowiring, the non-lenient constructor resolution mode is appropriate in case of an overloaded @Bean method, not performing any type difference weight checks. This change includes a refinement of Spring's existing non-lenient constructor resolution (which needs to be explicitly turned on and is therefore not well tested), narrowing the conditions for the ambiguity check (only in case of the same number of arguments and not for overridden methods).

Issue: SPR-10988
(cherry picked from commit b093b84)
2013-11-04 16:11:04 +01:00
Juergen Hoeller 3bfddc501d Backported further GenericTypeResolver tests
Issue: SPR-11052
2013-10-31 17:39:39 +01:00
Juergen Hoeller 1ac8e48ebf Polishing (backported from several master changes) 2013-10-30 22:47:16 +01:00
Juergen Hoeller 6021822ce4 Polishing 2013-10-26 17:31:43 +02:00
Juergen Hoeller 045f78e6c5 Fixed detection of setter in case of getter with covariant return type narrowing
Issue: SPR-10995
2013-10-26 17:31:24 +02:00
Juergen Hoeller ad9049e68a Polishing 2013-10-17 22:19:17 +02:00
Juergen Hoeller b9135788b9 Fixed type prediction for generic factory methods
We're consistently resolving class names now, and the entire algorithm moved from GenericTypeResolver to the internal AutowireUtils helper in the bean factory package.

Issue: SPR-10411
(cherry picked from commit 8b1927f)
2013-10-17 21:46:59 +02:00
Phillip Webb 7500caea52 Fix ArrayStoreException reading subclassed enums
Fix ASM AnnotationAttributesReadingVisitor to correctly deal with
subclasses enums.

Issue: SPR-10914
(cherry picked from 8abe949)
2013-09-27 11:39:11 -07:00
Juergen Hoeller 9317d8f43e Polishing
(cherry picked from commit caa1218)
2013-08-29 19:21:24 +02:00
Juergen Hoeller 692908b722 Javadoc fixes
(cherry picked from commit 465e629)
2013-08-29 19:20:54 +02:00
Juergen Hoeller 610e7796d9 GenericTypeResolver properly handles bound parameterized type
Issue: SPR-10819
(cherry picked from commit ea6525f)
2013-08-20 19:41:00 +02:00
Juergen Hoeller d0948f1f03 Fixed misunderstanding with respect to excludeUnlistedClasses default in JPA 2.0
Issue: SPR-10767
2013-07-31 23:40:59 +02:00
Juergen Hoeller b40263e06b PropertySourcesPlaceholderConfigurer's "ignoreUnresolvablePlaceholders" setting reliably applies to nested placeholders as well
Issue: SPR-10549
(cherry picked from commit 127b91f)
2013-07-31 18:38:31 +02:00
Phillip Webb 4213a31a7d Fix failing test due to CUSTOM_COMPILATION Group 2013-07-30 13:54:42 -07:00
Phillip Webb 0a37552beb Add CUSTOM_COMPILATION TestGroup 2013-07-30 11:54:22 -07:00
Phillip Webb 440a63a3d0 Make TypeDescriptor serializable
Issue: SPR-10631
(cherry picked from 9eb596a)
2013-07-23 14:19:15 -07:00
Phillip Webb af7753eac6 Add MemorySafeUndeclaredThrowableStrategy
Port the latest unreleased UndeclaredThrowableStrategy implementation
from cglib to fix a memory-leak present in v3.

Issue: SPR-10709
(cherry picked from 587877c)
2013-07-19 14:39:24 -07:00
Rob Winch 404671416a Update BuildTests to verify JDK 1.6
Issue: SPR-10569
2013-05-20 10:37:33 -05:00
Phillip Webb 260eafc819 Enforce JDK version on CI server
Add a test to ensure that the CI server does not accidentally build
with the wrong JDK version.

Issue: SPR-10569
2013-05-16 17:14:03 -07:00
Juergen Hoeller 6b89af824d Consistent detection of Order annotation in superclasses and interfaces
Issue: SPR-10514
(cherry picked from commit 814d24e)
2013-05-16 18:07:00 +02:00
Juergen Hoeller 86b4b2ef23 Consistent use of Class<?> in Assert
(cherry picked from commit 16548d2)
2013-05-16 16:11:30 +02:00
Juergen Hoeller a8adec7673 Avoid unnecessary creation of default StandardEnvironment instances
Issue: SPR-10568
(cherry picked from commit 7e01578)
2013-05-15 23:59:29 +02:00
Juergen Hoeller f9db59e730 GenericTypeResolver defensively calls Class.getGenericSuperclass() and consistently uses Class<?>
Issue: SPR-10559
(cherry picked from commit 25e29b8)
2013-05-14 18:01:41 +02:00
Juergen Hoeller be224e1f30 ServletContextResourcePatternResolver uses encoded jar file location for UrlResource
Adding overloaded constructors for URI specification to UrlResource, as a convenience.

Issue: SPR-10471
(cherry picked from commit 1f0f46f)
2013-05-10 22:13:17 +02:00
Juergen Hoeller c4f2566070 Allow for building and testing the 3.2.x line against OpenJDK 8 2013-05-01 21:39:51 +02:00
Juergen Hoeller f6545cde38 Polishing 2013-04-30 23:29:06 +02:00
Juergen Hoeller 265c0c1505 Minimized ASM usage
In particular, avoid accidental usage of ASM for core JDK types - which will fail in case of a new bytecode version in the JDK, even if the application itself has been compiled with an earlier bytecode target.

Issue: SPR-10292
(cherry picked from commit d3a4068)
2013-04-30 23:29:02 +02:00
Juergen Hoeller eed1a58b81 Fixed annotation attribute processing for enum arrays
Based on https://github.com/SpringSource/spring-framework/pull/263
(cherry picked from commit 06fdfb0)
2013-04-30 23:28:57 +02:00
Sam Brannen 98074e7762 Provide support for context hierarchies in the TCF
Prior to this commit the Spring TestContext Framework supported creating
only flat, non-hierarchical contexts. There was no easy way to create
contexts with parent-child relationships.

This commit addresses this issue by introducing a new @ContextHierarchy
annotation that can be used in conjunction with @ContextConfiguration
for declaring hierarchies of application contexts, either within a
single test class or within a test class hierarchy. In addition,
@DirtiesContext now supports a new 'hierarchyMode' attribute for
controlling context cache clearing for context hierarchies.

- Introduced a new @ContextHierarchy annotation.
- Introduced 'name' attribute in @ContextConfiguration.
- Introduced 'name' property in ContextConfigurationAttributes.
- TestContext is now aware of @ContextHierarchy in addition to
  @ContextConfiguration.
- Introduced findAnnotationDeclaringClassForTypes() in AnnotationUtils.
- Introduced resolveContextHierarchyAttributes() in ContextLoaderUtils.
- Introduced buildContextHierarchyMap() in ContextLoaderUtils.
- @ContextConfiguration and @ContextHierarchy may not be used as
  top-level, class-level annotations simultaneously.
- Introduced reference to the parent configuration in
  MergedContextConfiguration and WebMergedContextConfiguration.
- Introduced overloaded buildMergedContextConfiguration() methods in
  ContextLoaderUtils in order to handle context hierarchies separately
  from conventional, non-hierarchical contexts.
- Introduced hashCode() and equals() in ContextConfigurationAttributes.
- ContextLoaderUtils ensures uniqueness of @ContextConfiguration
  elements within a single @ContextHierarchy declaration.
- Introduced CacheAwareContextLoaderDelegate that can be used for
  loading contexts with transparent support for interacting with the
  context cache -- for example, for retrieving the parent application
  context in a context hierarchy.
- TestContext now delegates to CacheAwareContextLoaderDelegate for
  loading contexts.
- Introduced getParentApplicationContext() in MergedContextConfiguration
- The loadContext(MergedContextConfiguration) methods in
  AbstractGenericContextLoader and AbstractGenericWebContextLoader now
  set the parent context as appropriate.
- Introduced 'hierarchyMode' attribute in @DirtiesContext with a
  corresponding HierarchyMode enum that defines EXHAUSTIVE and
  CURRENT_LEVEL cache removal modes.
- ContextCache now internally tracks the relationships between contexts
  that make up a context hierarchy. Furthermore, when a context is
  removed, if it is part of a context hierarchy all corresponding
  contexts will be removed from the cache according to the supplied
  HierarchyMode.
- AbstractGenericWebContextLoader will set a loaded context as the
  ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE in the MockServletContext when
  context hierarchies are used if the context has no parent or if the
  context has a parent that is not a WAC.
- Where appropriate, updated Javadoc to refer to the
  ServletTestExecutionListener, which was introduced in 3.2.0.
- Updated Javadoc to avoid and/or suppress warnings in spring-test.
- Suppressed remaining warnings in code in spring-test.

Issue: SPR-5613, SPR-9863
2013-03-07 02:11:11 +01:00
Phillip Webb 05765d7520 Replace EasyMock with Mockito
Issue: SPR-10126
2013-03-06 11:06:15 -08:00
Rossen Stoyanchev 33e723b4a8 Fix AntPathMatcher rule for combining with extensions
Before this fix AntPathMatcher had a special rule for combining
patterns with wildcards and extensions as follows:

"/*.*"  + "/*.html" => "/*.html"

This change ensures this rule never applies if the first pattern
contains URI variables.

Issue: SPR-10062
2013-03-01 16:30:02 -05:00
Sam Brannen 9b72bf4691 Update @since tag for StreamUtils 2013-02-28 01:39:15 +01:00
Chris Beams 9a48c10dcb Segregate tests that depend on the jmxmp: protocol
This commit introduces TestGroup#JMXMP and adds assumptions to related
tests accordingly. These tests require the jmxoptional_remote jar on the
classpath, and are run nightly in the SPR-PERF build.

Issue: SPR-8089
2013-02-26 16:52:29 +01:00
Chris Beams 55caf7bdb0 Improve diagnostics for invalid testGroup values 2013-02-26 16:46:13 +01:00
Phillip Webb 009d2a5efd Remove unnecessary null check in SysEnvPropSource
Remove unnecessary null check and dead code from
SystemEnvironmentPropertySource.

Issue: SPR-10318
2013-02-25 15:35:13 -08:00
Phillip Webb 9a6c6b9ee6 StringToEnumConverterFactory class from enum value
Update StringToEnumConverterFactory to search superclasses until
Class.isEnum() returns true. This allows conversion when the
enum class is obtained from the enum value:

    public static enum SubFoo {
        BAR { String s() { return "x"; } };
        abstract String s();
    }

    conversionService.convert("BAR", SubFoo.BAR.getClass())

This fix is particularly important when converting collections of
enums.

Issue: SPR-10329
2013-02-25 13:25:44 -08:00
Juergen Hoeller 5e64723e02 Catch ASM ClassReader's IllegalArgumentException and turn it into a more expressive exception, hinting at the class file version
Issue: SPR-10292
2013-02-15 18:31:22 +01:00
Phillip Webb 953b2b60ad Javadoc polish 2013-02-13 11:58:21 -08:00
Phillip Webb 6661788748 Ensure HTTP classes don't close streams
Prior to this commit several HTTP classes made use of FileCopyUtils
when reading from or writing to streams. This has the unfortunate
side effect of closing streams that should really be left open.

The problem is particularly noticeable when dealing with a
FormHttpMessageConverter that is writing a multi-part response.

Relevant HTTP classes have now been refactored to make use of a new
StreamUtils class that works in a similar way FileCopyUtils but does
not close streams.

The NonClosingOutputStream class from SimpleStreamingClientHttpRequest
has also been refactored to a StreamUtils method.

Issue: SPR-10095
2013-02-11 19:04:53 -08:00
Juergen Hoeller 93e6238f92 Polishing 2013-02-11 21:52:04 +01:00
Juergen Hoeller e9db785799 Polishing 2013-02-10 21:10:58 +01:00
Phillip Webb 7bbb4ec7af Fix Assert.instanceOf exception message
Update the exception message used when Assert.instanceOf fails such
that it expects the provided message to end with '.'. This reverts
commit 5874383ef0 which caused the
implementation to be at odds with the JavaDoc and the previous
release.

The updated code also has the benefit of protecting against a null
message.

Issue: SPR-10269
2013-02-07 13:35:31 -08:00
Phillip Webb f464a45ba4 Polish formatting
Minor formatting polish across that codebase. Primarily fixing
whitespace issues.
2013-02-04 10:35:25 -08:00
Phillip Webb aac6b913d6 Merge branch 'cleanup-3.2.x' into 3.2.x
* cleanup-3.2.x:
  Fix unnecessary @SupressWarnings annotations
  Fix Javadoc warnings
  Fix unused local variable warnings
  Fix unused type compiler warnings
  Fix 'is already an instance of type' warnings
2013-01-31 12:52:51 -08:00
Juergen Hoeller a694db2933 Removed logging from GenericTypeResolver's resolveReturnTypeForGenericMethod
GenericTypeResolver is very low-level and quite a hotspot, so let's not do any logging there and rather use the debugger instead.
2013-01-31 18:01:01 +01:00
Phillip Webb d89e30b864 Fix unnecessary @SupressWarnings annotations 2013-01-29 15:37:25 -08:00
Phillip Webb 2b0d860923 Fix Javadoc warnings 2013-01-25 17:31:33 -08:00
Phillip Webb 065b1c0e46 Fix unused local variable warnings 2013-01-25 14:35:19 -08:00
Phillip Webb 6a1e841952 Fix unused type compiler warnings 2013-01-25 14:35:07 -08:00
Chris Beams 39c00c489e Avoid UnsupportedOperationEx. with active SecurityManager
Issue: SPR-9970
2013-01-24 15:08:07 +01:00