Commit Graph

811 Commits

Author SHA1 Message Date
Juergen Hoeller 1e7d954fcb MethodMetadata exposes method return type
Issue: SPR-13024
2015-05-18 16:16:58 +02:00
Stephane Nicoll 0612bc7bc5 Harmonize default converters
Provide Converter implementations for Charset, Currency and TimeZone as
related PropertyEditors are available for those.

Issue: SPR-13020
2015-05-15 15:23:57 +02:00
Sam Brannen 477d4c5126 Document "present" terminology in AnnotationUtils
Prior to this commit, the documentation in AnnotationUtils was
inconsistent, and at times even misleading, with regard to finding
annotations that are "present" or "directly present" on annotated
elements.

This commit defines the terminology used within AnnotationUtils and
introduces the explicit notion of "meta-present" to denote that
annotations are present within annotation hierarchies above annotated
elements.

Issue: SPR-13030
2015-05-14 21:25:54 +02:00
Sam Brannen ebed52cc22 Favor local, composed annotations in AnnotatedElementUtils
This commit updates the "get semantics" search algorithm used in
`AnnotatedElementUtils` so that locally declared 'composed annotations'
are favored over inherited annotations.

Specifically, the internal `searchWithGetSemantics()` method now
searches locally declared annotations before searching inherited
annotations.

All TODOs in `AnnotatedElementUtilsTests` have been completed, and all
ignored tests have been reinstated.

Issue: SPR-11598
2015-05-13 16:06:36 +02:00
Juergen Hoeller 0711d6d0df Polishing 2015-05-13 15:04:26 +02:00
Juergen Hoeller e83d495cbb SimpleAliasRegistry prevents NPE for alias resolved to null
Issue: SPR-13016
2015-05-12 22:04:44 +02:00
Sam Brannen 52153bd454 Document search scope in Ann*[Element]Utils
This commit improves the documentation for AnnotationUtils and
AnnotatedElementUtils by explaining that the scope of most annotation
searches is limited to finding the first such annotation, resulting in
additional such annotations being silently ignored.

Issue: SPR-13015
2015-05-12 21:06:27 +02:00
Juergen Hoeller 00147379f9 Polishing
(cherry picked from commit 9e925aa)
2015-05-11 22:22:23 +02:00
Juergen Hoeller 64a01d64c5 Polishing 2015-05-11 14:42:45 +02:00
Sam Brannen fcf75c90b1 Fix broken AnnotationAttributesTests
Issue: SPR-13007
2015-05-10 13:10:04 +02:00
Philippe Marschall 994d86992c Avoid eager formatting in pre-condition checks
In general, the Spring Framework aims to construct error message
strings only if an actual error has occurred. This seems to be the
common pattern in the codebase and saves both CPU and memory. However,
there are some places where eager error message formatting occurs
unnecessarily.

This commit addresses this issue in the following classes:
AdviceModeImportSelector, AnnotationAttributes, and
ReadOnlySystemAttributesMap.

The change in ReadOnlySystemAttributesMap also avoids a potential
NullPointerException.

Issue: SPR-13007
2015-05-10 12:36:01 +02:00
Juergen Hoeller 1e046435ab AntPathMatcher actually throws IllegalArgumentException if patterns cannot be combined
Issue: SPR-12998
2015-05-09 15:29:33 +02:00
Sam Brannen 04d6afe54d Support arbitrary levels of meta-annotations in TypeDescriptor
Prior to this commit, the `getAnnotation()` method in `TypeDescriptor`
only supported a single level of meta-annotations. In other words, the
annotation hierarchy would not be exhaustively searched.

This commit provides support for arbitrary levels of meta-annotations
in `TypeDescriptor` by delegating to `AnnotationUtils.findAnnotation()`
within `TypeDescriptor.getAnnotation()`.

Issue: SPR-12793
2015-05-08 16:05:18 +02:00
Sam Brannen 5f03c97295 Polish Javadoc for MethodParameter 2015-05-08 16:03:55 +02:00
Sam Brannen 638926be4f Use JUnit ExpectedException rule in AntPathMatcherTests 2015-05-08 14:37:15 +02:00
Sam Brannen c7cdbe126d Introduce failing test case in AntPathMatcherTests
Issue: SPR-12998
2015-05-08 14:31:21 +02:00
Arjen Poutsma 76beb36e4b Remove duplicate separators when combining paths
Prior to this commit, AntPathMatcher would not correctly combine a path
that ends with a separator with a path that starts with a separator.
For example, `/foo/` + `/bar` combined into `/foo//bar`.

Specifically, this commit:

 - Removes the duplicated separator in combined paths

 - Improves RequestMappingInfo's toString() representation

 - Fixes Javadoc formatting in AntPathMatcher

 - Polishes AntPathMatcherTests

 - Polishes Javadoc in AbstractRequestCondition

Issue: SPR-12975
2015-05-08 13:49:34 +02:00
Juergen Hoeller dbd82d128d Polishing 2015-05-07 20:18:17 +02:00
Juergen Hoeller 783cb2c438 StringUtils.commaDelimitedListToSet/removeDuplicateStrings preserves original order
Issue: SPR-12003
2015-05-07 16:02:48 +02:00
Juergen Hoeller b90085500d Revert introduction of isNotEmpty aliases
Issue: SPR-12009
2015-05-07 15:54:55 +02:00
Juergen Hoeller db80378dbe Avoid infinite loop in PatternMatchUtils
Issue: SPR-12971
2015-05-07 15:41:40 +02:00
Juergen Hoeller 2c043ec9d7 Fix for ASM issue 317555
Issue: SPR-12957
2015-05-07 15:41:24 +02:00
Sam Brannen 401bcd4a8a Polish Javadoc for AnnotatedElementUtils 2015-05-07 14:01:02 +02:00
Sam Brannen 7a690df925 Remove trailing whitespace from Java source code 2015-05-06 20:08:42 +02:00
Sam Brannen 6db8f24aaf Polish AnnotatedElementUtils[Tests]
Issue: SPR-11514
2015-05-06 18:48:26 +02:00
Sam Brannen 270308dfd9 Document "get vs. find" semantics in AnnotatedElementUtils
Issue: SPR-11514
2015-05-06 18:29:26 +02:00
Sam Brannen 5c0f98aea4 Document & test AnnotatedElementUtils.getAllAnnotationAttributes
Issue: SPR-11514
2015-05-06 15:55:37 +02:00
Sam Brannen 9eb3518583 Introduce tests for AnnotatedElementUtils.isAnnotated()
Issue: SPR-11514
2015-05-06 14:07:07 +02:00
Sam Brannen e2158d75de Improve documentation of AnnotatedElementUtils.Processor
Issue: SPR-11514
2015-05-06 14:07:07 +02:00
Sam Brannen 5d67219a4e Eliminate inspection of annotations on core Java annotations
This commit picks up where SPR-11483 left off, with the goal of
eliminating all unnecessary inspection of core JDK annotations in
Spring's annotation search algorithms in AnnotatedElementUtils and
AnnotationMetadataReadingVisitor.

Issue: SPR-12989
2015-05-06 00:17:12 +02:00
Sam Brannen ba84458c65 Overhaul AnnotatedElementUtils
- Methods which search for a specific annotation now properly ensure
   that the sought annotation was actually found.

 - Both the "get" and the "find" search algorithms no longer needlessly
   traverse meta-annotation hierarchies twice.

 - Both the "get" and the "find" search algorithms now properly
   increment the metaDepth when recursively searching within the
   meta-annotation hierarchy.

 - Redesigned getMetaAnnotationTypes() so that it doesn't needlessly
   search irrelevant annotations.

 - Documented and tested hasMetaAnnotationTypes().

 - Documented isAnnotated().

Issue: SPR-11514
2015-05-05 23:35:00 +02:00
Sam Brannen efce40c391 Polish internal Javadoc for AnnotatedElementUtils
Issue: SPR-11514
2015-05-04 14:15:16 +02:00
Sam Brannen bb1886c5a8 Enable AbstractStaxHandlerTestCase to run w/o Internet connection 2015-05-02 23:23:51 +02:00
Sam Brannen e56363737b Make findAnnotationAttributes power search private 2015-05-02 10:38:31 +02:00
Sam Brannen 7ef9ac7a4d Document & test status quo for getMetaAnnotationTypes()
This commit documents the status quo for the getMetaAnnotationTypes()
method in AnnotatedElementUtils and adds appropriate regression tests to
AnnotatedElementUtilsTests.

In addition, this commit also introduces a SimpleAnnotationProcessor
base class in AnnotatedElementUtils.

Issue: SPR-11514
2015-04-26 21:13:19 +02:00
Sam Brannen 99cc7d56ff Document return values in AnnotatedElementUtils
This commit documents return values throughout AnnotatedElementUtils and
improves the documentation for the internal Processor API.

Issue: SPR-11514
2015-04-26 03:00:39 +02:00
Sam Brannen 91e46cf2ad Update TODOs in AnnotatedElementUtils[Tests]
Issue: SPR-12738
2015-04-24 23:05:29 +02:00
Sam Brannen 25187eeb0d Document AnnotatedElementUtils & assert preconditions
This commit consistently documents the 'element' and 'annotationType'
method arguments throughout AnnotatedElementUtils.

In addition, this commit introduces assertions against preconditions
for all 'element' and 'annotationType' method arguments.

Issue: SPR-11514
2015-04-24 22:36:36 +02:00
Juergen Hoeller 49f3046f66 PathMatchingResourcePatternResolver skips invalid jar classpath entries
Issue: SPR-12928
2015-04-24 17:40:13 +02:00
Stephane Maldini 74c0250525 Upgrade to Reactor 2
Issue: SPR-12599
2015-04-24 07:18:42 -04:00
Sam Brannen ad6bea1cda Support abstract, bridge, & interface methods in AnnotatedElementUtils
This commit introduces support for finding annotations on abstract,
bridge, and interface methods in AnnotatedElementUtils.

 - Introduced dedicated findAnnotationAttributes() methods in
   AnnotatedElementUtils that provide first-class support for
   processing methods, class hierarchies, interfaces, bridge methods,
   etc.

 - Introduced find/get search algorithm dichotomy in
   AnnotatedElementUtils which is visible in the public API as well as
   in the internal implementation. This was necessary in order to
   maintain backwards compatibility with the existing API (even though
   it was undocumented).

 - Reverted all recent changes made to the "get semantics" search
   algorithm in AnnotatedElementUtils in order to ensure backwards
   compatibility, and reverted recent changes to
   JtaTransactionAnnotationParser and SpringTransactionAnnotationParser
   accordingly.

 - Documented internal AnnotatedElementUtils.Processor<T> interface.

 - Enabled failing tests and introduced
   findAnnotationAttributesFromBridgeMethod() test in
   AnnotatedElementUtilsTests.

 - Refactored ApplicationListenerMethodAdapter.getCondition() and
   enabled failing test in TransactionalEventListenerTests.

 - AnnotationUtils.isInterfaceWithAnnotatedMethods() is now package
   private.

Issue: SPR-12738, SPR-11514, SPR-11598
2015-04-24 00:55:48 +02:00
Sam Brannen ececf32c05 Revert unintentional change in AnnotationUtils 2015-04-23 17:28:47 +02:00
Sam Brannen b723dcebba Polish inline documentation in AnnotatedElementUtils 2015-04-23 17:28:47 +02:00
Sam Brannen 7f0f04dfe3 Support annotations on interfaces in AnnotatedElementUtils
This commit introduces support in AnnotatedElementUtils for finding
annotations declared on interfaces at the type level.

NB: this commit does not include support for finding annotations
declared on interface methods.

In order to maintain backward compatibility with @Transactional
annotation attribute processing, a new getAnnotationAttributes() method
has been added to AnnotatedElementUtils that provides a flag to control
whether interfaces should be searched.
SpringTransactionAnnotationParser and JtaTransactionAnnotationParser
have been updated accordingly to ensure that interfaces are not
unintentionally searched in the @Transactional resolution process.

This commit also introduces additional tests and updates TODOs for
SPR-12738.

Issue: SPR-12944, SPR-12738
2015-04-23 01:33:37 +02:00
Sam Brannen 9b7fd8be4d Polish Javadoc for AnnotationUtils 2015-04-23 01:21:27 +02:00
Sam Brannen 9c6d4b7848 Assert status quo for interface support in AnnotationUtils 2015-04-23 01:19:49 +02:00
Sam Brannen b9b0b78fa1 Support n meta-annotation levels on methods in AnnotationUtils
Prior to this commit, the search algorithm used by the
findAnnotation(Method, Class) method in AnnotationUtils only found
direct annotations or direct meta-annotations (i.e., one level of
meta-annotations).

This commit reworks the search algorithm so that it supports arbitrary
levels of meta-annotations on methods. To make this possible, a new
findAnnotation(AnnotatedElement, Class) method has been introduced in
AnnotationUtils.

This fix also allows for the @Ignore'd tests in
TransactionalEventListenerTests to be re-enabled.

Issue: SPR-12941
2015-04-22 02:26:24 +02:00
Sam Brannen 666d1cecc8 Fix broken test in AnnotationUtilsTests 2015-04-21 21:06:47 +02:00
Sam Brannen 19a75f2c66 Document meta-annotation support in AnnotationUtils
Issue: SPR-12940
2015-04-21 19:54:48 +02:00
Sam Brannen ed88b7fe08 Reorganize tests in AnnotationUtilsTests for greater clarity 2015-04-21 19:54:48 +02:00
Sam Brannen dba48a1ff5 Isolate thrown exception in AssertTests 2015-04-14 20:42:23 +02:00
Sam Brannen fefbd8f85b Polish Javadoc for StringUtils and Assert 2015-04-14 20:05:56 +02:00
Sam Brannen 47f8d435e6 Introduce isNotEmpty() aliases in StringUtils
This commit introduces isNotEmpty() aliases for the existing hasLength()
methods in StringUtils.

Issue: SPR-12909
2015-04-14 20:02:18 +02:00
Arjen Poutsma b119a9c82c FutureAdapter should wrap RuntimeExceptions
RuntimeExceptions thrown from FutureAdapter.adapt() should be wrapped in
an ExecutionException, not thrown as is.

Issue: SPR-12887
2015-04-10 12:52:15 +02:00
Sam Brannen abaf81f1b5 Clean up warnings in DefaultConversionServiceTests 2015-04-07 22:40:06 -04:00
Juergen Hoeller e78b0860df AnnotatedElementUtils leniently ignores TypeNotPresentExceptions (just like AnnotationUtils)
Also refines logIntrospectionFailure to just log at debug level for meta-annotation introspection failures.

Issue: SPR-12889
2015-04-04 00:20:16 +02:00
Juergen Hoeller 514eb4281c Polishing 2015-04-01 17:23:45 +02:00
Juergen Hoeller 2c637dcb2e ReaderEditor supports Reader injection analogous to InputStreamEditor (from Spring resource location)
Also, EncodedResource implements InputStreamSource now since it declares getInputStream() anyway.

Issue: SPR-12876
2015-04-01 17:02:55 +02:00
Juergen Hoeller 1d33fd039a AnnotationUtils.getAnnotationAttributes makes Method accessible (analogous to AnnotationUtils.getValue)
Issue: SPR-12858
2015-03-31 10:28:42 +02:00
Sam Brannen 502fa1796e Polish Javadoc for ClassUtils 2015-03-30 17:34:36 +02:00
Sam Brannen a4af5b8a3e Verify which factory methods are invoked in DefaultConversionServiceTests 2015-03-30 17:34:14 +02:00
Sam Brannen bddc4373fb Refactor ObjectToObjectConverter & improve exception msg
- The exception message now mentions lacking to-Object method as well.

- Documented explicit lacking support for toString() for conversions.

- Introduced dedicated has*() methods for greater clarity and to reduce
  code duplication.

- Static factory methods (i.e., of, from, valueOf) are now supported for
  conversion to a String.
2015-03-30 17:32:59 +02:00
Sam Brannen db96113bcf Polish Javadoc for converters 2015-03-30 16:24:24 +02:00
Sam Brannen 72d7963b30 Polish ConversionService tests
- Now correctly using @Test(expected=...) where appropriate.

- Renamed DefaultConversionTests to DefaultConversionServiceTests.

- Moved all tests related to DefaultConversionService from
  GenericConversionServiceTests to DefaultConversionServiceTests.

- No longer printing to System.out.

- Removed all duplicate instantiation of conversion services.

- Now using Java 8 streams to simplify implementations of custom test
  converters. Also using streams in tests where appropriate.
2015-03-30 15:58:29 +02:00
Juergen Hoeller d23893fd25 Consistent javadoc param declarations for type variables 2015-03-25 00:44:01 +01:00
Juergen Hoeller 22670b7fad Fixed addConverterFactory assertion 2015-03-25 00:42:51 +01:00
Juergen Hoeller 09027f7972 ResolvableType.forRawClass as a straight wrapper for Class.isAssignableFrom
Issue: SPR-12846
2015-03-24 19:20:15 +01:00
Juergen Hoeller 56273a8ff3 Polishing 2015-03-21 01:19:01 +01:00
Arjen Poutsma da48739628 Support byte ranges in ResourceHttpRequestHandler
This commit introduces support for HTTP byte ranges in the
ResourceHttpRequestHandler. This support consists of a number of
changes:

- Parsing of HTTP Range headers in HttpHeaders, using a new HttpRange
  class and inner ByteRange/SuffixByteRange subclasses.
- MIME boundary generation moved from FormHttpMessageConverter to
  MimeTypeUtils.
- writePartialContent() method introduced in ResourceHttpRequestHandler,
  handling the byte range logic
- Additional partial content tests added to
  ResourceHttpRequestHandlerTests.

Issue: SPR-10805
2015-03-20 15:35:43 -04:00
Juergen Hoeller 192462902e Consistent support for Java 8 default methods (in interfaces implemented by user classes)
Covers ReflectionUtils.doWithMethods as well as affected annotation post-processors.
Includes an extension of MethodMetadata for the detection of @Bean default methods.

Issue: SPR-12822
Issue: SPR-10919
2015-03-19 16:50:15 +01:00
Juergen Hoeller 778a01943b ResolvableType-based type matching at the BeanFactory API level
Issue: SPR-12147
2015-03-18 23:05:13 +01:00
Juergen Hoeller bc6a98c144 Polishing (in particular updating javadoc references to Apache Commons) 2015-03-13 18:19:10 +01:00
Sam Brannen 08c67cf045 Polish AnnotationAwareOrderComparator 2015-03-07 22:35:49 +01:00
Sam Brannen afee546973 Delete unused method in TypeDescriptor 2015-03-07 22:27:11 +01:00
Sam Brannen d90cee78ef Remove trailing whitespace in source code 2015-03-07 21:16:18 +01:00
Juergen Hoeller ff4ac5b837 Collections.unmodifiableMultiValueMap explicitly casts to List<V> (for compatibility with JDK 9 build 53)
Issue: SPR-12549
2015-03-06 11:52:51 +01:00
Juergen Hoeller b541fc9366 Polishing 2015-03-05 18:56:57 +01:00
Juergen Hoeller 1e26d17a3d Preparations for JDK 9
Issue: SPR-12549
2015-03-05 18:56:07 +01:00
Juergen Hoeller 7e8ffc7bf5 CompositePropertySource rejects getPropertyNames call when containing a non-enumerable source
Issue: SPR-12788
2015-03-05 18:53:25 +01:00
Juergen Hoeller f786fc3226 ObjectToOptionalConverter preserves existing Optional instances
Issue: SPR-12785
2015-03-05 18:53:03 +01:00
Juergen Hoeller dcb1145354 Converter interface explicitly documents null values
Issue: SPR-12780
2015-03-05 18:52:38 +01:00
Sam Brannen 93c70b7440 Include charset in EncodedResource.equals()
Prior to this commit, the implementation of equals() in EncodedResource
was based solely on the resource and encoding. Thus, if a Charset were
specified instead of an encoding, invocations of equals() would not
work as expected.

This commit addresses this issue by including the charset in the
implementation of equals() and introducing corresponding tests in a new
EncodedResourceTests class. Furthermore, this commit makes
EncodedResource immutable and updates all Javadoc to reflect support
for the encoding and charset properties.

Issue: SPR-12767
2015-02-28 17:37:02 +01:00
Stephane Nicoll babbf6e871 Harmonize resources location
Issue: SPR-12766
2015-02-28 10:32:40 +01:00
Juergen Hoeller 540d8792fe Fixed javadoc warnings and revised FastByteArrayOutputStream code style 2015-02-27 23:49:55 +01:00
Sam Brannen fe8289b5e3 Implement description consistently across Resources
This commit ensures Resources have consistent, non-empty, meaningful
implementations for getDescription(), thus ensuring that calls to
toString() (e.g., in log statements) no longer return an empty String.

This commit also polishes the Javadoc for various Resource
implementations.
2015-02-27 21:41:37 +01:00
Sam Brannen 088238443b Polish Javadoc for ResourcePropertySource 2015-02-27 21:41:37 +01:00
Sam Brannen 228d9db4d4 Polish StreamConverter(Tests) 2015-02-27 19:27:37 +01:00
Juergen Hoeller 287045ef74 Allow for shared Objenesis caching in ObjenesisCglibAopProxy
Issue: SPR-12755
2015-02-26 18:34:52 +01:00
Juergen Hoeller cc33d3fac8 Polishing 2015-02-25 19:05:06 +01:00
Stephane Nicoll 4ca32d1ce5 polishing 2015-02-24 10:23:16 +01:00
Stephane Nicoll 018adb04f2 Add converter support for Stream
Add StreamConverter to provide full support for converting
java.util.stream.Stream instances to and from collections or arrays.

Also attempt to convert the element type if necessary.

StreamConverter is registered by default in the DefaultConversionService
as long as Java8 is available.

Issue: SPR-12175
2015-02-24 10:17:27 +01:00
Juergen Hoeller 91a0107e4a ResolvableType.getType() returns ParameterizedType when built with forClassWithGenerics
Issue: SPR-12701
2015-02-20 21:53:44 +01:00
Rossen Stoyanchev b94c6fdf7a Add tests for SPR-12738 2015-02-20 13:19:15 -05:00
Stephane Nicoll 1aec6a6cc2 Detect Order on target class as well
Previously, the `@Order` annotation was managed in an inconsistent way
when placed at the implementation level. For simple beans, it was
discovered properly but wasn't for beans requiring a proxy.

OrderComparator.SourceProvider now explicitly allows to return several
order sources; the default implementation returns not only the factory
method (if  any) but also the target class if it happens to be different
from the class of the bean.

Issue: SPR-12636
2015-02-19 09:47:20 +01:00
Juergen Hoeller 0c15a54007 Polishing 2015-02-18 16:45:16 +01:00
Juergen Hoeller 6ebac00f32 @RequestPart supports java.util.Optional
Issue: SPR-12644
2015-02-18 16:17:07 +01:00
Sam Brannen add718d75c Polish EnumerablePropertySource 2015-02-16 20:26:49 +01:00
Juergen Hoeller f58abd3d9a Polishing (forward-ported from 4.1.x) 2015-02-10 23:04:12 +01:00
Juergen Hoeller 058714b03a Polishing 2015-02-10 19:30:59 +01:00
Sam Brannen 6e10f7c8cf Update TODOs for SPR-11598 2015-01-24 18:01:43 +01:00
Sam Brannen e97712b95b Update copyright headers in IdGenerators 2015-01-23 21:12:45 +01:00
Rossen Stoyanchev 52b8f34468 Add JdkIdGenerator and use it in SockJS client
Issue: SPR-12658
2015-01-22 21:27:36 -05:00
Juergen Hoeller 0ddf8dde12 AnnotationUtils explicitly handles null parameters
Issue: SPR-12604
2015-01-20 16:01:44 +01:00
Craig Andrews 213a3fd779 Performance improvements in ShallowEtagHeaderFilter
Prior to this change, the ShallowEtagHeaderFilter would use a
ResizableByteArrayOutputStream to internally write data and calculate
the ETag. While that implementation is faster than the regular
ByteArrayOutputStream (since it has a better strategy for growing the
internal buffer), a lot of buffer copying/writing still happens.

This change adds a new FastByteArrayOutputStream implementation that
internally uses a LinkedList<Byte[]> to store the content. So when
writing bytes to that OutputStream implementation, new byte[] are
added to the list when the previous ones are full. This saves most
of the instantiating/copying operations.

Note that new methods were added in DigestUtils to allow usage of
Streams instead of byte[], which is more efficient in our case.

Fixes #653

Issue: SPR-12081
2015-01-08 16:08:09 +01:00
Sam Brannen 40cd1be14c Update Javadoc for AnnotationUtils.findAnnotation()
This commit updates the Javadoc for findAnnotation() to reflect recent
changes to the algorithm it implements.
2015-01-07 21:08:00 +01:00
John 46b094bfc4 Fix typo 2015-01-07 00:28:51 -05:00
Sam Brannen 4a49a6535d Document type safety limitations of the CollectionFactory API
Issue: SPR-12596
2015-01-04 22:48:15 +01:00
Juergen Hoeller ec84fa6da3 ObjectToOptionalConverter uses Optional.ofNullable after ConversionService invocation
Issue: SPR-12589
2015-01-02 14:57:42 +01:00
Juergen Hoeller 9ac02b319d Remove pre-3.2 deprecated classes and methods
Issue: SPR-12578
2014-12-30 20:05:15 +01:00
Juergen Hoeller 86b8112c90 Polishing 2014-12-29 15:13:40 +01:00
Juergen Hoeller dfdfc03ff3 Polishing 2014-12-22 20:02:25 +01:00
Sam Brannen c62fbea2ba Demonstrate that the CollectionFactory API is not type-safe
This commit introduces test methods in CollectionFactoryTests that
demonstrate how the APIs for createCollection() and createMap() are not
type-safe, specifically regarding the use of generics, raw types, and
casting.
2014-12-11 15:55:41 +01:00
Sam Brannen aec284a4ca Create empty EnumSets & EnumMaps in CollectionFactory
SPR-12483 introduced automatic type conversion support for EnumSet and
EnumMap. However, the corresponding changes in CollectionFactory
contradict the existing contract for the "create approximate" methods
by creating a copy of the supplied set or map, thereby potentially
including elements in the returned collection when the returned
collection should in fact be empty.

This commit addresses this issue by ensuring that the collections
returned by createApproximateCollection() and createApproximateMap()
are always empty.

Furthermore, this commit improves the Javadoc throughout the
CollectionFactory class.

Issue: SPR-12533
2014-12-10 22:59:00 +01:00
Sam Brannen fb426fe611 Demonstrate that the CollectionFactory API is not type-safe
This commit introduces test methods in CollectionFactoryTests that
demonstrate how the APIs for createApproximateCollection() and
createApproximateMap() are not type-safe, specifically regarding the use
of generics, raw types, and casting.
2014-12-10 17:36:01 +01:00
Sam Brannen 978b8c81e5 Cover maps & more collections in CollectionFactoryTests 2014-12-10 16:44:52 +01:00
Sam Brannen 86f99ec8f7 Improve error handling in CollectionFactory
This commit improves error handling in CollectionFactory by asserting
preconditions.

In addition, this commit introduces ConnectionFactoryTests.
2014-12-10 14:47:15 +01:00
Sam Brannen 5aaed147d5 Use public AssumptionViolatedException in Assume
JUnit 4.12 created a 'public' version of the previously 'internal'
AssumptionViolatedException.

This commit upgrades Spring's Assume class to use this new public
version.
2014-12-10 00:29:52 +01:00
Sam Brannen d8ef666764 Suppress "rawtypes" warnings in CollectionFactory
This commit also adds links to the newly created Eclipse bug that was
raised for this issue.
2014-12-09 21:29:05 +01:00
Sam Brannen fe78900524 Work-around for Eclipse bug regarding EnumSets
This commit introduces superfluous casts in CollectionFactory to
address a bug in Eclipse 4.4.1 that prevents the code from compiling
within Eclipse. Specifically, without these casts Eclipse displays the
following error for use of the EnumSet.copyOf() and EnumSet.noneOf()
methods:

Type mismatch: cannot convert from EnumSet<Enum<Enum<E>>> to
Collection<E>
2014-12-09 20:54:36 +01:00
Juergen Hoeller bb1d1e916e Polishing 2014-12-07 20:52:18 +01:00
Juergen Hoeller 5018889d78 AnnotationAttributesReadingVisitor defensively handles meta-annotation retrieval failure
Issue: SPR-12493
2014-12-02 15:12:23 +01:00
Juergen Hoeller c94d584f37 OrderUtils defensively checks for presence of javax.annotation.Priority
Issue: SPR-12489
2014-12-01 18:08:11 +01:00
Juergen Hoeller efb114d49a Polishing 2014-11-29 20:49:21 +01:00
Juergen Hoeller bfbd25a0e9 BeanWrapper auto-growing support for EnumSet / EnumMap
Issue: SPR-12483
2014-11-29 20:49:06 +01:00
Juergen Hoeller 7635e7b7f2 Polishing
Issue: SPR-12483
2014-11-28 20:32:35 +01:00
Juergen Hoeller fef4cd0ed6 Default conversion support for EnumSet / EnumMap
Issue: SPR-12483
2014-11-28 20:30:46 +01:00
Juergen Hoeller f44217a0c2 Clarified getAllAnnotationAttributes behavior
Issue: SPR-12473
(cherry picked from commit 5ac8680)
2014-11-26 16:14:41 +01:00
Juergen Hoeller ab5856b6a8 Tracking ASM 5.0.4 development: Fix for ASM issue 317545
Issue: SPR-12470
2014-11-26 11:42:30 +01:00
Juergen Hoeller 223d849a14 Polishing 2014-11-23 00:12:02 +01:00
Juergen Hoeller 7fcadaa393 MethodParameter generally uses volatile variables where applicable now (as well as a local copy of the parameterNameDiscoverer field)
Issue: SPR-12453
2014-11-22 16:45:26 +01:00
Juergen Hoeller 1ef06cc743 MutablePropertySources uses an internal CopyOnWriteArrayList for defensiveness against concurrent modifications
Issue: SPR-12428
2014-11-22 16:12:28 +01:00
Chris Beams dff48ad8dd Allow non-String args in JOptCommandLinePropertySource
Prior to this commit, JOptCommandLinePropertySource prevented the
possibility of non-String option arguments. This effectively prevents
the use of JOpt's #ofType support (which allows specifying custom
argument types).

Now, non-String arguments are detected and converted to strings as
necessary. JOpt's #ofType now works as expected. A test has been added
to cover this case.
2014-11-20 12:03:29 +01:00
Juergen Hoeller 285dca027b Polishing
(cherry picked from commit acefd83)
2014-11-02 11:48:09 +01:00
Juergen Hoeller 1146d5ba1d Polishing 2014-10-29 22:44:59 +01:00
Juergen Hoeller 725ad0df50 SimpleMetadataReaderFactory is capable of resolving inner class names with dot syntax now (analogous to ClassUtils.forName)
Issue: SPR-12390
2014-10-29 22:03:01 +01:00
Juergen Hoeller b70c5d1ff1 Normalized AnnotationAttributesReadingVisitor class layout and improved diagnostics through delegating to AnnotationUtils
Issue: SPR-12387
2014-10-28 19:08:45 +01:00
Juergen Hoeller 06632822e9 Log4jConfigurer initLogging(location) throws FileNotFoundException for file URL as well
Issue: SPR-9725
2014-10-28 16:18:55 +01:00
Juergen Hoeller cb095132b1 Defensive String equals comparison in ClassReader
Issue: SPR-12382
2014-10-28 13:23:55 +01:00
Juergen Hoeller b16048b061 ClassReader relies on autoboxing for reuse of cached primitive values
Issue: SPR-12365
2014-10-23 14:24:59 +02:00
Juergen Hoeller 2956049c30 Polishing 2014-10-22 17:04:50 +02:00
Juergen Hoeller 2b6f841b03 OrderUtils.getPriority uses AnnotationUtils.findAnnotation for consistent lookup rules and diagnostics
Issue: SPR-12357
2014-10-21 12:27:14 +02:00
Juergen Hoeller 47dde91763 Consistent use of logIntrospectionFailure
Issue: SPR-12325
2014-10-21 12:16:51 +02:00
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Juergen Hoeller 716916b281 AnnotationUtils favors local composed annotations over interface annotations and consistently logs introspection failures via lazily initialized logger
Issue: SPR-12355
Issue: SPR-12325
Issue: SPR-12329
2014-10-20 21:47:47 +02:00
Juergen Hoeller c7e7d11156 Polishing 2014-10-14 14:27:03 +02:00
Juergen Hoeller 70fec47944 Provider declaration for @Value method argument works again
Issue: SPR-12297
2014-10-06 18:08:19 +02:00
Juergen Hoeller 9d969587ab CompositePropertySource extends EnumerablePropertySource now
Issue: SPR-12292
2014-10-02 20:19:32 +02:00
Juergen Hoeller 05c995cfb3 DecoratingClassLoader and its subclasses register themselves as parallel capable on Java 7+
Issue: SPR-12285
2014-10-02 14:33:13 +02:00
Juergen Hoeller 7d307b3853 Polishing 2014-09-30 20:17:58 +02:00
Stephane Nicoll 6f1acdd561 Optimize ResolvableType cache
Prior to this commit, the ResolvableType static cache was holding a lot
of duplicates for simple types. We are using too much metadata to compute
the key when the class has no generic information. so setFoo(String foo)
and setBar(String bar) would result in two entries in the cache because
the TypeProvider is different. On a very simple application 65% of the
entries in the cache were duplicate.

When the type is a Class with no generic information, the ResolvableType
instance is a simple wrapper around it so we might just as well not cache
it at all as the cost of finding it back from the cache is higher than
creating that simple wrapper.

This commit adds an explicit check; if the type is a simple Class we just
return a "resolved" ResolvableType instance for it. On a few test cases,
this reduces the size of the cache by 85%

Issue: SPR-12275
2014-09-30 18:01:40 +02:00
Brian Clozel d293889bb3 Fix invalid PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
Prior to this commit, `AntPathMatcher.extractPathWithinPattern` would
not process correctly `**` patterns and would only match *one* path
segment in the given path.

This commit changes `extractPathWithinPattern` to allow multiple path
segments to be matched against a single `**` pattern segment.

Issue: SPR-10515
2014-09-30 15:32:46 +02:00
Sam Brannen a6c2d4595b Polish Javadoc for BackOff implementations 2014-09-28 15:26:30 +02:00
Juergen Hoeller e8486e2afe Tracking ASM 5.0.4 development: Fix for ASM issue 317539
Issue: SPR-12255
2014-09-26 16:07:01 +02:00
Juergen Hoeller 1f3e195dac Polishing 2014-09-25 17:00:45 +02:00
Juergen Hoeller 587a81617c SystemEnvironmentPropertySource uses actual SecurityManager check and direct keySet access
Issue: SPR-12224
2014-09-24 17:56:38 +02:00
Juergen Hoeller 1936dee991 Replaced postProcessFindAllClassPathResourcesResult with doFindAllClassPathResources
Issue: SPR-12231
2014-09-22 17:31:03 +02:00
Sam Brannen f27c7df004 Avoid Gradle compiler warnings 2014-09-21 21:23:54 +02:00
Phillip Webb 1947de3334 Provide subclass hooks in path matching resolver
Update PathMatchingResourcePatternResolver to include additional
protected methods that can be used by subclasses to optimize which
JARs are searched.

Issue: SPR-12231
2014-09-21 10:56:24 -07:00
Phillip Webb c41ea96177 Optimize ReflectionUtils.isCglibRenamedMethod
Optimize ReflectionUtils.isCglibRenamedMethod by removing the regular
expression.

Issue: SPR-12227
2014-09-20 00:23:58 -07:00
Phillip Webb 752574de1d Optimize SystemEnvPropertySource when possible
Update SystemEnvironmentPropertySource to attempt optimized Map lookups
first, and only fall-back to the defensive SecurityManager safe-mode
if these fail.

Issue: SPR-12224
2014-09-20 00:17:10 -07:00
Juergen Hoeller 1884d18183 Polishing 2014-09-20 01:04:05 +02:00
Juergen Hoeller 16325c2eaa Polishing 2014-09-20 00:29:16 +02:00
Juergen Hoeller 65cc57dabb SystemEnvironmentPropertySource uses regular property names check instead of optimized Map lookup (for defensiveness in SecurityManager scenarios)
Issue: SPR-12224
2014-09-20 00:26:37 +02:00
Phillip Webb e71fbb9f46 Implement containsProperty on MapPropertySource
Improve the performance of MapPropertySource by directly implementing
the containsProperty property.

Issue: SPR-12224
2014-09-18 23:17:13 -07:00
Juergen Hoeller 15320db414 Polishing 2014-09-17 02:35:41 +02:00
Juergen Hoeller 9b2da37f79 GenericConversionService detects enum subclasses as well
Issue: SPR-12181
2014-09-12 17:23:51 +02:00
Juergen Hoeller 553930a9f0 CompositePropertySource allows for access to its nested property sources
Issue: SPR-12182
2014-09-12 16:51:49 +02:00
Juergen Hoeller 1e7bfd91a7 Polishing 2014-09-10 01:28:54 +02:00
Sam Brannen 559e81bec7 Make SocketUtils a concrete class
Per the Javadoc for the SocketUtils() constructor, SocketUtils can be
instantiated as a Spring Bean in XML configuration files; however,
SocketUtils is currently abstract which prevents such usage.

This commit removes the 'abstract' declaration thereby allowing
SocketUtils to be instantiated as a Spring bean.

Issue: SPR-12169
2014-09-09 16:08:27 -05:00
Juergen Hoeller 86b7118da8 Polishing 2014-09-04 02:30:25 +02:00
Juergen Hoeller 20c2ba35dc Polishing 2014-09-04 00:55:38 +02:00
Juergen Hoeller c6d29f1a31 Refactored support for @Order on @Bean methods as well as @Priority handling
Issue: SPR-11310
Issue: SPR-10548
2014-09-04 00:41:13 +02:00
Sebastien Deleuze 7ea69fb96c Improve ResolvableType.hashCode() for better performance
Prior to this commit, when there was a lot of entries in the
ResolvableType.cache HashMap, getting a simple value could
take a lot of time due to a lot of calls to ResolvableType.equals().
ResolvableType.equals() used this.type, getSource(),
this.variableResolver.getSource() and this.componentType, but
ResolvableType.hashCode() used only this.type.

With this commit, ResolvableType.hashCode() now uses the same
fields than ResolvableType.equals().

Performance on the spring-resolvabletype-benchmark project:
 - 8000 us before this commit
 - 120 us with this commit

Issue: SPR-12122
2014-08-27 10:35:22 +02:00
Juergen Hoeller 9dfbc5326b Revised ResourcePropertySource in order to avoid ConfigurationClassProcessor's AnnotationPropertySource subclass
Issue: SPR-12115
2014-08-22 13:54:39 +02:00
Phillip Webb 5ba3db6a7d Fix failing CompositePropertySourceTests
Fix CompositePropertySourceTests which fails when run we debug logging.
2014-08-21 21:57:22 -07:00
Phillip Webb 84564a0c7b Rework @PropertySource early parsing logic
Rework the @PropertySource parsing logic recently changed in commit
7c608886 to deal with the same source appearing on a @Configuration
class and an @Import class.

Processing now occurs in a single sweep, with any previously added
sources being converted to a CompositePropertySource.

Issue: SPR-12115
2014-08-21 21:21:15 -07:00
Juergen Hoeller b73c531527 PropertySource implementations perform conversion to String arrays via StringUtils (getting rid of EMPTY_NAMES_ARRAY) 2014-08-21 22:46:33 +02:00
Juergen Hoeller 60e58a2012 Polishing 2014-08-21 14:29:14 +02:00
Juergen Hoeller 8c76381d95 PathMatchingResourcePatternResolver supports "classpath*" searches in jar file roots as well
Issue: SPR-12095
2014-08-19 20:34:45 +02:00
Sam Brannen 0dba70fe15 Merge pull request #625 from eujungkim/spr-warning
Clean up warnings in CompoundComparator
2014-08-18 10:16:26 +02:00
eujung kim c315adf72d Remove unnecessary @SupressWarnings. 2014-08-18 17:03:03 +09:00
Sam Brannen 1a88007688 Improve documentation of SpringFactoriesLoader 2014-08-16 17:07:30 +02:00
Juergen Hoeller 69587f3fa4 Polishing 2014-08-14 23:49:29 +02:00
Sam Brannen e6d16148e5 Support automatic discovery of default TELs
Prior to this commit, there was no declarative mechanism for a custom
TestExecutionListener to be registered as a default
TestExecutionListener.

This commit introduces support for discovering default
TestExecutionListener implementations via the SpringFactoriesLoader
mechanism. Specifically, the spring-test module declares all core
default TestExecutionListeners under the
org.springframework.test.context.TestExecutionListener key in its
META-INF/spring.factories properties file, and third-party frameworks
and developers can contribute to the list of default
TestExecutionListeners in the same manner.

 - AbstractTestContextBootstrapper uses the SpringFactoriesLoader to
   look up the class names of all registered default
   TestExecutionListeners and sorts the instantiated listeners using
   AnnotationAwareOrderComparator.

 - DefaultTestContextBootstrapper and WebTestContextBootstrapper now
   rely on the SpringFactoriesLoader mechanism for finding default
   TestExecutionListeners instead of hard coding fully qualified class
   names.

 - To ensure that default TestExecutionListeners are registered in the
   correct order, each can implement Ordered or declare @Order.

 - AbstractTestExecutionListener and all default TestExecutionListeners
   provided by Spring now implement Ordered with appropriate values.

 - Introduced "copy constructors" in MergedContextConfiguration and
   WebMergedContextConfiguration

 - SpringFactoriesLoader now uses AnnotationAwareOrderComparator
   instead of OrderComparator.

Issue: SPR-11466
2014-08-14 22:29:21 +02:00
Juergen Hoeller 8dbfa80b13 Unit test for circular reference in default profile property, plus related polishing
Issue: SPR-12078
2014-08-12 19:23:36 +02:00
Juergen Hoeller ef51d4dbdb AnnotatedElementUtils adapts post-processed values to AnnotationAttributes as well
Issue: SPR-12065
2014-08-08 15:15:29 +02:00
Sebastien Deleuze 3922f6fc53 Update references to RFC 2616
Replace references to the old RFC 2616 (HTTP 1.1) with references
to the new RFCs 7230 to 7235.

This commit also deprecates:
 - HttpStatus.USE_PROXY
 - HttpStatus.REQUEST_ENTITY_TOO_LARGE in favor of HttpStatus.PAYLOAD_TOO_LARGE
 - HttpStatus.REQUEST_URI_TOO_LONG in favor of HttpStatus.URI_TOO_LONG

Issue: SPR-12067
2014-08-07 14:50:45 +02:00
David Haraburda d0e6f0f73f Change GenericConversionService to better handle enum
Prior to this commit, given an enum which implements some interface,
GenericConversionService would select the String -> Enum converter even
if a converter for String -> SomeInterface was registered.  This also
affected converters that were registered for String ->
SomeBaseInterface, when SomeInterface extended SomeBaseInterface.

This change modifies the behavior of the private method
getClassHierarchy() by placing Enum.class as late as possible, pretty
much the same way as Object.class is handled.

Issue: SPR-12050
2014-08-06 10:42:28 +02:00
Sam Brannen 6cfe76eeec Polish Javadoc for MutablePropertySources 2014-08-02 12:17:57 +03:00
Sam Brannen 154cf5dc7e Polish Javadoc for AnnotationCacheKey 2014-08-02 12:17:15 +03:00
Juergen Hoeller 8f484d382e Polishing 2014-07-29 11:42:37 +02:00
Juergen Hoeller 8cc0fa5ae1 Polishing 2014-07-28 22:05:40 +02:00
Juergen Hoeller a3163ceb88 AbstractTypeHierarchyTraversingFilter leniently ignores non-loadable super classes and interfaces
Issue: SPR-12042
2014-07-28 22:05:20 +02:00
Juergen Hoeller 0ce90f1d16 TypeDescriptor's getResolvableType() and getSource() are @since 4.0 2014-07-24 12:13:37 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Juergen Hoeller 48fea0bafa ClassUtils.isCacheSafe defensively catches SecurityException (for Google App Engine compatibility)
Issue: SPR-12002
2014-07-16 20:33:36 +02:00
Juergen Hoeller 4e25a14f6c Merge pull request #571 from sdeleuze/SPR-11820
Make ListenableFuture compliant with Java 8 lambda
2014-07-16 16:41:41 +02:00
Sebastien Deleuze 86e8bdab6b Make ListenableFuture compliant with Java 8 lambda
Make it possible to use a ListenableFuture with Java 8
lambda expressions, using a syntax like
listenableFuture.addCallback(() -> ..., () -> ...);

Issue: SPR-11820
2014-07-16 16:06:24 +02:00
Arjen Poutsma d6950d8add StaxStreamXMLReader ignores significant whitespace
The StaxStreamXMLReader no longer handles all whitespace as ignorable
whitespace.

Issue: SPR-12000
2014-07-16 13:16:20 +02:00
Juergen Hoeller c18b6bf0b7 NestedIOException can use IOException constructor with cause argument on JDK 6+ 2014-07-15 22:05:45 +02:00