Compare commits

..

155 Commits

Author SHA1 Message Date
Spring Buildmaster 8a4b36479a Release version 4.0.0.RC2 2013-12-03 14:45:38 -08:00
Phillip Webb 85b0bfff58 Only consider "is" methods with boolean returns
Fix regression introduced in b25e91a5 where ReflectivePropertyAccessor
does not consider the return type for "is" getters.

Issue: SPR-11142
2013-12-03 12:01:24 -08:00
Rossen Stoyanchev 8f569264da Fix issue in GlassfishRequestUpgradeStrategy
The observed behavior was that the client does not get a response from
the WebSocket HTTP handshake. On the server the handshake actually
succeeds, the response is set correctly to status 101, and the
WebSocketHandler gets notified of the successfully established
connection.

This change flushes the ServletResponse just before returning from the
GlassfishRequestUpgradeStrategy. This is actually what Glassfish's own
TyrusServletFilter does as well at the end along with a comment that it
is a possible bug.
2013-12-03 14:42:55 -05:00
Brian Clozel 3ac14e7cd8 Document websocket XML namespace
Issue: SPR-11063
2013-12-03 18:15:21 +01:00
Rossen Stoyanchev 14468e80f3 Add principal in GlassfishRequestUpgradeStrategy 2013-12-03 12:02:41 -05:00
Phillip Webb b1485420b6 Use port scanning for JMX tests
Attempt to fix performance build by scanning for a free JMX port.
2013-12-03 08:22:25 -08:00
Juergen Hoeller 1dff45c38a Consistent ".jetty" and ".standard" subpackages; consolidated GlassFishRequestUpgradeStrategy implementation; renamed Text/BinaryWebSocketHandler and moved them to web.socket.support 2013-12-03 17:18:24 +01:00
Rossen Stoyanchev 7713a55f6b Add test case for multivalue x-forwarded host header
Issue: SPR-11140
2013-12-03 09:24:40 -05:00
Phillip Webb d4245610a2 Fix performance test HSQLDB error
Fix QuartzSupportTests that has been failing since the HSQLDB upgrade.
2013-12-02 23:59:32 -08:00
Phillip Webb 526555de85 Tweak times in TimedSpringRunnerTests 2013-12-02 22:47:01 -08:00
Phillip Webb c2b56c07e5 Cache property TypeDescriptors
Attempt to improve performance by caching TypeDescriptors against bean
PropertyDescriptors in CachedIntrospectionResults.

This change is an attempt to fix the failing performance test case
`testPrototypeCreationWithOverriddenResourcePropertiesIsFastEnough` in
`AnnotationProcessorPerformanceTests`.
2013-12-02 21:55:00 -08:00
Phillip Webb fd1b48139f Polish 2013-12-02 21:35:13 -08:00
Rossen Stoyanchev bb5a53f7f7 Update websocket xml namespace attributes 2013-12-02 21:55:44 -05:00
Rossen Stoyanchev cea049b791 Move websocket config tests to annotation package 2013-12-02 21:32:06 -05:00
Phillip Webb cb46ef86c6 Fix test following ResolvableType hashcode change 2013-12-02 16:55:24 -08:00
Juergen Hoeller 6c1f62b19d EhCacheFactoryBean calls CacheManager.addCache before setStatisticsEnabled
Issue: SPR-11080
Issue: SPR-11092
(cherry picked from commit 6ce2eb9)
2013-12-03 01:37:24 +01:00
Juergen Hoeller f5a310ad57 Polishing (backported from 3.2.x) 2013-12-03 01:37:01 +01:00
Juergen Hoeller 2a52decbbc Polishing (including removal of javadoc imports that show as package cycles in IntelliJ) 2013-12-02 23:57:00 +01:00
Juergen Hoeller 41332728f9 Use AnnotationTransactionAttributeSource class name to avoid hard dependency on transaction.annotation package 2013-12-02 23:55:41 +01:00
Juergen Hoeller e62cd84ca2 Merged web.socket.messaging.config into web.socket.config and introduced web.socket.config.annotation 2013-12-02 23:54:38 +01:00
Phillip Webb ab2949f2b7 Fix ResolvableType hashCode generation
Fix ResolvableType.hashCode() to use the source of the variable
resolver, rather than the resolver itself.
2013-12-02 14:47:44 -08:00
Rossen Stoyanchev 69238ba66f Move WebSocketExtension to top-level package 2013-12-02 16:53:11 -05:00
Juergen Hoeller e3e1c1bcec Rearranged web.socket.server subpackages and introduced web.socket.config 2013-12-02 22:32:32 +01:00
Juergen Hoeller eb8b5c435c Polishing 2013-12-02 22:32:31 +01:00
Phillip Webb 5e02a6dda3 Fix casing in spring mvc namespace attributes
Update "enableMatrixVariables" and "ignoreDefaultModelOnRedirect" to
use the more conventional XML form "enable-matrix-variables" and
"ignore-default-model-on-redirect".

Both forms are now supported by `AnnotationDrivenBeanDefinitionParser`,
with newer names being defined in the 4.0 XSD and the older names
remaining in the 3.2 XSD.

Issue: SPR-11136
2013-12-02 12:28:56 -08:00
Rossen Stoyanchev 47ef45d152 Polish websocket xml namespace
Issue: SPR-11063
2013-12-02 15:25:49 -05:00
Phillip Webb 92e144a8a8 Add a 'bill of materials' project for Maven users
Add 'spring-framework-bom' meta-project that contains the other projects
in a dependencyManagement section.

Issue: SPR-11138
2013-12-02 11:55:22 -08:00
Rossen Stoyanchev 079fb2db73 Add assert AbstractStandardRequestUpgradeStrategy 2013-12-02 13:59:17 -05:00
Brian Clozel 10f5d96a78 Add XML namespace for WebSocket config
This commit adds an XML namespace equivalent of @EnableWebSocket and
@EnableWebSocketMessageBroker. Those are <websocket:handlers> and
<websocket:message-broker> respectively.

Examples can be found in the test suite.

This commit also alters the way MessageHandler's subscribe to their
respective MessageChannel's of interest. Rather than performing the
subscriptions in configuration code, the message channels are now
passed into MessageHandler's so they can subscribe themselves on
startup.

Issue: SPR-11063
2013-12-02 12:18:33 -05:00
Juergen Hoeller 8f1fefc159 Fixed javadoc 2013-12-02 14:55:56 +01:00
Juergen Hoeller 3e4b3cad6a Always preserve target class for configuration classes in case of auto-proxying
Issue: SPR-10561
2013-12-02 14:42:17 +01:00
Juergen Hoeller 8958912c94 Extended testPrototypeCreationWithOverriddenAutowiredPropertiesIsFastEnough's deadline (since that test repeatedly failed on the CI server) 2013-12-02 13:15:27 +01:00
Juergen Hoeller 676ad125a1 Reverted arrayToList signature to return plain List
This is necessary for source compatibility with existing callers, such as code found in Spring Integration: e.g. passing the arrayToList result into a typed HashSet constructor.
2013-12-02 13:10:41 +01:00
Juergen Hoeller bd8469990d Detect depends-on cycles and throw proper exception
Issue: SPR-7966
2013-12-02 12:39:37 +01:00
Juergen Hoeller de890fd100 Synchronized cache creation on CacheManager
Issue: SPR-11132
2013-12-02 11:02:07 +01:00
Juergen Hoeller ce917d5cbb Polishing around @EnableTransactionManagement
Issue: SPR-10864
2013-12-02 11:00:26 +01:00
Juergen Hoeller e8dead247c @EnableTransactionManagement and co get detected on superclasses as well
Issue: SPR-10864
2013-12-02 10:59:30 +01:00
Phillip Webb b0b40dade1 Detect cache hit with multiple @Cachables
Fix CacheAspectSupport to consider a cache hit from any of the multiple
@Cachables that may have been specified using the @Caching annotation.

Prior to this commit the following scenario would never produce a hit:

	@Caching(cacheable = {
		@Cacheable(value = "c1", unless = "#result.size() < 4"),
		@Cacheable(value = "c2", unless = "#result.size() > 3")
	})

Issue: SPR-11124
2013-11-26 17:13:15 -08:00
Phillip Webb 043a41e382 Consistent whitespace after imports
Update code to have a consistent number of new-line characters after
import statements.
2013-11-26 15:14:43 -08:00
Phillip Webb 15698860e1 General polish of new 4.0 classes
Apply consistent styling to new classes introduced in Spring 4.0.

- Javadoc line wrapping, whitespace and formatting
- General code whitespace
- Consistent Assert.notNull messages
2013-11-26 15:11:18 -08:00
Rossen Stoyanchev 690051f46c Add ability to customize message channels
@EnableWebSocketMessageBroker message channel configuration can now be
customized via WebSocketMessageBrokerConfigurer. It is necessary to
make this easy and even required as part of the basic configuration
since by default the message channels are backed by a thread pool of
size 1, not suitable for production use.

Issue: SPR-11023
2013-11-26 16:51:14 -05:00
Rossen Stoyanchev e764c8d897 Fix synchronization issue in StompSubProtocolHandler
Two concurrent threads should not send a message on a single WebSocket
session at the same time, for example see:
http://docs.oracle.com/javaee/7/api/javax/websocket/RemoteEndpoint.Basic.html

In StompSubProtocolHandler it is quite possible that multiple messages
may be broadcast to a single WebSocket client concurrently.

This change adds synchronization around the sending of a message to a
specific cilent session.

Issue: SPR-11023
2013-11-26 16:51:14 -05:00
Phillip Webb a31ac882c5 Fix various javadoc warnings 2013-11-26 13:25:37 -08:00
Sam Brannen c7c395d0d0 Merge pull request #421 from sbrannen/SPR-11038
* SPR-11038:
  Support meta-annotation attr overrides in the TCF
2013-11-26 15:59:00 -05:00
Sam Brannen 64f593db8f Support meta-annotation attr overrides in the TCF
Prior to this commit, the Spring TestContext Framework (TCF) supported
the use of test-related annotations as meta-annotations for composing
custom test stereotype annotations; however, attributes in custom
stereotypes could not be used to override meta-annotation attributes.

This commit addresses this by allowing attributes from the following
annotations (when used as meta-annotations) to be overridden in custom
stereotypes.

- @ContextConfiguration
- @ActiveProfiles
- @DirtiesContext
- @TransactionConfiguration
- @Timed
- @TestExecutionListeners

This support depends on functionality provided by
AnnotatedElementUtils. See the 'Notes' below for further details and
ramifications.

Notes:

- AnnotatedElementUtils does not support overrides for the 'value'
  attribute of an annotation. It is therefore not possible or not
  feasible to support meta-annotation attribute overrides for some
  test-related annotations.
- @ContextHierarchy, @WebAppConfiguration, @Rollback, @Repeat, and
  @ProfileValueSourceConfiguration define single 'value' attributes
  which cannot be overridden via Spring's meta-annotation attribute
  support.
- Although @IfProfileValue has 'values' and 'name' attributes, the
  typical usage scenario involves the 'value' attribute which is not
  supported for meta-annotation attribute overrides. Furthermore,
  'name' and 'values' are so generic that it is deemed unfeasible to
  provide meta-annotation attribute override support for these.
- @BeforeTransaction and @AfterTransaction do not define any attributes
  that can be overridden.
- Support for meta-annotation attribute overrides for @Transactional is
  provided indirectly via SpringTransactionAnnotationParser.

Implementation Details:

- MetaAnnotationUtils.AnnotationDescriptor now provides access to the
  AnnotationAttributes for the described annotation.
- MetaAnnotationUtils.AnnotationDescriptor now provides access to the
  root declaring class as well as the declaring class.
- ContextLoaderUtils now retrieves AnnotationAttributes from
  AnnotationDescriptor to look up annotation attributes for
  @ContextConfiguration and @ActiveProfiles.
- ContextConfigurationAttributes now provides a constructor to have its
  attributes sourced from an instance of AnnotationAttributes.
- ContextLoaderUtils.resolveContextHierarchyAttributes() now throws an
  IllegalStateException if no class in the class hierarchy declares
  @ContextHierarchy.
- TransactionalTestExecutionListener now uses AnnotatedElementUtils to
  look up annotation attributes for @TransactionConfiguration.
- Implemented missing unit tests for @Rollback resolution in
  TransactionalTestExecutionListener.
- SpringJUnit4ClassRunner now uses AnnotatedElementUtils to look up
  annotation attributes for @Timed.
- TestContextManager now retrieves AnnotationAttributes from
  AnnotationDescriptor to look up annotation attributes for
  @TestExecutionListeners.
- DirtiesContextTestExecutionListener now uses AnnotatedElementUtils to
  look up annotation attributes for @DirtiesContext.

Issue: SPR-11038
2013-11-26 15:56:37 -05:00
Phillip Webb c5779e2ed6 Remove unused GlassFishLoadTimeWeaverTests
Delete the unused GlassFishLoadTimeWeaverTests and in the process
fix the "Unable to load JUnit4 runner to calculate Ignored test cases"
Gradle error.

Issue: SPR-10563
2013-11-26 10:51:13 -08:00
Juergen Hoeller ef3a3b03ce @EnableMBeanExport supports empty placeholders as well
Issue: SPR-11105
2013-11-26 14:43:10 +01:00
Rossen Stoyanchev 119e793994 Fix concurrency issue in TestDispatcherServlet
This change fixes a timing issue in tests using Spring MVC Tests where
assertions on an async result may not wait long enough.

The fix involves the use of a new callback in  MockAsyncContext that
allows tests to detect when an async dispatch has been invoked.

Issue: SPR-10838
2013-11-25 21:51:08 -05:00
Rossen Stoyanchev ce3e55743f Extract IdGenerator into a top-level class 2013-11-25 21:50:47 -05:00
Sam Brannen a5d87fffd9 Polish Javadoc for @IfProfileValue 2013-11-25 21:22:54 -05:00
Sam Brannen 412f74f679 Provide meta-annotation support for @Rollback
@Rollback now supports ANNOTATION_TYPE as a target, allowing it to be
used as meta-annotation.

Note: this change was accidentally omitted from the original commit for
SPR-7827.

Issue: SPR-7827
2013-11-25 20:17:14 -05:00
Juergen Hoeller 1e6f2e79b9 Adapted getXmlAsSource implementation to avoid compilation failure in IntelliJ IDEA 2013-11-26 01:41:54 +01:00
Juergen Hoeller 1ee816b473 Re-introduced custom StaxSource and StaxResult for Spring Web Services 2013-11-26 01:40:34 +01:00
Phillip Webb e6952f41b7 Merge pull request #418 from ericdahl/doc-typos
* doc-typos:
  Fix various typos
2013-11-25 15:59:28 -08:00
Eric Dahl e9f78f6043 Fix various typos
Fix a variety of typos throughout the project, primarily in
comments (javadoc or otherwise) but also in a handful of log messages
and a couple exception messages.

ISSUE: SPR-11123
2013-11-25 15:58:27 -08:00
Rossen Stoyanchev 4e82416ba9 Add SubProtocolCapable interface
The addition of SubProtocolCapable simplifies configuration since it is
no longer necessary to explicitly configure DefaultHandshakeHandler
with a list of supported sub-protocols. We will not also check if the
WebSocketHandler to use for the WebSocket request is an instance of
SubProtocolCapable and obtain the list of sub-protocols that way. The
provided SubProtocolWebSocketHandler does implement this interface.

Issue: SPR-11111
2013-11-25 18:06:01 -05:00
Phillip Webb 59002f2456 Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing
generics or deprecated code.

Also add the `-Werror` compiler option to ensure that any future
warnings will fail the build.

Issue: SPR-11064
2013-11-25 12:52:42 -08:00
Rossen Stoyanchev 4de3291dc7 Consolidate websocket/messaging code
Before this change spring-messaging contained a few WebSocket-related
classes including WebSocket sub-protocol support for STOMP as well
as @EnableWebSocketMessageBroker and related configuration classes.

After this change those classes are located in the spring-websocket
module under org.springframework.web.socket.messaging.

This means the following classes in application configuration must
have their packages updated:

org.springframework.web.socket.messaging.config.EnableWebSocketMessageBroker
org.springframework.web.socket.messaging.config.StompEndpointRegistry
org.springframework.web.socket.messaging.config.WebSocketMessageBrokerConfigurer

MessageBrokerConfigurer has been renamed to MessageBrokerRegistry and
is also located in the above package.
2013-11-23 21:09:17 -05:00
Juergen Hoeller f888b8816f Re-enabled tests for meta-annotations on interfaces
Issue: SPR-11108
2013-11-23 00:43:29 +01:00
Juergen Hoeller f39bb02628 Polishing 2013-11-22 23:29:54 +01:00
Juergen Hoeller 70164cb145 Properly handle InvocationTargetException in reflective JtaPlatform implementation 2013-11-22 23:26:09 +01:00
Juergen Hoeller 519f78c3f5 Optimized ImportAware processing to avoid re-reading class files 2013-11-22 23:22:20 +01:00
Juergen Hoeller 009e362709 @EnableMBeanExport supports placeholders for its attributes now
Issue: SPR-11105
2013-11-22 23:18:47 +01:00
Sam Brannen ad402dcb4a Status quo for composable stereotypes on interfaces
The tests introduced in this commit demonstrate the current lacking
support for composable stereotypes on interfaces (using @Transactional)
as a concrete example.

Issue: SPR-11108
2013-11-22 16:37:48 +01:00
Sam Brannen 44c5eaeaa3 Fix typo in Javadoc 2013-11-22 16:17:20 +01:00
Sam Brannen a613126be0 Polish AnnotationUtils
- Added explicit reference to “get” and “find” lookup types in the
  class-level Javadoc.
- Updated documentation for the underlying algorithms in
  findAnnotation(Method,Class) and findAnnotation(Class,Class) in line
  with the status quo.
- Reverted recent changes to findAnnotationDeclaringClass() by removing
  meta-annotation support in order to maintain backwards compatibility
  with previous releases.
2013-11-22 14:39:51 +01:00
Sam Brannen 665251fa2f Suppress deprecation warning in StatusResultMatchers 2013-11-22 12:55:12 +01:00
Sam Brannen 127bc07cda Delete unused package import 2013-11-22 12:49:25 +01:00
Phillip Webb f3504b2fd5 Fix docs sample for ConversionServiceFactoryBean
Fix the reference documentation example for ConversionServiceFactoryBean
to use a `<set>` instead of a `<list>`.

Issue: SPR-10802
2013-11-21 15:53:22 -08:00
Phillip Webb d9c4470461 Upgrade to HSQLDB 2.3.1
Replace `hsqldb:hsqldb:1.8.0.10` with `org.hsqldb:hsqldb:2.3.1` and
fix breaking tests.

Issue: SPR-10947
2013-11-21 15:48:17 -08:00
Phillip Webb 87e443b429 Merge pull request #80 from giovannidalloglio/SPR-9164
* SPR-9164:
  Add BigDecimal support for SpEl numeric operations
2013-11-21 14:33:13 -08:00
giovannidalloglio d0ab131a57 Add BigDecimal support for SpEl numeric operations
Prior to this change, SpEL supported numeric operations for int, float,
ect. `new java.math.BigDecimal('0.1') > 0` evaluated to false
(BigDecimal is truncated to int)

This commit introduces support for BigDecimal operations for all
mathematical operators. `new java.math.BigDecimal('0.1') > 0` now
evaluates to true (the comparison is made with BigDecimals)

Issue: SPR-9164
2013-11-21 14:28:29 -08:00
Phillip Webb a41958435a Merge pull request #406 from aclement/fix-SPR-9194
* fix-SPR-9194:
  Change SpEL equality operators to use .equals
2013-11-21 12:08:40 -08:00
Andy Clement 2a05e6afa1 Change SpEL equality operators to use .equals
Prior to this commit the SpEL operators `==` and `!=` were using the
Java `==` comparison operator as part of their equality checking. It is
more flexible to use the equals() method on Object.

Under this commit the change to .equals() has been made and the equality
checking code has been pushed into a common method in the Operator
superclass. This commit also makes some tweaks to the other operator
classes - the Float case was missing from OpGT.

Issue: SPR-9194
2013-11-21 12:06:31 -08:00
Phillip Webb 7c3cdf82cc Try a different mbean port 2013-11-21 11:49:49 -08:00
Sam Brannen 3200f3e9a7 Polish Javadoc for TestGroup 2013-11-21 10:53:57 +01:00
Sam Brannen cfe7a525e2 Revert accidental changes to TestGroupTests 2013-11-21 10:52:53 +01:00
Phillip Webb 639b2cb12e Increase performance test timeout 2013-11-20 22:05:34 -08:00
Phillip Webb 4385da7b84 Support for 'all excluding' test groups 2013-11-20 21:26:17 -08:00
Phillip Webb 02f7803860 Upgrade to Gradle 1.9 2013-11-20 13:14:57 -08:00
Phillip Webb 5c7eaaa969 Fix SpEL docs indicating +/- is Supported on Date
Issue: SPR-11057
2013-11-20 13:13:27 -08:00
Sam Brannen b830d7362d Support non-public anno. attr. values in AnnoUtils
Prior to this commit, the getValue(Annotation, String) method in
AnnotationUtils failed to retrieve the value of the desired annotation
attribute if the annotation itself was not public -- for example if the
annotation was declared as package private.

This commit addresses this issue by ensuring that getValue(Annotation,
String) uses reflection to make the desired annotation attribute method
accessible before attempting to invoke it to retrieve the value.

Issue: SPR-11104
2013-11-20 21:58:36 +01:00
Sam Brannen 45afd4fbe2 Update build in preparation for Gradle 2.0
As of Gradle 1.8, ‘testReport true’ is deprecated. Thus in order to
generate TestNG reports alongside JUnit reports with Gradle 2.0 and
beyond, we are now using:

  getReports().getHtml().setEnabled(true)
2013-11-20 20:10:19 +01:00
Phillip Webb 63c143be61 Merge pull request #409 from cdupuis/SPR-11083
* SPR-11083:
  Allow instrumentation to be used with Attach API
2013-11-20 10:39:33 -08:00
Christian Dupuis f6f0adf63b Allow instrumentation to be used with Attach API
Update InstrumentationSavingAgent to allow it to be used with the
Attach API

Issue: SPR-11083
2013-11-20 10:39:24 -08:00
Juergen Hoeller 41cdbd292a Defensively handle non-retrievable ApplicationListener bean names 2013-11-20 14:52:25 +01:00
Juergen Hoeller 6a9e116d78 Polishing 2013-11-20 14:50:59 +01:00
Juergen Hoeller 0de112198e Rely on presence of Servlet 2.5's ServletContext.getContextPath() 2013-11-20 14:50:32 +01:00
Brian Clozel 2ea5360b82 Upgrade Jetty to 9.1.0 GA
Issue: SPR-11099
2013-11-19 17:22:33 -08:00
Brian Clozel cc4faa5990 Fix standard multipart binding + Polish
Fixing standard multipart binding when multiple parts share
the same name.

Uncomment previously @Ignored tests now that Jetty supports
Servlet 3.0 spec.

Issue: SPR-10591
2013-11-19 17:13:31 -08:00
Phillip Webb 6f2004f4f8 Restore multi-page and PDF reference documentation
Generate docbook xml from the asciidoc reference guide and use the
docbook-reference-plugin to generate HTML (single and multi-page) and
PDF documentation.

Issue: SPR-11096
2013-11-19 16:50:56 -08:00
Phillip Webb e54fc7bbdc Add whitespace to improve asciidoc readability
Issue: SPR-11096
2013-11-19 16:50:46 -08:00
Phillip Webb 5d8b008a8b Remove superfluous spaces in asciidoc
Remove the superfluous spaces that appear in the asciidoc source.

Issue: SPR-11096
2013-11-19 16:39:37 -08:00
Phillip Webb 8d4d5af30a Polish build.gradle 2013-11-19 16:31:04 -08:00
Phillip Webb 8dd5e6da46 Upgrade to Gradle 1.8 and propdeps 0.0.5 2013-11-19 16:24:42 -08:00
Phillip Webb a7251041f1 Fix broken reference guide links
Remove or replace broken links from the reference documentation.

Issue: SPR-11096
2013-11-18 20:20:23 -08:00
Phillip Webb 99cf06bfc9 Remove superfluous space before 'http' in asciidoc
Remove the superfluous space that appears before each 'http' reference
in the asciidoc source. Presumably there due to some quirk of the
docbook conversion.

Issue: SPR-11096
2013-11-18 20:17:54 -08:00
Phillip Webb 13bef4fd2d Specify asciidoc type
Specify a specific asciidoc type of 'docbook' to prevent
'multiple titles at level 0' errors during generation.

Issue: SPR-11096
2013-11-18 20:14:24 -08:00
Phillip Webb 8e60bbc3ee Replace asciidoc authors convention with attribute
Replace the second line of the asciidoc reference guide that, by
convention, specifies authors with an 'author' explicit attribute.

Issue: SPR-11096
2013-11-18 20:11:49 -08:00
Phillip Webb 7d7f0063f8 Wrap reference asciidoc at 90 characters
Reformat the asciidoc source for the reference guide to wrap at about
90 characters.

Issue: SPR-11096
2013-11-18 20:08:41 -08:00
Phillip Webb cb858a3b01 Replace springsource.org links with spring.io
Update reference documentation links to use the new spring.io domain.

Issue: SPR-11096
2013-11-18 10:12:19 -08:00
Phillip Webb ea08d4b49c Add .gradletasknamecache to .gitignore 2013-11-18 10:12:19 -08:00
Phillip Webb 4b0de69246 Replace non UTF-8 characters in asciidoc source
Replace the odd instance of non UTF-8 characters in the reference
asciidoc source, mainly smart-quotes.

Issue: SPR-11096
2013-11-18 10:11:49 -08:00
Biju Kunjummen dfa7483812 Fix broken javadoc links in reference guide
Replace links in the reference documentation from
`http://static.springsource.org/spring/docs/current/api/..` to
`http://docs.spring.io/spring/docs/current/javadoc-api/..`

Issue: SPR-11087
2013-11-18 09:33:48 -08:00
Sam Brannen e910326bf7 Polish Javadoc for ListableBeanFactory 2013-11-17 14:59:47 +00:00
Rossen Stoyanchev 35b9b8400b Rename @SubscribeEvent to @SubscribeMapping
Also @SubscribeMapping is now a method-level annotation only that can
be used in combination with a type-level @MessageMapping.

This method also documents supported method arguments and return value
types on @Subscribe- and @MessageMapping methods.
2013-11-15 16:34:27 +00:00
Juergen Hoeller 2597cd2339 Upgraded to JCache 1.0 PFD 2013-11-15 16:48:34 +01:00
Juergen Hoeller 54571bf038 Introduced getBeanNamesForAnnotation method on ListableBeanFactory
Issue: SPR-11069
2013-11-15 16:04:11 +01:00
Juergen Hoeller b43901ed86 Upgraded to JSF 2.0 baseline; building against JSF 2.2 now 2013-11-15 12:07:42 +01:00
Juergen Hoeller ddebda1121 Ignoring non-loadable annotations in SourceClass.getAnnotations() and therefore in the collectImports algorithm
Issue: SPR-11086
2013-11-15 11:50:01 +01:00
Rossen Stoyanchev 6802f813de Polish STOMP codec
Issue: SPR-11088
2013-11-13 13:45:56 -05:00
Andy Wilkinson e84885c655 Update STOMP decoder to handle incomplete frames
Previously, StompDecoder would throw a StompConversionException when
it attempted to decode a Buffer that contained an incomplete frame.

This commit updates StompDecoder to return null when it encounters an
incomplete frame. It also resets the buffer, thereby allowing the
decode to be reattempted once more data has been received.
StompCodec's decoder function has been updated to stop attempting to
decode a Buffer when StompDecoder returns null.

Issue: SPR-11088
2013-11-13 13:45:12 -05:00
Rossen Stoyanchev 9600bf07c7 Upgrade to reactor-tcp 1.0 2013-11-12 16:44:11 -05:00
Rossen Stoyanchev df5d22e120 Improve logging in spring-messaging
Before this change the amount of logging was too little or too much
with TRACE turned on. This change separates useful debugging
information and logs it under DEBUG and leaves more detailed
information to be logged under TRACE.
2013-11-12 16:34:25 -05:00
Rossen Stoyanchev 72dec7d0fe Add default destination for @SendTo methods
Issue: SPR-11085
2013-11-11 16:59:36 -05:00
Sam Brannen d67fe1db86 Polish spring-context
- Cache interceptor internals now operate on collections of
   <? extends Cache> instead of <Cache>.
 - Deleted unused imports.
 - Deleted dead code.
 - Suppressed warnings for resource leaks related to not closing
   ApplicationContexts in tests.
 - Suppressed further non-issue warnings in tests.
2013-11-11 12:09:50 +01:00
Rossen Stoyanchev 5915b23e8a Rename method in MessageBrokerConfigurer 2013-11-10 10:47:35 -05:00
Sam Brannen 930d187723 Merge pull request #408 from AlexYursha/patch-1
Fix a typo in package description
2013-11-08 15:53:24 -08:00
Alex Yursha 6a1ca41cb7 Put accidentally deleted LF in place 2013-11-09 01:57:27 +03:00
Alex Yursha 6900645d59 Fix a typo in package description 2013-11-09 01:26:59 +03:00
Rossen Stoyanchev 2a6c1f75e7 Simplify determination of SockJS path
The SockJS path is now passed to the SockJsService handleRequest method
thus removing the need to guess it.

Issue: SPR-11058
2013-11-07 22:28:15 -05:00
Rossen Stoyanchev 6a18daea33 Return AbstractSubscribableChannel from @Bean methods
Declare SubscribableChannel @Beans in
WebSocketMessageBrokerConfigurationSupport as
AbstractSubscribableChannel to avoid the need for casting when
registering interceptors.

Issue: SPR-11065
2013-11-07 22:28:00 -05:00
Rossen Stoyanchev 0340cc5f03 Update user destinations handling
Before this change subscribing to a user-specific destination in STOMP
required manually appending a unique queue suffix provided in a header
with the CONNECTED frame.

This change removes the need to do that. Instead STOMP clients can
subscribe to "/user/queue/error" and can then begin to receive messages
sent to "/user/{username}/queue/error" without colliding with any other
user doing the same.

Issue: SPR-11077
2013-11-07 17:37:41 -05:00
Sam Brannen c09f85172b Use AsciiDoctor special characters
- Replaced ellipsis with "..."

 - Replaced em dash with "--"

 - Fixed issue with italics migration in the Standard Annotation Support
  section of the Testing chapter
2013-11-07 13:18:31 +01:00
Michael Irwin 467c770b4d Handle UnsupportedOperationException from getInstalledExtensions in Glassfish 4.0 2013-11-06 08:36:28 -05:00
Rossen Stoyanchev b5bd4d8a8a Add div around extra hidden fields in FormTag
Issue: SPR-10926
2013-11-05 20:45:50 -05:00
Juergen Hoeller e9a24da225 Added test for placeholder in alias definition
Issue: SPR-11018
2013-11-06 00:14:26 +01:00
Juergen Hoeller 0aedd81ccc JndiObjectFactoryBean converts a "defaultObject" value to the expected type if necessary
Issue: SPR-11039
2013-11-06 00:12:52 +01:00
Rob Winch dcc6ef262d Poish asciidoctor
Issues: SPR-10960
2013-11-05 16:50:06 -06:00
Rossen Stoyanchev 18b69903ca Return 415 on bad request body content-type
Issue: SPR-10982
2013-11-05 15:38:55 -05:00
Rob Winch 7bf4324f0f Poish asciidoctor
Issues: SPR-10960
2013-11-05 13:52:25 -06:00
Rob Winch 3476d11fb8 Poish asciidoctor
Issues: SPR-10960
grate documentation to #	deleted:    src/reference/docbook/index.xml
2013-11-05 11:01:30 -06:00
Rossen Stoyanchev 2e57cf8bfc Fold spring-test-mvc sources into spring-test
With spring-test compiling against Servlet 3.0 it is no longer required
to compile Spring MVC Test sources separately (from spring-test).
2013-11-05 11:44:13 -05:00
Rossen Stoyanchev 0eeb6717e0 Fix exception mock request builder
Issue: SPR-11043
2013-11-05 10:59:05 -05:00
Rossen Stoyanchev c6c5555034 Use final keyword in MessageHeaders 2013-11-05 10:06:35 -05:00
Rossen Stoyanchev 2ae6a6a341 Disable ext entities in SourceHttpMessageConverter
This change disables the processing of external entities in
SourceHttpMessageConverter by default and provides an option to enable
it if required.
2013-11-05 09:23:20 -05:00
Juergen Hoeller c5fcf19535 Perform setParent's Environment merging for ClassPathXmlApplicationContext etc constructors with parent argument as well
Issue: SPR-11068
2013-11-05 13:48:21 +01:00
Juergen Hoeller 4ac680103b Only retrieve the FlashMapManager if a non-empty output FlashMap has been found
Issue: SPR-10937
2013-11-05 13:38:10 +01:00
Juergen Hoeller 8f81a12236 Added actual overriding test to BeanMethodPolymorphismTests
Issue: SPR-10992
2013-11-05 01:09:51 +01:00
Juergen Hoeller eed1a323d1 Polishing (along with SPR-10992) 2013-11-04 23:44:47 +01:00
Juergen Hoeller 935bd25b09 Revised @Bean processing rules
@Bean method metadata is always being picked from the most concrete subclass; @Bean method overloads are allowed within the same config class as well; and @Bean overrides and overloads work with 'allowBeanDefinitionOverriding'=false now.

Issue: SPR-10992
Issue: SPR-11025
2013-11-04 23:34:00 +01:00
Juergen Hoeller e146e53d9b Added support for the JCA 1.7 getActivationName() method
Issue: SPR-11067
2013-11-04 23:14:57 +01:00
Rossen Stoyanchev bedb8e965f Update CONTRIBUTING-DOCUMENTATION.adoc 2013-11-04 15:56:48 -05:00
Rossen Stoyanchev 6ef9cbe473 Update CONTRIBUTING-DOCUMENTATION.adoc 2013-11-04 15:56:26 -05:00
Rob Winch fd0b6caf9e Migrate documentation to asciidoctor
This commit migrates to asciidoctor to ease writing documentation.

Issues: SPR-10960
2013-11-04 11:49:52 -06:00
Juergen Hoeller 50d3f71923 Added get(key, type) method to Cache interface
This new get variant not only allows for generically specifying the required value type; it also skips the ValueWrapper that the standard get method returns. Note that it is not possible to differentiate between non-existing cache entries and cached null values that way; for that purpose, the standard get variant needs to be used.

Issue: SPR-11061
2013-11-04 14:31:41 +01:00
Juergen Hoeller b093b84954 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
2013-11-04 00:19:55 +01:00
Juergen Hoeller 49758a2a96 Added convenience classes for typical JSR-236 setup in a Java EE 7 environment
Introduced DefaultManagedTaskExecutor, DefaultManagedTaskScheduler and DefaultManagedAwareThreadFactory classes, revised related javadoc, and deprecated unsupported JBossWorkManagerTaskExecutor in favor of JSR-236 setup on WildFly 8.

Issue: SPR-8195
2013-11-02 20:14:02 +01:00
Juergen Hoeller 00474ceecd Introduced setCacheRegionFactory method on LocalSessionFactoryBuilder/Bean
Issue: SPR-11056
2013-11-01 23:50:09 +01:00
Juergen Hoeller 13ed423387 Polished exception messages
Issue: SPR-11042
2013-11-01 23:07:50 +01:00
Juergen Hoeller 44dee37130 Added further author tags
Issue: SPR-1528
2013-11-01 22:43:02 +01:00
Juergen Hoeller 7ed108e974 Avoid potential NPE in toString()
Issue: SPR-1528
2013-11-01 22:42:17 +01:00
Juergen Hoeller 7b2ac6d194 LocaleContextHolder allows for independent setting of Locale and TimeZone
Issue: SPR-1528
2013-11-01 22:41:31 +01:00
Juergen Hoeller 1dc7ff8604 Avoid unnecessary char[] allocation in NamedParameterUtils
Issue: SPR-11042
2013-11-01 22:38:55 +01:00
Spring Buildmaster a32b94f85d Increment version to 4.0.0.BUILD-SNAPSHOT 2013-10-31 12:18:53 -07:00
1435 changed files with 66485 additions and 70771 deletions
+2
View File
@@ -20,6 +20,7 @@ activemq-data/
/build
buildSrc/build
/spring-*/build
/src/asciidoc/build
target/
# Eclipse artifacts, including WTP generated manifests
@@ -35,3 +36,4 @@ spring-*/src/main/java/META-INF/MANIFEST.MF
out
test-output
atlassian-ide-plugin.xml
.gradletasknamecache
+28
View File
@@ -0,0 +1,28 @@
= How to contribute to the reference
The Spring Framework reference now uses http://asciidoctor.org/[asciidoctor]. This document describes how to contribute documentation updates.
== Building with Gradle
You can build the documentation using gradle using the `asciidoc` task. For example, from the project root execute the following command:
gradlew asciidoc
the output will be available at `spring-framework/build/asciidoc/index.html`
== Live editing
One of the nice features about using asciidoctor is the support for live editing.
You will find a Guardfile already present at `spring-framework/src/asciidoc/Guardfile`. Then ensure to follow the setup instructions within the http://asciidoctor.org/docs/editing-asciidoc-with-live-preview/[Editing AsciiDoc with Live Preview] document.
When running `guard start` within the `src/asciidoc/` folder, any changes to the `src/asciidoc/index.adoc` file will automatically be written at `src/asciidoc/build/index.html`.
== Documentation notes
Some notes on documentation
* It is important to keep whitespaces to a minimum to make it simple to edit files. This means use an editor with line wrapping rather than manually inserting hard returns.
* http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/[Asciidoctor Quick Reference]
* http://asciidoctor.org/docs/user-manual/[Asciidoctor Manual]
* http://asciidoctor.org/docs/asciidoc-writers-guide/[Asciidoctor Writers Guide]
+134 -96
View File
@@ -3,8 +3,9 @@ buildscript {
maven { url "http://repo.springsource.org/plugins-release" }
}
dependencies {
classpath("org.springframework.build.gradle:propdeps-plugin:0.0.4")
classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.7")
classpath("org.springframework.build.gradle:propdeps-plugin:0.0.5")
classpath("org.asciidoctor:asciidoctor-gradle-plugin:0.7.0")
classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.8")
}
}
@@ -14,9 +15,10 @@ configure(allprojects) { project ->
ext.aspectjVersion = "1.8.0.M1"
ext.groovyVersion = "1.8.9"
ext.hsqldbVersion = "1.8.0.10"
ext.hsqldbVersion = "2.3.1"
ext.junitVersion = "4.11"
ext.slf4jVersion = "1.6.1"
ext.jettyVersion = "9.1.0.v20131115"
ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
apply plugin: "propdeps"
@@ -24,27 +26,21 @@ configure(allprojects) { project ->
apply plugin: "test-source-set-dependencies"
apply from: "${gradleScriptDir}/ide.gradle"
[compileJava, compileTestJava]*.options*.compilerArgs = [
"-Xlint:serial",
"-Xlint:varargs",
"-Xlint:cast",
"-Xlint:classfile",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:finally",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:static",
"-Xlint:try",
"-Xlint:-options", // intentionally disabled
"-Xlint:-fallthrough", // intentionally disabled
"-Xlint:-rawtypes", // TODO enable and fix warnings
"-Xlint:-deprecation", // TODO enable and fix warnings
"-Xlint:-unchecked" // TODO enable and fix warnings
compileJava.options*.compilerArgs = [
"-Xlint:serial", "-Xlint:varargs", "-Xlint:cast", "-Xlint:classfile",
"-Xlint:dep-ann", "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally",
"-Xlint:overrides", "-Xlint:path", "-Xlint:processing", "-Xlint:static",
"-Xlint:try", "-Xlint:fallthrough", "-Xlint:rawtypes", "-Xlint:deprecation",
"-Xlint:unchecked", "-Xlint:-options", "-Werror"
]
compileTestJava.options*.compilerArgs = [
"-Xlint:serial", "-Xlint:varargs", "-Xlint:cast", "-Xlint:classfile",
"-Xlint:dep-ann", "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally",
"-Xlint:overrides", "-Xlint:path", "-Xlint:processing", "-Xlint:static",
"-Xlint:try", "-Xlint:-fallthrough", "-Xlint:-rawtypes", "-Xlint:-deprecation",
"-Xlint:-unchecked", "-Xlint:-options"]
compileJava {
sourceCompatibility=1.6
targetCompatibility=1.6
@@ -71,7 +67,7 @@ configure(allprojects) { project ->
maven { url "https://repository.apache.org/content/repositories/releases" } // tomcat 8
// maven { url "https://repository.apache.org/content/repositories/snapshots" } // tomcat 8 snapshots
maven { url "https://maven.java.net/content/repositories/releases" } // javax.websocket, tyrus
maven { url "https://oss.sonatype.org/content/repositories/snapshots" } // javax.cache
maven { url "https://oss.sonatype.org/content/repositories/releases" } // javax.cache
}
dependencies {
@@ -97,8 +93,9 @@ configure(allprojects) { project ->
"http://www.eclipse.org/aspectj/doc/released/aspectj5rt-api/",
"http://ehcache.org/apidocs/",
"http://quartz-scheduler.org/api/2.1.7/",
"http://jackson.codehaus.org/1.9.12/javadoc/",
"http://fasterxml.github.com/jackson-core/javadoc/2.2.2/",
"http://jackson.codehaus.org/1.9.4/javadoc/",
"http://fasterxml.github.com/jackson-core/javadoc/2.2.0/",
"http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs"
] as String[]
}
@@ -325,6 +322,8 @@ project("spring-instrument") {
jar {
manifest.attributes["Premain-Class"] =
"org.springframework.instrument.InstrumentationSavingAgent"
manifest.attributes["Agent-Class"] =
"org.springframework.instrument.InstrumentationSavingAgent"
manifest.attributes["Can-Redefine-Classes"] = "true"
manifest.attributes["Can-Retransform-Classes"] = "true"
manifest.attributes["Can-Set-Native-Method-Prefix"] = "false"
@@ -383,15 +382,13 @@ project("spring-messaging") {
compile(project(":spring-beans"))
compile(project(":spring-core"))
compile(project(":spring-context"))
optional(project(":spring-websocket"))
optional(project(":spring-webmvc"))
optional("com.fasterxml.jackson.core:jackson-databind:2.2.2")
optional("org.projectreactor:reactor-core:1.0.0.BUILD-SNAPSHOT")
optional("org.projectreactor:reactor-tcp:1.0.0.BUILD-SNAPSHOT")
optional("org.eclipse.jetty.websocket:websocket-server:9.1.0.RC0") {
optional("org.projectreactor:reactor-core:1.0.0.RELEASE")
optional("org.projectreactor:reactor-tcp:1.0.0.RELEASE")
optional("org.eclipse.jetty.websocket:websocket-server:${jettyVersion}") {
exclude group: "javax.servlet", module: "javax.servlet-api"
}
optional("org.eclipse.jetty.websocket:websocket-client:9.1.0.RC0")
optional("org.eclipse.jetty.websocket:websocket-client:${jettyVersion}")
testCompile(project(":spring-test"))
testCompile("com.thoughtworks.xstream:xstream:1.4.4")
testCompile("commons-dbcp:commons-dbcp:1.2.2")
@@ -403,18 +400,13 @@ project("spring-messaging") {
exclude group: "org.springframework", module: "spring-context"
}
testCompile("org.apache.activemq:activemq-stomp:5.8.0")
testCompile("org.eclipse.jetty:jetty-webapp:9.1.0.RC0") {
testCompile("org.eclipse.jetty:jetty-webapp:${jettyVersion}") {
exclude group: "javax.servlet", module: "javax.servlet-api"
}
testCompile("org.apache.tomcat.embed:tomcat-embed-core:8.0.0-RC5")
testCompile("org.apache.tomcat.embed:tomcat-embed-logging-juli:8.0.0-RC5")
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
}
repositories {
maven { url "http://repo.spring.io/snapshot" } // for reactor (until RC2)
}
}
project("spring-tx") {
@@ -439,12 +431,12 @@ project("spring-oxm") {
description = "Spring Object/XML Marshalling"
apply from: "oxm.gradle"
// The following is a work-around until the Gradle build uses
// Ant 1.9.x by default. This is necessary to avoid the genCastor
// "Class not found: javac1.8" issue with Ant versions prior to 1.9.x
ant.properties["build.compiler"] = "javac1.7"
// The following is a work-around until the Gradle build uses
// Ant 1.9.x by default. This is necessary to avoid the genCastor
// "Class not found: javac1.8" issue with Ant versions prior to 1.9.x
ant.properties["build.compiler"] = "javac1.7"
compileTestJava {
compileTestJava {
// necessary to avoid java.lang.VerifyError on jibx compilation
// see http://jira.codehaus.org/browse/JIBX-465
sourceCompatibility=1.6
@@ -496,7 +488,7 @@ project("spring-jdbc") {
optional(project(":spring-context")) // for JndiDataSourceLookup
compile(project(":spring-tx"))
optional("c3p0:c3p0:0.9.1.2")
optional("hsqldb:hsqldb:${hsqldbVersion}")
optional("org.hsqldb:hsqldb:${hsqldbVersion}")
optional("com.h2database:h2:1.0.71")
optional("org.apache.derby:derby:10.5.3.0_1")
optional("org.apache.derby:derbyclient:10.5.3.0_1")
@@ -514,7 +506,7 @@ project("spring-context-support") {
optional(project(":spring-jdbc")) // for Quartz support
optional(project(":spring-tx")) // for Quartz support
optional("javax.mail:mail:1.4.7")
optional("javax.cache:cache-api:0.11-SNAPSHOT")
optional("javax.cache:cache-api:1.0.0-PFD")
optional("net.sf.ehcache:ehcache-core:2.6.5")
optional("org.quartz-scheduler:quartz:1.8.6") {
exclude group: "org.slf4j", module: "slf4j-log4j12"
@@ -529,7 +521,7 @@ project("spring-context-support") {
testCompile("org.apache.poi:poi:3.9")
testCompile("commons-beanutils:commons-beanutils:1.8.0") // for Velocity/JasperReports
testCompile("commons-digester:commons-digester:1.8.1") // for Velocity/JasperReports
testCompile("hsqldb:hsqldb:${hsqldbVersion}")
testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
}
// pick up **/*.types files in src/main
@@ -547,7 +539,7 @@ project("spring-web") {
optional(project(":spring-oxm")) // for MarshallingHttpMessageConverter
compile("aopalliance:aopalliance:1.0")
provided("javax.el:javax.el-api:2.2.4")
provided("com.sun.faces:jsf-api:2.1.7")
provided("javax.faces:javax.faces-api:2.2")
provided("javax.portlet:portlet-api:2.0")
provided("javax.servlet:javax.servlet-api:3.0.1")
provided("javax.servlet.jsp:jsp-api:2.1")
@@ -560,10 +552,10 @@ project("spring-web") {
optional("org.codehaus.jackson:jackson-mapper-asl:1.9.12")
optional("com.fasterxml.jackson.core:jackson-databind:2.2.2")
optional("taglibs:standard:1.1.2")
optional("org.eclipse.jetty:jetty-servlet:9.1.0.RC0") {
optional("org.eclipse.jetty:jetty-servlet:${jettyVersion}") {
exclude group: "javax.servlet", module: "javax.servlet-api"
}
optional("org.eclipse.jetty:jetty-server:9.1.0.RC0") {
optional("org.eclipse.jetty:jetty-server:${jettyVersion}") {
exclude group: "javax.servlet", module: "javax.servlet-api"
}
optional("log4j:log4j:1.2.17")
@@ -584,6 +576,7 @@ project("spring-websocket") {
compile(project(":spring-core"))
compile(project(":spring-context"))
compile(project(":spring-web"))
optional(project(":spring-messaging"))
optional(project(":spring-webmvc"))
optional("javax.servlet:javax.servlet-api:3.1.0")
optional("javax.websocket:javax.websocket-api:1.0")
@@ -593,18 +586,20 @@ project("spring-websocket") {
}
optional("org.glassfish.tyrus:tyrus-websocket-core:1.2.1")
optional("org.glassfish.tyrus:tyrus-container-servlet:1.2.1")
optional("org.eclipse.jetty:jetty-webapp:9.1.0.RC0") {
optional("org.eclipse.jetty:jetty-webapp:${jettyVersion}") {
exclude group: "javax.servlet", module: "javax.servlet"
}
optional("org.eclipse.jetty.websocket:websocket-server:9.1.0.RC0") {
optional("org.eclipse.jetty.websocket:websocket-server:${jettyVersion}") {
exclude group: "javax.servlet", module: "javax.servlet"
}
optional("org.eclipse.jetty.websocket:websocket-client:9.1.0.RC0")
optional("org.eclipse.jetty.websocket:websocket-client:${jettyVersion}")
optional("com.fasterxml.jackson.core:jackson-databind:2.2.2")
optional("org.codehaus.jackson:jackson-mapper-asl:1.9.12")
testCompile("org.apache.tomcat.embed:tomcat-embed-core:8.0.0-RC5")
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
testCompile("log4j:log4j:1.2.17")
testCompile("org.projectreactor:reactor-core:1.0.0.RELEASE")
testCompile("org.projectreactor:reactor-tcp:1.0.0.RELEASE")
}
}
@@ -623,7 +618,7 @@ project("spring-orm") {
provided("javax.servlet:javax.servlet-api:3.0.1")
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
testCompile("commons-dbcp:commons-dbcp:1.2.2")
testCompile("hsqldb:hsqldb:${hsqldbVersion}")
testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
compile(project(":spring-core"))
compile(project(":spring-beans"))
optional(project(":spring-aop"))
@@ -691,10 +686,10 @@ project("spring-webmvc") {
exclude group: "xom", module: "xom"
exclude group: "xerces", module: "xercesImpl"
}
testCompile("org.eclipse.jetty:jetty-servlet:9.1.0.RC0") {
testCompile("org.eclipse.jetty:jetty-servlet:${jettyVersion}") {
exclude group: "javax.servlet", module: "javax.servlet"
}
testCompile("org.eclipse.jetty:jetty-server:9.1.0.RC0") {
testCompile("org.eclipse.jetty:jetty-server:${jettyVersion}") {
exclude group: "javax.servlet", module: "javax.servlet"
}
testCompile("javax.validation:validation-api:1.0.0.GA")
@@ -780,53 +775,21 @@ project("spring-test") {
optional("javax.portlet:portlet-api:2.0")
optional("org.eclipse.persistence:javax.persistence:2.0.0")
optional("org.aspectj:aspectjweaver:${aspectjVersion}")
testCompile("org.hibernate:hibernate-core:3.6.9.Final")
provided("javax.inject:javax.inject:1")
provided("javax.activation:activation:1.1")
provided("javax.servlet:jstl:1.2")
testCompile "org.slf4j:slf4j-jcl:${slf4jVersion}"
testCompile("hsqldb:hsqldb:${hsqldbVersion}")
}
task testNG(type: Test) {
useTestNG()
scanForTestClasses = false
include "**/testng/*.*"
exclude "**/FailingBeforeAndAfterMethodsTests.class"
// "TestCase" classes are run by other test classes, not the build.
exclude "**/*TestCase.class"
// Generate TestNG reports alongside JUnit reports.
testReport true
}
test {
dependsOn testNG
useJUnit()
exclude "**/testng/*.*"
// "TestCase" classes are run by other test classes, not the build.
exclude(["**/*TestCase.class", "**/*TestSuite.class"])
}
}
project("spring-test-mvc") {
description = "Spring Test MVC Framework"
merge.into = project(":spring-test")
dependencies {
optional(project(":spring-context"))
provided(project(":spring-webmvc"))
provided(project(":spring-webmvc-tiles3"))
provided("javax.servlet:javax.servlet-api:3.0.1")
optional("org.hamcrest:hamcrest-core:1.3")
optional("com.jayway.jsonpath:json-path:0.9.0")
optional("xmlunit:xmlunit:1.3")
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
testCompile("javax.servlet:jstl:1.2")
testCompile(project(":spring-context-support"))
testCompile(project(":spring-oxm"))
testCompile(project(":spring-webmvc-tiles3"))
testCompile("org.hibernate:hibernate-core:3.6.9.Final")
testCompile "org.slf4j:slf4j-jcl:${slf4jVersion}"
testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
testCompile("org.hibernate:hibernate-validator:4.3.0.Final")
testCompile("org.codehaus.jackson:jackson-mapper-asl:1.9.12")
testCompile("com.fasterxml.jackson.core:jackson-databind:2.2.2")
testCompile(project(":spring-context-support"))
testCompile(project(":spring-oxm"))
testCompile("com.thoughtworks.xstream:xstream:1.4.4")
testCompile("rome:rome:1.0")
testCompile("javax.activation:activation:1.1")
@@ -840,6 +803,25 @@ project("spring-test-mvc") {
exclude group: "org.slf4j", module: "jcl-over-slf4j"
}
}
task testNG(type: Test) {
useTestNG()
scanForTestClasses = false
include "**/testng/*.*"
exclude "**/FailingBeforeAndAfterMethodsTests.class"
// "TestCase" classes are run by other test classes, not the build.
exclude "**/*TestCase.class"
// Generate TestNG reports alongside JUnit reports.
getReports().getHtml().setEnabled(true)
}
test {
dependsOn testNG
useJUnit()
exclude "**/testng/*.*"
// "TestCase" classes are run by other test classes, not the build.
exclude(["**/*TestCase.class", "**/*TestSuite.class"])
}
}
project("spring-aspects") {
@@ -871,17 +853,73 @@ project("spring-aspects") {
}
}
project("spring-framework-bom") {
description = "Spring Framework (Bill of Materials)"
configurations.archives.artifacts.clear()
artifacts {
// work around GRADLE-2406 by attaching text artifact
archives(file("spring-framework-bom.txt"))
}
install {
repositories.mavenInstaller {
pom.whenConfigured {
packaging = "pom"
withXml {
asNode().children().last() + {
delegate.dependencyManagement {
delegate.dependencies {
parent.subprojects.sort { "$it.name" }.each { p ->
if (p.hasProperty("merge") && p.merge.into == null && p != project) {
delegate.dependency {
delegate.groupId(p.group)
delegate.artifactId(p.name)
delegate.version(p.version)
}
}
}
}
}
}
}
}
}
}
}
configure(rootProject) {
description = "Spring Framework"
apply plugin: "asciidoctor"
apply plugin: "docbook-reference"
apply plugin: "groovy"
// apply plugin: "detect-split-packages"
apply from: "${gradleScriptDir}/jdiff.gradle"
asciidoctor {
baseDir = project.file('src/asciidoc')
backend = 'docbook5'
options = [
eruby: 'erubis',
attributes: [
doctype: 'book',
'spring-version' : project.version,
revnumber : project.version,
docinfo : ""
]
]
}
reference {
sourceDir = file("src/reference/docbook")
sourceDir = asciidoctor.outputDir
pdfFilename = "spring-framework-reference.pdf"
expandPlaceholders = ""
}
afterEvaluate {
tasks.findAll { it.name.startsWith("reference") }.each{ it.dependsOn.add("asciidoctor") }
}
// TODO: DetectSplitPackagesPlugin fails in line 154 due to method not found on java.io.File.
@@ -911,7 +949,7 @@ configure(rootProject) {
testCompile("javax.inject:javax.inject:1")
testCompile("javax.resource:connector-api:1.5")
testCompile("org.aspectj:aspectjweaver:${aspectjVersion}")
testCompile("hsqldb:hsqldb:${hsqldbVersion}")
testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
}
task api(type: Javadoc) {
@@ -953,7 +991,7 @@ configure(rootProject) {
}
}
task docsZip(type: Zip) {
task docsZip(type: Zip, dependsOn: 'reference') {
group = "Distribution"
baseName = "spring-framework"
classifier = "docs"
@@ -1079,7 +1117,7 @@ configure(rootProject) {
task wrapper(type: Wrapper) {
description = "Generates gradlew[.bat] scripts"
gradleVersion = "1.6"
gradleVersion = "1.9"
doLast() {
def gradleOpts = "-XX:MaxMetaspaceSize=1024m -Xmx1024m"
+1 -1
View File
@@ -1 +1 @@
version=4.0.0.RC1
version=4.0.0.RC2
Binary file not shown.
+5 -5
View File
@@ -1,6 +1,6 @@
#Mon May 13 17:38:05 CDT 2013
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
#Wed Nov 20 13:14:38 PST 2013
distributionBase=GRADLE_USER_HOME
distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-bin.zip
Vendored
+1 -1
View File
@@ -9,7 +9,7 @@
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set GRADLE_OPTS=-XX:MaxMetaspaceSize=1024m -Xmx1024m -XX:MaxHeapSize=256m %GRADLE_OPTS%
set GRADLE_OPTS=-XX:MaxMetaspaceSize=1024m -Xmx1024m -XX:MaxHeapSize=256m %GRADLE_OPTS%
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
+1 -1
View File
@@ -17,13 +17,13 @@ include "spring-orm"
include "spring-orm-hibernate4"
include "spring-oxm"
include "spring-test"
include "spring-test-mvc"
include "spring-tx"
include "spring-web"
include "spring-webmvc"
include "spring-webmvc-portlet"
include "spring-webmvc-tiles3"
include "spring-websocket"
include "spring-framework-bom"
// Exposes gradle buildSrc for IDE support
include "buildSrc"
@@ -39,6 +39,6 @@ public interface IntroductionAwareMethodMatcher extends MethodMatcher {
* asking is the subject on one or more introductions; {@code false} otherwise
* @return whether or not this method matches statically
*/
boolean matches(Method method, Class targetClass, boolean hasIntroductions);
boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions);
}
@@ -34,6 +34,6 @@ public interface IntroductionInfo {
* Return the additional interfaces introduced by this Advisor or Advice.
* @return the introduced interfaces
*/
Class[] getInterfaces();
Class<?>[] getInterfaces();
}
@@ -35,7 +35,7 @@ class TrueClassFilter implements ClassFilter, Serializable {
}
@Override
public boolean matches(Class clazz) {
public boolean matches(Class<?> clazz) {
return true;
}
@@ -41,12 +41,12 @@ class TrueMethodMatcher implements MethodMatcher, Serializable {
}
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return true;
}
@Override
public boolean matches(Method method, Class targetClass, Object[] args) {
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
// Should never be invoked as isRuntime returns false.
throw new UnsupportedOperationException();
}
@@ -119,9 +119,9 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
/** Non-null if after returning advice binds the return value */
private String returningName = null;
private Class discoveredReturningType = Object.class;
private Class<?> discoveredReturningType = Object.class;
private Class discoveredThrowingType = Object.class;
private Class<?> discoveredThrowingType = Object.class;
/**
* Index for thisJoinPoint argument (currently only
@@ -253,7 +253,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
if (argumentNames != null) {
if (aspectJAdviceMethod.getParameterTypes().length == argumentNames.length + 1) {
// May need to add implicit join point arg name...
Class firstArgType = aspectJAdviceMethod.getParameterTypes()[0];
Class<?> firstArgType = aspectJAdviceMethod.getParameterTypes()[0];
if (firstArgType == JoinPoint.class ||
firstArgType == ProceedingJoinPoint.class ||
firstArgType == JoinPoint.StaticPart.class) {
@@ -292,7 +292,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
}
}
protected Class getDiscoveredReturningType() {
protected Class<?> getDiscoveredReturningType() {
return this.discoveredReturningType;
}
@@ -326,7 +326,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
}
}
protected Class getDiscoveredThrowingType() {
protected Class<?> getDiscoveredThrowingType() {
return this.discoveredThrowingType;
}
@@ -364,7 +364,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
}
int numUnboundArgs = this.adviceInvocationArgumentCount;
Class[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes();
Class<?>[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes();
if (maybeBindJoinPoint(parameterTypes[0]) || maybeBindProceedingJoinPoint(parameterTypes[0])) {
numUnboundArgs--;
}
@@ -380,7 +380,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
this.argumentsIntrospected = true;
}
private boolean maybeBindJoinPoint(Class candidateParameterType) {
private boolean maybeBindJoinPoint(Class<?> candidateParameterType) {
if (candidateParameterType.equals(JoinPoint.class)) {
this.joinPointArgumentIndex = 0;
return true;
@@ -390,7 +390,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
}
}
private boolean maybeBindProceedingJoinPoint(Class candidateParameterType) {
private boolean maybeBindProceedingJoinPoint(Class<?> candidateParameterType) {
if (candidateParameterType.equals(ProceedingJoinPoint.class)) {
if (!supportsProceedingJoinPoint()) {
throw new IllegalArgumentException("ProceedingJoinPoint is only supported for around advice");
@@ -407,7 +407,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
return false;
}
private boolean maybeBindJoinPointStaticPart(Class candidateParameterType) {
private boolean maybeBindJoinPointStaticPart(Class<?> candidateParameterType) {
if (candidateParameterType.equals(JoinPoint.StaticPart.class)) {
this.joinPointStaticPartArgumentIndex = 0;
return true;
@@ -509,8 +509,8 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
numParametersToRemove++;
}
String[] pointcutParameterNames = new String[this.argumentNames.length - numParametersToRemove];
Class[] pointcutParameterTypes = new Class[pointcutParameterNames.length];
Class[] methodParameterTypes = this.aspectJAdviceMethod.getParameterTypes();
Class<?>[] pointcutParameterTypes = new Class<?>[pointcutParameterNames.length];
Class<?>[] methodParameterTypes = this.aspectJAdviceMethod.getParameterTypes();
int index = 0;
for (int i = 0; i < this.argumentNames.length; i++) {
@@ -679,7 +679,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
}
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return !this.adviceMethod.equals(method);
}
@@ -21,7 +21,6 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -29,7 +28,6 @@ import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.weaver.tools.PointcutParser;
import org.aspectj.weaver.tools.PointcutPrimitive;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.util.StringUtils;
@@ -142,9 +140,8 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
singleValuedAnnotationPcds.add("@withincode");
singleValuedAnnotationPcds.add("@annotation");
Set pointcutPrimitives = PointcutParser.getAllSupportedPointcutPrimitives();
for (Iterator iterator = pointcutPrimitives.iterator(); iterator.hasNext();) {
PointcutPrimitive primitive = (PointcutPrimitive) iterator.next();
Set<PointcutPrimitive> pointcutPrimitives = PointcutParser.getAllSupportedPointcutPrimitives();
for (PointcutPrimitive primitive : pointcutPrimitives) {
nonReferencePointcutTokens.add(primitive.getName());
}
nonReferencePointcutTokens.add("&&");
@@ -173,7 +170,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
*/
private String pointcutExpression;
private Class[] argumentTypes;
private Class<?>[] argumentTypes;
private String[] parameterNameBindings;
@@ -311,7 +308,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
* {@link #setRaiseExceptions(boolean) raiseExceptions} has been set to {@code true}
*/
@Override
public String[] getParameterNames(Constructor ctor) {
public String[] getParameterNames(Constructor<?> ctor) {
if (this.raiseExceptions) {
throw new UnsupportedOperationException("An advice method can never be a constructor");
}
@@ -731,7 +728,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
* Return {@code true} if the given argument type is a subclass
* of the given supertype.
*/
private boolean isSubtypeOf(Class supertype, int argumentNumber) {
private boolean isSubtypeOf(Class<?> supertype, int argumentNumber) {
return supertype.isAssignableFrom(this.argumentTypes[argumentNumber]);
}
@@ -759,7 +756,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
* Find the argument index with the given type, and bind the given
* {@code varName} in that position.
*/
private void findAndBind(Class argumentType, String varName) {
private void findAndBind(Class<?> argumentType, String varName) {
for (int i = 0; i < this.argumentTypes.length; i++) {
if (isUnbound(i) && isSubtypeOf(argumentType, i)) {
bindParameterName(i, varName);
@@ -70,8 +70,7 @@ public class AspectJAfterThrowingAdvice extends AbstractAspectJAdvice implements
* is only invoked if the thrown exception is a subtype of the given throwing type.
*/
private boolean shouldInvokeOnThrowing(Throwable t) {
Class throwingType = getDiscoveredThrowingType();
return throwingType.isAssignableFrom(t.getClass());
return getDiscoveredThrowingType().isAssignableFrom(t.getClass());
}
}
@@ -98,11 +98,11 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
private static final Log logger = LogFactory.getLog(AspectJExpressionPointcut.class);
private Class pointcutDeclarationScope;
private Class<?> pointcutDeclarationScope;
private String[] pointcutParameterNames = new String[0];
private Class[] pointcutParameterTypes = new Class[0];
private Class<?>[] pointcutParameterTypes = new Class<?>[0];
private BeanFactory beanFactory;
@@ -123,7 +123,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
* @param paramNames the parameter names for the pointcut
* @param paramTypes the parameter types for the pointcut
*/
public AspectJExpressionPointcut(Class declarationScope, String[] paramNames, Class[] paramTypes) {
public AspectJExpressionPointcut(Class<?> declarationScope, String[] paramNames, Class<?>[] paramTypes) {
this.pointcutDeclarationScope = declarationScope;
if (paramNames.length != paramTypes.length) {
throw new IllegalStateException(
@@ -137,7 +137,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
/**
* Set the declaration scope for the pointcut.
*/
public void setPointcutDeclarationScope(Class pointcutDeclarationScope) {
public void setPointcutDeclarationScope(Class<?> pointcutDeclarationScope) {
this.pointcutDeclarationScope = pointcutDeclarationScope;
}
@@ -151,7 +151,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
/**
* Set the parameter types for the pointcut.
*/
public void setParameterTypes(Class[] types) {
public void setParameterTypes(Class<?>[] types) {
this.pointcutParameterTypes = types;
}
@@ -248,7 +248,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
}
@Override
public boolean matches(Class targetClass) {
public boolean matches(Class<?> targetClass) {
checkReadyToMatch();
try {
return this.pointcutExpression.couldMatchJoinPointsInType(targetClass);
@@ -272,7 +272,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
}
@Override
public boolean matches(Method method, Class targetClass, boolean beanHasIntroductions) {
public boolean matches(Method method, Class<?> targetClass, boolean beanHasIntroductions) {
checkReadyToMatch();
Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
ShadowMatch shadowMatch = getShadowMatch(targetMethod, method);
@@ -293,7 +293,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
}
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return matches(method, targetClass, false);
}
@@ -304,7 +304,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
}
@Override
public boolean matches(Method method, Class targetClass, Object[] args) {
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
checkReadyToMatch();
ShadowMatch shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method);
ShadowMatch originalShadowMatch = getShadowMatch(method, method);
@@ -377,7 +377,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
return !(getRuntimeTestWalker(shadowMatch).testsSubtypeSensitiveVars());
}
private boolean matchesTarget(ShadowMatch shadowMatch, Class targetClass) {
private boolean matchesTarget(ShadowMatch shadowMatch, Class<?> targetClass) {
return getRuntimeTestWalker(shadowMatch).testTargetInstanceOfResidue(targetClass);
}
@@ -542,11 +542,15 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
}
@Override
@SuppressWarnings("rawtypes")
@Deprecated
public boolean couldMatchJoinPointsInType(Class someClass) {
return (contextMatch(someClass) == FuzzyBoolean.YES);
}
@Override
@SuppressWarnings("rawtypes")
@Deprecated
public boolean couldMatchJoinPointsInType(Class someClass, MatchingContext context) {
return (contextMatch(someClass) == FuzzyBoolean.YES);
}
@@ -566,7 +570,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
return false;
}
private FuzzyBoolean contextMatch(Class targetType) {
private FuzzyBoolean contextMatch(Class<?> targetType) {
String advisedBeanName = getCurrentProxiedBeanName();
if (advisedBeanName == null) { // no proxy creation in progress
// abstain; can't return YES, since that will make pointcut with negation fail
@@ -44,7 +44,7 @@ public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv
this.pointcut.setLocation(location);
}
public void setParameterTypes(Class[] types) {
public void setParameterTypes(Class<?>[] types) {
this.pointcut.setParameterTypes(types);
}
@@ -34,7 +34,7 @@ import org.springframework.aop.support.DelegatingIntroductionInterceptor;
*/
public class DeclareParentsAdvisor implements IntroductionAdvisor {
private final Class introducedInterface;
private final Class<?> introducedInterface;
private final ClassFilter typePatternClassFilter;
@@ -47,7 +47,7 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
* @param typePattern type pattern the introduction is restricted to
* @param defaultImpl the default implementation class
*/
public DeclareParentsAdvisor(Class interfaceType, String typePattern, Class defaultImpl) {
public DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, Class<?> defaultImpl) {
this(interfaceType, typePattern, defaultImpl,
new DelegatePerTargetObjectIntroductionInterceptor(defaultImpl, interfaceType));
}
@@ -58,7 +58,7 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
* @param typePattern type pattern the introduction is restricted to
* @param delegateRef the delegate implementation object
*/
public DeclareParentsAdvisor(Class interfaceType, String typePattern, Object delegateRef) {
public DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, Object delegateRef) {
this(interfaceType, typePattern, delegateRef.getClass(),
new DelegatingIntroductionInterceptor(delegateRef));
}
@@ -71,14 +71,14 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
* @param implementationClass implementation class
* @param advice delegation advice
*/
private DeclareParentsAdvisor(Class interfaceType, String typePattern, Class implementationClass, Advice advice) {
private DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, Class<?> implementationClass, Advice advice) {
this.introducedInterface = interfaceType;
ClassFilter typePatternFilter = new TypePatternClassFilter(typePattern);
// Excludes methods implemented.
ClassFilter exclusion = new ClassFilter() {
@Override
public boolean matches(Class clazz) {
public boolean matches(Class<?> clazz) {
return !(introducedInterface.isAssignableFrom(clazz));
}
};
@@ -109,8 +109,8 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
}
@Override
public Class[] getInterfaces() {
return new Class[] {this.introducedInterface};
public Class<?>[] getInterfaces() {
return new Class<?>[] {this.introducedInterface};
}
}
@@ -189,7 +189,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
}
@Override
public Class getDeclaringType() {
public Class<?> getDeclaringType() {
return methodInvocation.getMethod().getDeclaringClass();
}
@@ -199,7 +199,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
}
@Override
public Class getReturnType() {
public Class<?> getReturnType() {
return methodInvocation.getMethod().getReturnType();
}
@@ -209,7 +209,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
}
@Override
public Class[] getParameterTypes() {
public Class<?>[] getParameterTypes() {
return methodInvocation.getMethod().getParameterTypes();
}
@@ -222,7 +222,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
}
@Override
public Class[] getExceptionTypes() {
public Class<?>[] getExceptionTypes() {
return methodInvocation.getMethod().getExceptionTypes();
}
@@ -256,7 +256,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
sb.append(".");
sb.append(getMethod().getName());
sb.append("(");
Class[] parametersTypes = getParameterTypes();
Class<?>[] parametersTypes = getParameterTypes();
appendTypes(sb, parametersTypes, includeReturnTypeAndArgs, useLongReturnAndArgumentTypeName);
sb.append(")");
return sb.toString();
@@ -297,7 +297,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
private class SourceLocationImpl implements SourceLocation {
@Override
public Class getWithinType() {
public Class<?> getWithinType() {
if (methodInvocation.getThis() == null) {
throw new UnsupportedOperationException("No source location joinpoint available: target is null");
}
@@ -315,6 +315,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
}
@Override
@Deprecated
public int getColumn() {
throw new UnsupportedOperationException();
}
@@ -87,12 +87,12 @@ class RuntimeTestWalker {
new SubtypeSensitiveVarTypeTestVisitor().testsSubtypeSensitiveVars(this.runtimeTest));
}
public boolean testThisInstanceOfResidue(Class thisClass) {
public boolean testThisInstanceOfResidue(Class<?> thisClass) {
return (this.runtimeTest != null &&
new ThisInstanceOfResidueTestVisitor(thisClass).thisInstanceOfMatches(this.runtimeTest));
}
public boolean testTargetInstanceOfResidue(Class targetClass) {
public boolean testTargetInstanceOfResidue(Class<?> targetClass) {
return (this.runtimeTest != null &&
new TargetInstanceOfResidueTestVisitor(targetClass).targetInstanceOfMatches(this.runtimeTest));
}
@@ -169,11 +169,11 @@ class RuntimeTestWalker {
private static abstract class InstanceOfResidueTestVisitor extends TestVisitorAdapter {
private Class matchClass;
private Class<?> matchClass;
private boolean matches;
private int matchVarType;
public InstanceOfResidueTestVisitor(Class matchClass, boolean defaultMatches, int matchVarType) {
public InstanceOfResidueTestVisitor(Class<?> matchClass, boolean defaultMatches, int matchVarType) {
this.matchClass = matchClass;
this.matches = defaultMatches;
this.matchVarType = matchVarType;
@@ -192,7 +192,7 @@ class RuntimeTestWalker {
return;
}
try {
Class typeClass = ClassUtils.forName(type.getName(), this.matchClass.getClassLoader());
Class<?> typeClass = ClassUtils.forName(type.getName(), this.matchClass.getClassLoader());
// Don't use ReflectionType.isAssignableFrom() as it won't be aware of (Spring) mixins
this.matches = typeClass.isAssignableFrom(this.matchClass);
}
@@ -208,7 +208,7 @@ class RuntimeTestWalker {
*/
private static class TargetInstanceOfResidueTestVisitor extends InstanceOfResidueTestVisitor {
public TargetInstanceOfResidueTestVisitor(Class targetClass) {
public TargetInstanceOfResidueTestVisitor(Class<?> targetClass) {
super(targetClass, false, TARGET_VAR);
}
@@ -223,7 +223,7 @@ class RuntimeTestWalker {
*/
private static class ThisInstanceOfResidueTestVisitor extends InstanceOfResidueTestVisitor {
public ThisInstanceOfResidueTestVisitor(Class thisClass) {
public ThisInstanceOfResidueTestVisitor(Class<?> thisClass) {
super(thisClass, true, THIS_VAR);
}
@@ -29,14 +29,14 @@ import org.springframework.util.Assert;
*/
public class SimpleAspectInstanceFactory implements AspectInstanceFactory {
private final Class aspectClass;
private final Class<?> aspectClass;
/**
* Create a new SimpleAspectInstanceFactory for the given aspect class.
* @param aspectClass the aspect class
*/
public SimpleAspectInstanceFactory(Class aspectClass) {
public SimpleAspectInstanceFactory(Class<?> aspectClass) {
Assert.notNull(aspectClass, "Aspect class must not be null");
this.aspectClass = aspectClass;
}
@@ -44,7 +44,7 @@ public class SimpleAspectInstanceFactory implements AspectInstanceFactory {
/**
* Return the specified aspect class (never {@code null}).
*/
public final Class getAspectClass() {
public final Class<?> getAspectClass() {
return this.aspectClass;
}
@@ -94,7 +94,7 @@ public class TypePatternClassFilter implements ClassFilter {
* @throws IllegalStateException if no {@link #setTypePattern(String)} has been set
*/
@Override
public boolean matches(Class clazz) {
public boolean matches(Class<?> clazz) {
if (this.aspectJTypePatternMatcher == null) {
throw new IllegalStateException("No 'typePattern' has been set via ctor/setter.");
}
@@ -37,11 +37,9 @@ import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.AjType;
import org.aspectj.lang.reflect.AjTypeSystem;
import org.aspectj.lang.reflect.PerClauseKind;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.aop.framework.AopConfigException;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.PrioritizedParameterNameDiscoverer;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.StringUtils;
@@ -67,11 +65,11 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
* (there <i>should</i> only be one anyway...)
*/
@SuppressWarnings("unchecked")
protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method method) {
Class<? extends Annotation>[] classesToLookFor = new Class[] {
protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) {
Class<?>[] classesToLookFor = new Class<?>[] {
Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class, Pointcut.class};
for (Class<? extends Annotation> c : classesToLookFor) {
AspectJAnnotation foundAnnotation = findAnnotation(method, c);
for (Class<?> c : classesToLookFor) {
AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) c);
if (foundAnnotation != null) {
return foundAnnotation;
}
@@ -156,7 +154,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
* formal parameters for the pointcut.
*/
protected AspectJExpressionPointcut createPointcutExpression(
Method annotatedMethod, Class declarationScope, String[] pointcutParameterNames) {
Method annotatedMethod, Class<?> declarationScope, String[] pointcutParameterNames) {
Class<?> [] pointcutParameterTypes = new Class<?>[0];
if (pointcutParameterNames != null) {
@@ -210,8 +208,8 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
private static final String[] EXPRESSION_PROPERTIES = new String[] {"value", "pointcut"};
private static Map<Class, AspectJAnnotationType> annotationTypes =
new HashMap<Class, AspectJAnnotationType>();
private static Map<Class<?>, AspectJAnnotationType> annotationTypes =
new HashMap<Class<?>, AspectJAnnotationType>();
static {
annotationTypes.put(Pointcut.class,AspectJAnnotationType.AtPointcut);
@@ -245,7 +243,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
}
private AspectJAnnotationType determineAnnotationType(A annotation) {
for (Class type : annotationTypes.keySet()) {
for (Class<?> type : annotationTypes.keySet()) {
if (type.isInstance(annotation)) {
return annotationTypes.get(type);
}
@@ -307,7 +305,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
if (method.getParameterTypes().length == 0) {
return new String[0];
}
AspectJAnnotation annotation = findAspectJAnnotationOnMethod(method);
AspectJAnnotation<?> annotation = findAspectJAnnotationOnMethod(method);
if (annotation == null) {
return null;
}
@@ -325,7 +323,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
}
@Override
public String[] getParameterNames(Constructor ctor) {
public String[] getParameterNames(Constructor<?> ctor) {
throw new UnsupportedOperationException("Spring AOP cannot handle constructor advice");
}
}
@@ -89,7 +89,7 @@ public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorA
}
@Override
protected boolean isInfrastructureClass(Class beanClass) {
protected boolean isInfrastructureClass(Class<?> beanClass) {
// Previously we setProxyTargetClass(true) in the constructor, but that has too
// broad an impact. Instead we now override isInfrastructureClass to avoid proxying
// aspects. I'm not entirely happy with that as there is no good reason not
@@ -50,7 +50,7 @@ import org.springframework.util.ClassUtils;
public class AspectJProxyFactory extends ProxyCreatorSupport {
/** Cache for singleton aspect instances */
private static final Map<Class, Object> aspectCache = new HashMap<Class, Object>();
private static final Map<Class<?>, Object> aspectCache = new HashMap<Class<?>, Object>();
private final AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory();
@@ -76,7 +76,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
* Create a new {@code AspectJProxyFactory}.
* No target, only interfaces. Must add interceptors.
*/
public AspectJProxyFactory(Class[] interfaces) {
public AspectJProxyFactory(Class<?>[] interfaces) {
setInterfaces(interfaces);
}
@@ -89,7 +89,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
* @param aspectInstance the AspectJ aspect instance
*/
public void addAspect(Object aspectInstance) {
Class aspectClass = aspectInstance.getClass();
Class<?> aspectClass = aspectInstance.getClass();
String aspectName = aspectClass.getName();
AspectMetadata am = createAspectMetadata(aspectClass, aspectName);
if (am.getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON) {
@@ -104,7 +104,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
* Add an aspect of the supplied type to the end of the advice chain.
* @param aspectClass the AspectJ aspect class
*/
public void addAspect(Class aspectClass) {
public void addAspect(Class<?> aspectClass) {
String aspectName = aspectClass.getName();
AspectMetadata am = createAspectMetadata(aspectClass, aspectName);
MetadataAwareAspectInstanceFactory instanceFactory = createAspectInstanceFactory(am, aspectClass, aspectName);
@@ -128,7 +128,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
/**
* Create an {@link AspectMetadata} instance for the supplied aspect type.
*/
private AspectMetadata createAspectMetadata(Class aspectClass, String aspectName) {
private AspectMetadata createAspectMetadata(Class<?> aspectClass, String aspectName) {
AspectMetadata am = new AspectMetadata(aspectClass, aspectName);
if (!am.getAjType().isAspect()) {
throw new IllegalArgumentException("Class [" + aspectClass.getName() + "] is not a valid aspect type");
@@ -142,7 +142,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
* a {@link PrototypeAspectInstanceFactory} is returned.
*/
private MetadataAwareAspectInstanceFactory createAspectInstanceFactory(
AspectMetadata am, Class aspectClass, String aspectName) {
AspectMetadata am, Class<?> aspectClass, String aspectName) {
MetadataAwareAspectInstanceFactory instanceFactory = null;
if (am.getAjType().getPerClause().getKind() == PerClauseKind.SINGLETON) {
@@ -161,7 +161,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
* Get the singleton aspect instance for the supplied aspect type. An instance
* is created if one cannot be found in the instance cache.
*/
private Object getSingletonAspectInstance(Class aspectClass) {
private Object getSingletonAspectInstance(Class<?> aspectClass) {
synchronized (aspectCache) {
Object instance = aspectCache.get(aspectClass);
if (instance != null) {
@@ -45,7 +45,7 @@ public class AspectMetadata {
/**
* AspectJ reflection information (AspectJ 5 / Java 5 specific).
*/
private final AjType ajType;
private final AjType<?> ajType;
/**
* Spring AOP pointcut corresponding to the per clause of the
@@ -71,9 +71,9 @@ public class AspectMetadata {
this.aspectName = aspectName;
Class<?> currClass = aspectClass;
AjType ajType = null;
AjType<?> ajType = null;
while (!currClass.equals(Object.class)) {
AjType ajTypeToCheck = AjTypeSystem.getAjType(currClass);
AjType<?> ajTypeToCheck = AjTypeSystem.getAjType(currClass);
if (ajTypeToCheck.isAspect()) {
ajType = ajTypeToCheck;
break;
@@ -124,14 +124,14 @@ public class AspectMetadata {
/**
* Return AspectJ reflection information.
*/
public AjType getAjType() {
public AjType<?> getAjType() {
return this.ajType;
}
/**
* Return the aspect class.
*/
public Class getAspectClass() {
public Class<?> getAspectClass() {
return this.ajType.getJavaClass();
}
@@ -66,7 +66,7 @@ public class BeanFactoryAspectInstanceFactory implements MetadataAwareAspectInst
* @param name the name of the bean
* @param type the type that should be introspected by AspectJ
*/
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class type) {
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class<?> type) {
this.beanFactory = beanFactory;
this.name = name;
this.aspectMetadata = new AspectMetadata(type, name);
@@ -96,7 +96,7 @@ public class BeanFactoryAspectJAdvisorsBuilder {
// We must be careful not to instantiate beans eagerly as in this
// case they would be cached by the Spring container but would not
// have been weaved
Class beanType = this.beanFactory.getType(beanName);
Class<?> beanType = this.beanFactory.getType(beanName);
if (beanType == null) {
continue;
}
@@ -134,7 +134,7 @@ public class BeanFactoryAspectJAdvisorsBuilder {
}
if (aspectNames.isEmpty()) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
List<Advisor> advisors = new LinkedList<Advisor>();
for (String aspectName : aspectNames) {
@@ -249,14 +249,14 @@ class InstantiationModelAwarePointcutAdvisorImpl
}
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
// We're either instantiated and matching on declared pointcut, or uninstantiated matching on either pointcut
return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass)) ||
this.preInstantiationPointcut.getMethodMatcher().matches(method, targetClass);
}
@Override
public boolean matches(Method method, Class targetClass, Object[] args) {
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
// This can match only on declared pointcut.
return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass));
}
@@ -190,7 +190,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
return null;
}
AspectJExpressionPointcut ajexp =
new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class[0]);
new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class<?>[0]);
ajexp.setExpression(aspectJAnnotation.getPointcutExpression());
return ajexp;
}
@@ -40,7 +40,7 @@ public class SimpleMetadataAwareAspectInstanceFactory extends SimpleAspectInstan
* @param aspectClass the aspect class
* @param aspectName the aspect name
*/
public SimpleMetadataAwareAspectInstanceFactory(Class aspectClass, String aspectName) {
public SimpleMetadataAwareAspectInstanceFactory(Class<?> aspectClass, String aspectName) {
super(aspectClass);
this.metadata = new AspectMetadata(aspectClass, aspectName);
}
@@ -46,7 +46,7 @@ import org.springframework.util.ClassUtils;
@SuppressWarnings("serial")
public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator {
private static final Comparator DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator();
private static final Comparator<Advisor> DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator();
/**
@@ -98,7 +98,7 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
}
@Override
protected boolean shouldSkip(Class beanClass, String beanName) {
protected boolean shouldSkip(Class<?> beanClass, String beanName) {
// TODO: Consider optimization by caching the list of the aspect names
List<Advisor> candidateAdvisors = findCandidateAdvisors();
for (Advisor advisor : candidateAdvisors) {
@@ -48,7 +48,7 @@ import org.springframework.util.Assert;
* @author Juergen Hoeller
* @since 2.0
*/
class AspectJPrecedenceComparator implements Comparator {
class AspectJPrecedenceComparator implements Comparator<Advisor> {
private static final int HIGHER_PRECEDENCE = -1;
private static final int SAME_PRECEDENCE = 0;
@@ -76,18 +76,10 @@ class AspectJPrecedenceComparator implements Comparator {
@Override
public int compare(Object o1, Object o2) {
if (!(o1 instanceof Advisor && o2 instanceof Advisor)) {
throw new IllegalArgumentException(
"AspectJPrecedenceComparator can only compare the order of Advisors, " +
"but was passed [" + o1 + "] and [" + o2 + "]");
}
Advisor advisor1 = (Advisor) o1;
Advisor advisor2 = (Advisor) o2;
int advisorPrecedence = this.advisorComparator.compare(advisor1, advisor2);
if (advisorPrecedence == SAME_PRECEDENCE && declaredInSameAspect(advisor1, advisor2)) {
advisorPrecedence = comparePrecedenceWithinAspect(advisor1, advisor2);
public int compare(Advisor o1, Advisor o2) {
int advisorPrecedence = this.advisorComparator.compare(o1, o2);
if (advisorPrecedence == SAME_PRECEDENCE && declaredInSameAspect(o1, o2)) {
advisorPrecedence = comparePrecedenceWithinAspect(o1, o2);
}
return advisorPrecedence;
}
@@ -54,7 +54,7 @@ public abstract class AopConfigUtils {
/**
* Stores the auto proxy creator classes in escalation order.
*/
private static final List<Class> APC_PRIORITY_LIST = new ArrayList<Class>();
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<Class<?>>();
/**
* Setup the escalation list.
@@ -105,7 +105,7 @@ public abstract class AopConfigUtils {
}
private static BeanDefinition registerOrEscalateApcAsRequired(Class cls, BeanDefinitionRegistry registry, Object source) {
private static BeanDefinition registerOrEscalateApcAsRequired(Class<?> cls, BeanDefinitionRegistry registry, Object source) {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
if (registry.containsBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME)) {
BeanDefinition apcDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
@@ -126,13 +126,13 @@ public abstract class AopConfigUtils {
return beanDefinition;
}
private static int findPriorityForClass(Class clazz) {
private static int findPriorityForClass(Class<?> clazz) {
return APC_PRIORITY_LIST.indexOf(clazz);
}
private static int findPriorityForClass(String className) {
for (int i = 0; i < APC_PRIORITY_LIST.size(); i++) {
Class clazz = APC_PRIORITY_LIST.get(i);
Class<?> clazz = APC_PRIORITY_LIST.get(i);
if (clazz.getName().equals(className)) {
return i;
}
@@ -405,7 +405,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
/**
* Gets the advice implementation class corresponding to the supplied {@link Element}.
*/
private Class getAdviceClass(Element adviceElement, ParserContext parserContext) {
private Class<?> getAdviceClass(Element adviceElement, ParserContext parserContext) {
String elementName = parserContext.getDelegate().getLocalName(adviceElement);
if (BEFORE.equals(elementName)) {
return AspectJMethodBeforeAdvice.class;
@@ -66,7 +66,7 @@ public class MethodLocatingFactoryBean implements FactoryBean<Method>, BeanFacto
throw new IllegalArgumentException("Property 'methodName' is required");
}
Class beanClass = beanFactory.getType(this.targetBeanName);
Class<?> beanClass = beanFactory.getType(this.targetBeanName);
if (beanClass == null) {
throw new IllegalArgumentException("Can't determine type of bean with name '" + this.targetBeanName + "'");
}
@@ -49,7 +49,7 @@ public abstract class AbstractAdvisingBeanPostProcessor extends ProxyConfig
*/
private int order = Ordered.LOWEST_PRECEDENCE;
private final Map<Class, Boolean> eligibleBeans = new ConcurrentHashMap<Class, Boolean>(64);
private final Map<Class<?>, Boolean> eligibleBeans = new ConcurrentHashMap<Class<?>, Boolean>(64);
/**
@@ -58,7 +58,6 @@ import org.springframework.util.CollectionUtils;
* @author Juergen Hoeller
* @see org.springframework.aop.framework.AopProxy
*/
@SuppressWarnings("unchecked")
public class AdvisedSupport extends ProxyConfig implements Advised {
/** use serialVersionUID from Spring 2.0 for interoperability */
@@ -88,7 +87,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
* Interfaces to be implemented by the proxy. Held in List to keep the order
* of registration, to create JDK proxy with specified order of interfaces.
*/
private List<Class> interfaces = new ArrayList<Class>();
private List<Class<?>> interfaces = new ArrayList<Class<?>>();
/**
* List of Advisors. If an Advice is added, it will be wrapped
@@ -114,7 +113,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
* Create a AdvisedSupport instance with the given parameters.
* @param interfaces the proxied interfaces
*/
public AdvisedSupport(Class[] interfaces) {
public AdvisedSupport(Class<?>[] interfaces) {
this();
setInterfaces(interfaces);
}
@@ -202,7 +201,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
public void setInterfaces(Class<?>... interfaces) {
Assert.notNull(interfaces, "Interfaces must not be null");
this.interfaces.clear();
for (Class ifc : interfaces) {
for (Class<?> ifc : interfaces) {
addInterface(ifc);
}
}
@@ -235,12 +234,12 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
@Override
public Class<?>[] getProxiedInterfaces() {
return this.interfaces.toArray(new Class[this.interfaces.size()]);
return this.interfaces.toArray(new Class<?>[this.interfaces.size()]);
}
@Override
public boolean isInterfaceProxied(Class<?> intf) {
for (Class proxyIntf : this.interfaces) {
for (Class<?> proxyIntf : this.interfaces) {
if (intf.isAssignableFrom(proxyIntf)) {
return true;
}
@@ -355,8 +354,8 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
private void validateIntroductionAdvisor(IntroductionAdvisor advisor) {
advisor.validateInterfaces();
// If the advisor passed validation, we can make the change.
Class[] ifcs = advisor.getInterfaces();
for (Class ifc : ifcs) {
Class<?>[] ifcs = advisor.getInterfaces();
for (Class<?> ifc : ifcs) {
addInterface(ifc);
}
}
@@ -463,7 +462,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
* @param adviceClass the advice class to check
* @return the count of the interceptors of this class or subclasses
*/
public int countAdvicesOfType(Class adviceClass) {
public int countAdvicesOfType(Class<?> adviceClass) {
int count = 0;
if (adviceClass != null) {
for (Advisor advisor : this.advisors) {
@@ -483,7 +482,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
* @param targetClass the target class
* @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers)
*/
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(Method method, Class targetClass) {
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(Method method, Class<?> targetClass) {
MethodCacheKey cacheKey = new MethodCacheKey(method);
List<Object> cached = this.methodCache.get(cacheKey);
if (cached == null) {
@@ -521,7 +520,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
copyFrom(other);
this.targetSource = targetSource;
this.advisorChainFactory = other.advisorChainFactory;
this.interfaces = new ArrayList<Class>(other.interfaces);
this.interfaces = new ArrayList<Class<?>>(other.interfaces);
for (Advisor advisor : advisors) {
if (advisor instanceof IntroductionAdvisor) {
validateIntroductionAdvisor((IntroductionAdvisor) advisor);
@@ -36,6 +36,6 @@ public interface AdvisorChainFactory {
* @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers)
*/
List<Object> getInterceptorsAndDynamicInterceptionAdvice(
Advised config, Method method, Class targetClass);
Advised config, Method method, Class<?> targetClass);
}
@@ -78,13 +78,13 @@ public abstract class AopProxyUtils {
* @see Advised
* @see org.springframework.aop.SpringProxy
*/
public static Class[] completeProxiedInterfaces(AdvisedSupport advised) {
Class[] specifiedInterfaces = advised.getProxiedInterfaces();
public static Class<?>[] completeProxiedInterfaces(AdvisedSupport advised) {
Class<?>[] specifiedInterfaces = advised.getProxiedInterfaces();
if (specifiedInterfaces.length == 0) {
// No user-specified interfaces: check whether target class is an interface.
Class targetClass = advised.getTargetClass();
Class<?> targetClass = advised.getTargetClass();
if (targetClass != null && targetClass.isInterface()) {
specifiedInterfaces = new Class[] {targetClass};
specifiedInterfaces = new Class<?>[] {targetClass};
}
}
boolean addSpringProxy = !advised.isInterfaceProxied(SpringProxy.class);
@@ -96,7 +96,7 @@ public abstract class AopProxyUtils {
if (addAdvised) {
nonUserIfcCount++;
}
Class[] proxiedInterfaces = new Class[specifiedInterfaces.length + nonUserIfcCount];
Class<?>[] proxiedInterfaces = new Class<?>[specifiedInterfaces.length + nonUserIfcCount];
System.arraycopy(specifiedInterfaces, 0, proxiedInterfaces, 0, specifiedInterfaces.length);
if (addSpringProxy) {
proxiedInterfaces[specifiedInterfaces.length] = SpringProxy.class;
@@ -115,8 +115,8 @@ public abstract class AopProxyUtils {
* in the original order (never {@code null} or empty)
* @see Advised
*/
public static Class[] proxiedUserInterfaces(Object proxy) {
Class[] proxyInterfaces = proxy.getClass().getInterfaces();
public static Class<?>[] proxiedUserInterfaces(Object proxy) {
Class<?>[] proxyInterfaces = proxy.getClass().getInterfaces();
int nonUserIfcCount = 0;
if (proxy instanceof SpringProxy) {
nonUserIfcCount++;
@@ -124,7 +124,7 @@ public abstract class AopProxyUtils {
if (proxy instanceof Advised) {
nonUserIfcCount++;
}
Class[] userInterfaces = new Class[proxyInterfaces.length - nonUserIfcCount];
Class<?>[] userInterfaces = new Class<?>[proxyInterfaces.length - nonUserIfcCount];
System.arraycopy(proxyInterfaces, 0, userInterfaces, 0, userInterfaces.length);
Assert.notEmpty(userInterfaces, "JDK proxy must implement one or more interfaces");
return userInterfaces;
@@ -187,7 +187,7 @@ class CglibAopProxy implements AopProxy, Serializable {
enhancer.setInterfaces(AopProxyUtils.completeProxiedInterfaces(this.advised));
Callback[] callbacks = getCallbacks(rootClass);
Class<?>[] types = new Class[callbacks.length];
Class<?>[] types = new Class<?>[callbacks.length];
for (int x = 0; x < types.length; x++) {
types[x] = callbacks[x].getClass();
@@ -48,7 +48,7 @@ public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializ
@Override
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(
Advised config, Method method, Class targetClass) {
Advised config, Method method, Class<?> targetClass) {
// This is somewhat tricky... we have to process introductions first,
// but we need to preserve order in the ultimate list.
@@ -94,7 +94,7 @@ public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializ
/**
* Determine whether the Advisors contain matching introductions.
*/
private static boolean hasMatchingIntroductions(Advised config, Class targetClass) {
private static boolean hasMatchingIntroductions(Advised config, Class<?> targetClass) {
for (int i = 0; i < config.getAdvisors().length; i++) {
Advisor advisor = config.getAdvisors()[i];
if (advisor instanceof IntroductionAdvisor) {
@@ -51,7 +51,7 @@ public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {
@Override
public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException {
if (config.isOptimize() || config.isProxyTargetClass() || hasNoUserSuppliedProxyInterfaces(config)) {
Class targetClass = config.getTargetClass();
Class<?> targetClass = config.getTargetClass();
if (targetClass == null) {
throw new AopConfigException("TargetSource cannot determine target class: " +
"Either an interface or a target is required for proxy creation.");
@@ -72,7 +72,7 @@ public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {
* (or no proxy interfaces specified at all).
*/
private boolean hasNoUserSuppliedProxyInterfaces(AdvisedSupport config) {
Class[] interfaces = config.getProxiedInterfaces();
Class<?>[] interfaces = config.getProxiedInterfaces();
return (interfaces.length == 0 || (interfaces.length == 1 && SpringProxy.class.equals(interfaces[0])));
}
}
@@ -116,7 +116,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
if (logger.isDebugEnabled()) {
logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource());
}
Class[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised);
Class<?>[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised);
findDefinedEqualsAndHashCodeMethods(proxiedInterfaces);
return Proxy.newProxyInstance(classLoader, proxiedInterfaces, this);
}
@@ -126,8 +126,8 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
* on the supplied set of interfaces.
* @param proxiedInterfaces the interfaces to introspect
*/
private void findDefinedEqualsAndHashCodeMethods(Class[] proxiedInterfaces) {
for (Class proxiedInterface : proxiedInterfaces) {
private void findDefinedEqualsAndHashCodeMethods(Class<?>[] proxiedInterfaces) {
for (Class<?> proxiedInterface : proxiedInterfaces) {
Method[] methods = proxiedInterface.getDeclaredMethods();
for (Method method : methods) {
if (AopUtils.isEqualsMethod(method)) {
@@ -156,7 +156,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
boolean setProxyContext = false;
TargetSource targetSource = this.advised.targetSource;
Class targetClass = null;
Class<?> targetClass = null;
Object target = null;
try {
@@ -32,6 +32,7 @@ import org.springframework.objenesis.ObjenesisStd;
* @author Oliver Gierke
* @since 4.0
*/
@SuppressWarnings("serial")
class ObjenesisCglibAopProxy extends CglibAopProxy {
private static final Log logger = LogFactory.getLog(ObjenesisCglibAopProxy.class);
@@ -133,7 +133,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
* @see #setInterfaces
* @see AbstractSingletonProxyFactoryBean#setProxyInterfaces
*/
public void setProxyInterfaces(Class[] proxyInterfaces) throws ClassNotFoundException {
public void setProxyInterfaces(Class<?>[] proxyInterfaces) throws ClassNotFoundException {
setInterfaces(proxyInterfaces);
}
@@ -267,7 +267,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
return this.singletonInstance.getClass();
}
}
Class[] ifcs = getProxiedInterfaces();
Class<?>[] ifcs = getProxiedInterfaces();
if (ifcs.length == 1) {
return ifcs[0];
}
@@ -297,7 +297,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
* @return the merged interface as Class
* @see java.lang.reflect.Proxy#getProxyClass
*/
protected Class createCompositeInterface(Class[] interfaces) {
protected Class<?> createCompositeInterface(Class<?>[] interfaces) {
return ClassUtils.createCompositeInterface(interfaces, this.proxyClassLoader);
}
@@ -311,7 +311,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
this.targetSource = freshTargetSource();
if (this.autodetectInterfaces && getProxiedInterfaces().length == 0 && !isProxyTargetClass()) {
// Rely on AOP infrastructure to tell us what interfaces to proxy.
Class targetClass = getTargetClass();
Class<?> targetClass = getTargetClass();
if (targetClass == null) {
throw new FactoryBeanNotInitializedException("Cannot determine target class for proxy");
}
@@ -401,7 +401,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
* @return {@code true} if it's an Advisor or Advice
*/
private boolean isNamedBeanAnAdvisorOrAdvice(String beanName) {
Class namedBeanClass = this.beanFactory.getType(beanName);
Class<?> namedBeanClass = this.beanFactory.getType(beanName);
if (namedBeanClass != null) {
return (Advisor.class.isAssignableFrom(namedBeanClass) || Advice.class.isAssignableFrom(namedBeanClass));
}
@@ -68,7 +68,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
protected Object[] arguments;
private final Class targetClass;
private final Class<?> targetClass;
/**
* Lazily initialized map of user-specific attributes for this invocation.
@@ -79,7 +79,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
* List of MethodInterceptor and InterceptorAndDynamicMethodMatcher
* that need dynamic checks.
*/
protected final List interceptorsAndDynamicMethodMatchers;
protected final List<?> interceptorsAndDynamicMethodMatchers;
/**
* Index from 0 of the current interceptor we're invoking.
@@ -103,7 +103,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
*/
protected ReflectiveMethodInvocation(
Object proxy, Object target, Method method, Object[] arguments,
Class targetClass, List<Object> interceptorsAndDynamicMethodMatchers) {
Class<?> targetClass, List<Object> interceptorsAndDynamicMethodMatchers) {
this.proxy = proxy;
this.target = target;
@@ -61,7 +61,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
private final Object throwsAdvice;
/** Methods on throws advice, keyed by exception class */
private final Map<Class, Method> exceptionHandlerMap = new HashMap<Class, Method>();
private final Map<Class<?>, Method> exceptionHandlerMap = new HashMap<Class<?>, Method>();
/**
@@ -104,7 +104,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
* @return a handler for the given exception type
*/
private Method getExceptionHandler(Throwable exception) {
Class exceptionClass = exception.getClass();
Class<?> exceptionClass = exception.getClass();
if (logger.isTraceEnabled()) {
logger.trace("Trying to find handler for exception of type [" + exceptionClass.getName() + "]");
}
@@ -65,8 +65,8 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
@Override
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
List advisors = findEligibleAdvisors(beanClass, beanName);
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, TargetSource targetSource) {
List<Advisor> advisors = findEligibleAdvisors(beanClass, beanName);
if (advisors.isEmpty()) {
return DO_NOT_PROXY;
}
@@ -83,7 +83,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
* @see #sortAdvisors
* @see #extendAdvisors
*/
protected List<Advisor> findEligibleAdvisors(Class beanClass, String beanName) {
protected List<Advisor> findEligibleAdvisors(Class<?> beanClass, String beanName) {
List<Advisor> candidateAdvisors = findCandidateAdvisors();
List<Advisor> eligibleAdvisors = findAdvisorsThatCanApply(candidateAdvisors, beanClass, beanName);
extendAdvisors(eligibleAdvisors);
@@ -111,7 +111,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
* @see ProxyCreationContext#getCurrentProxiedBeanName()
*/
protected List<Advisor> findAdvisorsThatCanApply(
List<Advisor> candidateAdvisors, Class beanClass, String beanName) {
List<Advisor> candidateAdvisors, Class<?> beanClass, String beanName) {
ProxyCreationContext.setCurrentProxiedBeanName(beanName);
try {
@@ -73,7 +73,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
* Identify as bean to proxy if the bean name is in the configured list of names.
*/
@Override
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, TargetSource targetSource) {
if (this.beanNames != null) {
for (String mappedName : this.beanNames) {
if (FactoryBean.class.isAssignableFrom(beanClass)) {
@@ -60,7 +60,7 @@ public class LazyInitTargetSourceCreator extends AbstractBeanFactoryBasedTargetS
@Override
protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
Class beanClass, String beanName) {
Class<?> beanClass, String beanName) {
if (getBeanFactory() instanceof ConfigurableListableBeanFactory) {
BeanDefinition definition =
@@ -41,7 +41,7 @@ public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSour
@Override
protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
Class beanClass, String beanName) {
Class<?> beanClass, String beanName) {
if (beanName.startsWith(PREFIX_COMMONS_POOL)) {
CommonsPoolTargetSource cpts = new CommonsPoolTargetSource();
@@ -98,7 +98,7 @@ public abstract class AbstractMonitoringInterceptor extends AbstractTraceInterce
protected String createInvocationTraceName(MethodInvocation invocation) {
StringBuilder sb = new StringBuilder(getPrefix());
Method method = invocation.getMethod();
Class clazz = method.getDeclaringClass();
Class<?> clazz = method.getDeclaringClass();
if (this.logTargetClassInvocation && clazz.isInstance(invocation.getThis())) {
clazz = invocation.getThis().getClass();
}
@@ -142,7 +142,7 @@ public abstract class AbstractTraceInterceptor implements MethodInterceptor, Ser
* @return the target class for the given object
* @see #setHideProxyClassNames
*/
protected Class getClassForLogging(Object target) {
protected Class<?> getClassForLogging(Object target) {
return (this.hideProxyClassNames ? AopUtils.getTargetClass(target) : target.getClass());
}
@@ -151,7 +151,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
/**
* The {@code Set} of allowed placeholders.
*/
private static final Set ALLOWED_PLACEHOLDERS =
private static final Set<Object> ALLOWED_PLACEHOLDERS =
new Constants(CustomizableTraceInterceptor.class).getValues("PLACEHOLDER_");
@@ -395,7 +395,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
* @param output the {@code StringBuffer} containing the output
*/
private void appendArgumentTypes(MethodInvocation methodInvocation, Matcher matcher, StringBuffer output) {
Class[] argumentTypes = methodInvocation.getMethod().getParameterTypes();
Class<?>[] argumentTypes = methodInvocation.getMethod().getParameterTypes();
String[] argumentTypeShortNames = new String[argumentTypes.length];
for (int i = 0; i < argumentTypeShortNames.length; i++) {
argumentTypeShortNames[i] = ClassUtils.getShortName(argumentTypes[i]);
@@ -91,7 +91,7 @@ public class ScopedProxyFactoryBean extends ProxyConfig implements FactoryBean<O
pf.copyFrom(this);
pf.setTargetSource(this.scopedTargetSource);
Class beanType = beanFactory.getType(this.targetBeanName);
Class<?> beanType = beanFactory.getType(this.targetBeanName);
if (beanType == null) {
throw new IllegalStateException("Cannot create scoped proxy for bean '" + this.targetBeanName +
"': Target type could not be determined at the time of proxy creation.");
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -38,7 +38,7 @@ public abstract class ScopedProxyUtils {
/**
* Generates a scoped proxy for the supplied target bean, registering the target
* Generate a scoped proxy for the supplied target bean, registering the target
* bean with an internal name and setting 'targetBeanName' on the scoped proxy.
* @param definition the original bean definition
* @param registry the bean definition registry
@@ -54,7 +54,7 @@ public abstract class ScopedProxyUtils {
// Create a scoped proxy definition for the original bean name,
// "hiding" the target bean in an internal target definition.
RootBeanDefinition proxyDefinition = new RootBeanDefinition(ScopedProxyFactoryBean.class);
proxyDefinition.setOriginatingBeanDefinition(definition.getBeanDefinition());
proxyDefinition.setOriginatingBeanDefinition(targetDefinition);
proxyDefinition.setSource(definition.getSource());
proxyDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
@@ -63,7 +63,7 @@ public abstract class ScopedProxyUtils {
if (proxyTargetClass) {
targetDefinition.setAttribute(AutoProxyUtils.PRESERVE_TARGET_CLASS_ATTRIBUTE, Boolean.TRUE);
// ScopedFactoryBean's "proxyTargetClass" default is TRUE, so we don't need to set it explicitly here.
// ScopedProxyFactoryBean's "proxyTargetClass" default is TRUE, so we don't need to set it explicitly here.
}
else {
proxyDefinition.getPropertyValues().add("proxyTargetClass", Boolean.FALSE);
@@ -125,7 +125,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
* plus the name of the method.
*/
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return ((targetClass != null && matchesPattern(targetClass.getName() + "." + method.getName())) ||
matchesPattern(method.getDeclaringClass().getName() + "." + method.getName()));
}
@@ -215,7 +215,7 @@ public abstract class AopUtils {
introductionAwareMethodMatcher = (IntroductionAwareMethodMatcher) methodMatcher;
}
Set<Class> classes = new HashSet<Class>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
Set<Class<?>> classes = new HashSet<Class<?>>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
classes.add(targetClass);
for (Class<?> clazz : classes) {
Method[] methods = clazz.getMethods();
@@ -97,7 +97,7 @@ public abstract class ClassFilters {
}
@Override
public boolean matches(Class clazz) {
public boolean matches(Class<?> clazz) {
for (int i = 0; i < this.filters.length; i++) {
if (this.filters[i].matches(clazz)) {
return true;
@@ -132,7 +132,7 @@ public abstract class ClassFilters {
}
@Override
public boolean matches(Class clazz) {
public boolean matches(Class<?> clazz) {
for (int i = 0; i < this.filters.length; i++) {
if (!this.filters[i].matches(clazz)) {
return false;
@@ -39,7 +39,7 @@ import org.springframework.util.ObjectUtils;
@SuppressWarnings("serial")
public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher, Serializable {
private Class clazz;
private Class<?> clazz;
private String methodName;
@@ -50,7 +50,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
* Construct a new pointcut that matches all control flows below that class.
* @param clazz the clazz
*/
public ControlFlowPointcut(Class clazz) {
public ControlFlowPointcut(Class<?> clazz) {
this(clazz, null);
}
@@ -61,7 +61,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
* @param clazz the clazz
* @param methodName the name of the method
*/
public ControlFlowPointcut(Class clazz, String methodName) {
public ControlFlowPointcut(Class<?> clazz, String methodName) {
Assert.notNull(clazz, "Class must not be null");
this.clazz = clazz;
this.methodName = methodName;
@@ -72,7 +72,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
* Subclasses can override this for greater filtering (and performance).
*/
@Override
public boolean matches(Class clazz) {
public boolean matches(Class<?> clazz) {
return true;
}
@@ -81,7 +81,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
* some candidate classes.
*/
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return true;
}
@@ -91,7 +91,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
}
@Override
public boolean matches(Method method, Class targetClass, Object[] args) {
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
++this.evaluations;
ControlFlow cflow = ControlFlowFactory.createControlFlow();
return (this.methodName != null) ? cflow.under(this.clazz, this.methodName) : cflow.under(this.clazz);
@@ -43,7 +43,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
private final Advice advice;
private final Set<Class> interfaces = new HashSet<Class>();
private final Set<Class<?>> interfaces = new HashSet<Class<?>>();
private int order = Integer.MAX_VALUE;
@@ -68,11 +68,11 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
Assert.notNull(advice, "Advice must not be null");
this.advice = advice;
if (introductionInfo != null) {
Class[] introducedInterfaces = introductionInfo.getInterfaces();
Class<?>[] introducedInterfaces = introductionInfo.getInterfaces();
if (introducedInterfaces.length == 0) {
throw new IllegalArgumentException("IntroductionAdviceSupport implements no interfaces");
}
for (Class ifc : introducedInterfaces) {
for (Class<?> ifc : introducedInterfaces) {
addInterface(ifc);
}
}
@@ -83,7 +83,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
* @param advice the Advice to apply
* @param intf the interface to introduce
*/
public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class intf) {
public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class<?> intf) {
Assert.notNull(advice, "Advice must not be null");
this.advice = advice;
addInterface(intf);
@@ -94,7 +94,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
* Add the specified interface to the list of interfaces to introduce.
* @param intf the interface to introduce
*/
public void addInterface(Class intf) {
public void addInterface(Class<?> intf) {
Assert.notNull(intf, "Interface must not be null");
if (!intf.isInterface()) {
throw new IllegalArgumentException("Specified class [" + intf.getName() + "] must be an interface");
@@ -103,13 +103,13 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
}
@Override
public Class[] getInterfaces() {
return this.interfaces.toArray(new Class[this.interfaces.size()]);
public Class<?>[] getInterfaces() {
return this.interfaces.toArray(new Class<?>[this.interfaces.size()]);
}
@Override
public void validateInterfaces() throws IllegalArgumentException {
for (Class ifc : this.interfaces) {
for (Class<?> ifc : this.interfaces) {
if (this.advice instanceof DynamicIntroductionAdvice &&
!((DynamicIntroductionAdvice) this.advice).implementsInterface(ifc)) {
throw new IllegalArgumentException("DynamicIntroductionAdvice [" + this.advice + "] " +
@@ -145,7 +145,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
}
@Override
public boolean matches(Class clazz) {
public boolean matches(Class<?> clazz) {
return true;
}
@@ -59,15 +59,15 @@ public class DelegatePerTargetObjectIntroductionInterceptor extends Introduction
*/
private final Map<Object, Object> delegateMap = new WeakHashMap<Object, Object>();
private Class defaultImplType;
private Class<?> defaultImplType;
private Class interfaceType;
private Class<?> interfaceType;
public DelegatePerTargetObjectIntroductionInterceptor(Class defaultImplType, Class interfaceType) {
public DelegatePerTargetObjectIntroductionInterceptor(Class<?> defaultImplType, Class<?> interfaceType) {
this.defaultImplType = defaultImplType;
this.interfaceType = interfaceType;
// cCeate a new delegate now (but don't store it in the map).
// Create a new delegate now (but don't store it in the map).
// We do this for two reasons:
// 1) to fail early if there is a problem instantiating delegates
// 2) to populate the interface map once and once only
@@ -43,7 +43,7 @@ import org.springframework.util.ClassUtils;
@SuppressWarnings("serial")
public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
protected final Set<Class> publishedInterfaces = new HashSet<Class>();
protected final Set<Class<?>> publishedInterfaces = new HashSet<Class<?>>();
private transient Map<Method, Boolean> rememberedMethods = new ConcurrentHashMap<Method, Boolean>(32);
@@ -55,13 +55,13 @@ public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
* <p>Does nothing if the interface is not implemented by the delegate.
* @param intf the interface to suppress
*/
public void suppressInterface(Class intf) {
public void suppressInterface(Class<?> intf) {
this.publishedInterfaces.remove(intf);
}
@Override
public Class[] getInterfaces() {
return this.publishedInterfaces.toArray(new Class[this.publishedInterfaces.size()]);
public Class<?>[] getInterfaces() {
return this.publishedInterfaces.toArray(new Class<?>[this.publishedInterfaces.size()]);
}
/**
@@ -69,8 +69,8 @@ public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
* @param ifc the interface to check
* @return whether the interface is part of this introduction
*/
public boolean implementsInterface(Class ifc) {
for (Class pubIfc : this.publishedInterfaces) {
public boolean implementsInterface(Class<?> ifc) {
for (Class<?> pubIfc : this.publishedInterfaces) {
if (ifc.isInterface() && ifc.isAssignableFrom(pubIfc)) {
return true;
}
@@ -88,7 +88,7 @@ public abstract class MethodMatchers {
* asking is the subject on one or more introductions; {@code false} otherwise
* @return whether or not this method matches statically
*/
public static boolean matches(MethodMatcher mm, Method method, Class targetClass, boolean hasIntroductions) {
public static boolean matches(MethodMatcher mm, Method method, Class<?> targetClass, boolean hasIntroductions) {
Assert.notNull(mm, "MethodMatcher must not be null");
return ((mm instanceof IntroductionAwareMethodMatcher &&
((IntroductionAwareMethodMatcher) mm).matches(method, targetClass, hasIntroductions)) ||
@@ -114,22 +114,22 @@ public abstract class MethodMatchers {
}
@Override
public boolean matches(Method method, Class targetClass, boolean hasIntroductions) {
public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) {
return (matchesClass1(targetClass) && MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions)) ||
(matchesClass2(targetClass) && MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions));
}
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return (matchesClass1(targetClass) && this.mm1.matches(method, targetClass)) ||
(matchesClass2(targetClass) && this.mm2.matches(method, targetClass));
}
protected boolean matchesClass1(Class targetClass) {
protected boolean matchesClass1(Class<?> targetClass) {
return true;
}
protected boolean matchesClass2(Class targetClass) {
protected boolean matchesClass2(Class<?> targetClass) {
return true;
}
@@ -139,7 +139,7 @@ public abstract class MethodMatchers {
}
@Override
public boolean matches(Method method, Class targetClass, Object[] args) {
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
return this.mm1.matches(method, targetClass, args) || this.mm2.matches(method, targetClass, args);
}
@@ -183,12 +183,12 @@ public abstract class MethodMatchers {
}
@Override
protected boolean matchesClass1(Class targetClass) {
protected boolean matchesClass1(Class<?> targetClass) {
return this.cf1.matches(targetClass);
}
@Override
protected boolean matchesClass2(Class targetClass) {
protected boolean matchesClass2(Class<?> targetClass) {
return this.cf2.matches(targetClass);
}
@@ -230,13 +230,13 @@ public abstract class MethodMatchers {
}
@Override
public boolean matches(Method method, Class targetClass, boolean hasIntroductions) {
public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) {
return MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions) &&
MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions);
}
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return this.mm1.matches(method, targetClass) && this.mm2.matches(method, targetClass);
}
@@ -246,7 +246,7 @@ public abstract class MethodMatchers {
}
@Override
public boolean matches(Method method, Class targetClass, Object[] args) {
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
// Because a dynamic intersection may be composed of a static and dynamic part,
// we must avoid calling the 3-arg matches method on a dynamic matcher, as
// it will probably be an unsupported operation.
@@ -78,7 +78,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
for (String mappedName : this.mappedNames) {
if (mappedName.equals(method.getName()) || isMatch(method.getName(), mappedName)) {
return true;
@@ -71,7 +71,7 @@ public abstract class Pointcuts {
* @param args arguments to the method
* @return whether there's a runtime match
*/
public static boolean matches(Pointcut pointcut, Method method, Class targetClass, Object[] args) {
public static boolean matches(Pointcut pointcut, Method method, Class<?> targetClass, Object[] args) {
Assert.notNull(pointcut, "Pointcut must not be null");
if (pointcut == Pointcut.TRUE) {
return true;
@@ -97,7 +97,7 @@ public abstract class Pointcuts {
public static SetterPointcut INSTANCE = new SetterPointcut();
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return method.getName().startsWith("set") &&
method.getParameterTypes().length == 1 &&
method.getReturnType() == Void.TYPE;
@@ -118,7 +118,7 @@ public abstract class Pointcuts {
public static GetterPointcut INSTANCE = new GetterPointcut();
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
return method.getName().startsWith("get") &&
method.getParameterTypes().length == 0;
}
@@ -27,16 +27,16 @@ import org.springframework.aop.ClassFilter;
@SuppressWarnings("serial")
public class RootClassFilter implements ClassFilter, Serializable {
private Class clazz;
private Class<?> clazz;
// TODO inheritance
public RootClassFilter(Class clazz) {
public RootClassFilter(Class<?> clazz) {
this.clazz = clazz;
}
@Override
public boolean matches(Class candidate) {
public boolean matches(Class<?> candidate) {
return clazz.isAssignableFrom(candidate);
}
@@ -60,7 +60,7 @@ public class AnnotationClassFilter implements ClassFilter {
@Override
public boolean matches(Class clazz) {
public boolean matches(Class<?> clazz) {
return (this.checkInherited ?
(AnnotationUtils.findAnnotation(clazz, this.annotationType) != null) :
clazz.isAnnotationPresent(this.annotationType));
@@ -48,7 +48,7 @@ public class AnnotationMethodMatcher extends StaticMethodMatcher {
@Override
public boolean matches(Method method, Class targetClass) {
public boolean matches(Method method, Class<?> targetClass) {
if (method.isAnnotationPresent(this.annotationType)) {
return true;
}
@@ -97,7 +97,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
* <p>Default is to detect the type automatically, through a {@code getType}
* call on the BeanFactory (or even a full {@code getBean} call as fallback).
*/
public void setTargetClass(Class targetClass) {
public void setTargetClass(Class<?> targetClass) {
this.targetClass = targetClass;
}
@@ -53,6 +53,9 @@ import org.springframework.beans.factory.DisposableBean;
public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBasedTargetSource
implements PoolingConfig, DisposableBean {
private static final long serialVersionUID = 1L;
/** The maximum size of the pool */
private int maxSize = -1;
@@ -45,6 +45,9 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
*/
public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource {
private static final long serialVersionUID = 1L;
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
super.setBeanFactory(beanFactory);
@@ -50,7 +50,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
* @param targetClass the target Class (may be {@code null})
* @see #getTargetClass()
*/
public static EmptyTargetSource forClass(Class targetClass) {
public static EmptyTargetSource forClass(Class<?> targetClass) {
return forClass(targetClass, true);
}
@@ -60,7 +60,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
* @param isStatic whether the TargetSource should be marked as static
* @see #getTargetClass()
*/
public static EmptyTargetSource forClass(Class targetClass, boolean isStatic) {
public static EmptyTargetSource forClass(Class<?> targetClass, boolean isStatic) {
return (targetClass == null && isStatic ? INSTANCE : new EmptyTargetSource(targetClass, isStatic));
}
@@ -69,7 +69,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
// Instance implementation
//---------------------------------------------------------------------
private final Class targetClass;
private final Class<?> targetClass;
private final boolean isStatic;
@@ -81,7 +81,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
* @param targetClass the target class to expose (may be {@code null})
* @param isStatic whether the TargetSource is marked as static
*/
private EmptyTargetSource(Class targetClass, boolean isStatic) {
private EmptyTargetSource(Class<?> targetClass, boolean isStatic) {
this.targetClass = targetClass;
this.isStatic = isStatic;
}
@@ -22,7 +22,6 @@ import java.lang.annotation.RetentionPolicy;
import org.aspectj.lang.ProceedingJoinPoint;
import org.junit.Test;
/**
* Additional parameter name discover tests that need Java 5.
* Yes this will re-run the tests from the superclass, but that
@@ -31,7 +31,6 @@ import test.annotation.EmptySpringAnnotation;
import test.annotation.transaction.Tx;
import org.springframework.tests.sample.beans.TestBean;
/**
* Java5-specific {@link AspectJExpressionPointcutTests}.
*
@@ -27,7 +27,6 @@ import org.springframework.aop.framework.AopConfigException;
import test.aop.PerTargetAspect;
import org.springframework.tests.sample.beans.TestBean;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -25,7 +25,6 @@ import org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactoryT
import test.aop.PerTargetAspect;
/**
* @since 2.0
* @author Rod Johnson
@@ -31,7 +31,6 @@ import org.springframework.tests.aop.advice.MethodCounter;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -32,7 +32,6 @@ import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.SerializationTestUtils;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -26,7 +26,6 @@ import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -30,7 +30,6 @@ import org.springframework.tests.sample.beans.Person;
import org.springframework.tests.sample.beans.SerializablePerson;
import org.springframework.util.SerializationTestUtils;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -31,7 +31,6 @@ import org.springframework.tests.sample.beans.Person;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.SerializationTestUtils;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -36,8 +36,6 @@ import org.springframework.tests.sample.beans.SerializablePerson;
import org.springframework.tests.sample.beans.SideEffectBean;
import org.springframework.util.SerializationTestUtils;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -28,7 +28,6 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.Resource;
import org.springframework.tests.sample.beans.SideEffectBean;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -29,7 +29,6 @@ import org.springframework.core.io.Resource;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.SideEffectBean;
/**
* @author Rod Johnson
* @author Chris Beams
@@ -9,7 +9,6 @@ import java.rmi.RemoteException;
import org.springframework.aop.ThrowsAdvice;
@SuppressWarnings("serial")
public class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
// Full method signature
@@ -20,7 +20,6 @@ import org.springframework.aop.support.DelegatingIntroductionInterceptor;
import org.springframework.aop.support.DefaultIntroductionAdvisor;
import org.springframework.tests.aop.interceptor.TimestampIntroductionInterceptor;
/**
*
* @author Rod Johnson
@@ -46,6 +46,11 @@ public class NopInterceptor implements MethodInterceptor {
++count;
}
@Override
public int hashCode() {
return 0;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof NopInterceptor)) {
@@ -57,4 +62,5 @@ public class NopInterceptor implements MethodInterceptor {
return this.count == ((NopInterceptor) other).count;
}
}
@@ -18,7 +18,6 @@ package org.springframework.tests.aop.interceptor;
import java.io.Serializable;
/**
* Subclass of NopInterceptor that is serializable and
* can be used to test proxy serialization.
@@ -28,7 +28,11 @@ import org.springframework.util.ObjectUtils;
@SuppressWarnings("serial")
public class SerializablePerson implements Person, Serializable {
private static final long serialVersionUID = 1L;
private String name;
private int age;
@Override
@@ -59,6 +63,11 @@ public class SerializablePerson implements Person, Serializable {
return o;
}
@Override
public int hashCode() {
return 0;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof SerializablePerson)) {
@@ -28,7 +28,6 @@ import org.springframework.cache.config.CacheableService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
/**
* @author Costin Leau
*/
@@ -28,7 +28,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Test for static entity mocking framework.
* @author Rod Johnson
@@ -221,7 +221,6 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
};
binding.setVariable("beans", beans);
int countBefore = getRegistry().getBeanDefinitionCount();
try {
GroovyShell shell = new GroovyShell(getResourceLoader().getClassLoader(), binding);
@@ -239,11 +238,11 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
/**
* Defines a set of beans for the given block or closure.
* @param c the block or closure
* @param closure the block or closure
* @return this GroovyBeanDefinitionReader instance
*/
public GroovyBeanDefinitionReader beans(Closure c) {
return invokeBeanDefiningClosure(c);
public GroovyBeanDefinitionReader beans(Closure closure) {
return invokeBeanDefiningClosure(closure);
}
/**
@@ -433,7 +432,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
private GroovyBeanDefinitionWrapper invokeBeanDefiningMethod(String beanName, Object[] args) {
boolean hasClosureArgument = args[args.length - 1] instanceof Closure;
if (args[0] instanceof Class) {
Class beanClass = (args[0] instanceof Class ? (Class) args[0] : args[0].getClass());
Class<?> beanClass = (args[0] instanceof Class ? (Class) args[0] : args[0].getClass());
if (args.length >= 1) {
if (hasClosureArgument) {
if (args.length-1 != 1) {
@@ -593,7 +592,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
GroovyBeanDefinitionWrapper current = this.currentBeanDefinition;
try {
Closure callable = (Closure) value;
Class parameterType = callable.getParameterTypes()[0];
Class<?> parameterType = callable.getParameterTypes()[0];
if (parameterType.equals(Object.class)) {
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper("");
callable.call(this.currentBeanDefinition);
@@ -689,7 +688,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
private final String name;
private Object value;
public Object value;
public DeferredProperty(GroovyBeanDefinitionWrapper beanDefinition, String name, Object value) {
this.beanDefinition = beanDefinition;
@@ -112,7 +112,7 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
// Redefined with public visibility.
@Override
public Class getPropertyType(String propertyPath) {
public Class<?> getPropertyType(String propertyPath) {
return null;
}
@@ -26,7 +26,7 @@ package org.springframework.beans;
@SuppressWarnings("serial")
public class BeanInstantiationException extends FatalBeanException {
private Class beanClass;
private Class<?> beanClass;
/**
@@ -34,7 +34,7 @@ public class BeanInstantiationException extends FatalBeanException {
* @param beanClass the offending bean class
* @param msg the detail message
*/
public BeanInstantiationException(Class beanClass, String msg) {
public BeanInstantiationException(Class<?> beanClass, String msg) {
this(beanClass, msg, null);
}
@@ -44,7 +44,7 @@ public class BeanInstantiationException extends FatalBeanException {
* @param msg the detail message
* @param cause the root cause
*/
public BeanInstantiationException(Class beanClass, String msg, Throwable cause) {
public BeanInstantiationException(Class<?> beanClass, String msg, Throwable cause) {
super("Could not instantiate bean class [" + beanClass.getName() + "]: " + msg, cause);
this.beanClass = beanClass;
}
@@ -52,7 +52,7 @@ public class BeanInstantiationException extends FatalBeanException {
/**
* Return the offending bean class.
*/
public Class getBeanClass() {
public Class<?> getBeanClass() {
return beanClass;
}
@@ -336,7 +336,7 @@ public abstract class BeanUtils {
String methodName = signature.substring(0, firstParen);
String[] parameterTypeNames =
StringUtils.commaDelimitedListToStringArray(signature.substring(firstParen + 1, lastParen));
Class<?>[] parameterTypes = new Class[parameterTypeNames.length];
Class<?>[] parameterTypes = new Class<?>[parameterTypeNames.length];
for (int i = 0; i < parameterTypeNames.length; i++) {
String parameterTypeName = parameterTypeNames[i].trim();
try {
@@ -59,7 +59,7 @@ public interface BeanWrapper extends ConfigurablePropertyAccessor {
* @return the type of the wrapped bean instance,
* or {@code null} if no wrapped object has been set
*/
Class getWrappedClass();
Class<?> getWrappedClass();
/**
* Obtain the PropertyDescriptors for the wrapped object
@@ -37,7 +37,6 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.CollectionFactory;
import org.springframework.core.GenericCollectionTypeResolver;
import org.springframework.core.convert.ConversionException;
@@ -225,7 +224,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
@Override
public final Class getWrappedClass() {
public final Class<?> getWrappedClass() {
return (this.object != null ? this.object.getClass() : null);
}
@@ -248,7 +247,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
* Return the class of the root object at the top of the path of this BeanWrapper.
* @see #getNestedPath
*/
public final Class getRootClass() {
public final Class<?> getRootClass() {
return (this.rootObject != null ? this.rootObject.getClass() : null);
}
@@ -310,7 +309,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
* Needs to be called when the target object changes.
* @param clazz the class to introspect
*/
protected void setIntrospectionClass(Class clazz) {
protected void setIntrospectionClass(Class<?> clazz) {
if (this.cachedIntrospectionResults != null &&
!clazz.equals(this.cachedIntrospectionResults.getBeanClass())) {
this.cachedIntrospectionResults = null;
@@ -360,7 +359,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
@Override
public Class getPropertyType(String propertyName) throws BeansException {
public Class<?> getPropertyType(String propertyName) throws BeansException {
try {
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
if (pd != null) {
@@ -374,7 +373,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
// Check to see if there is a custom editor,
// which might give an indication on the desired target type.
Class editorType = guessPropertyTypeFromEditors(propertyName);
Class<?> editorType = guessPropertyTypeFromEditors(propertyName);
if (editorType != null) {
return editorType;
}
@@ -491,18 +490,23 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
* @throws TypeMismatchException if type conversion failed
*/
public Object convertForProperty(Object value, String propertyName) throws TypeMismatchException {
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(propertyName);
CachedIntrospectionResults cachedIntrospectionResults = getCachedIntrospectionResults();
PropertyDescriptor pd = cachedIntrospectionResults.getPropertyDescriptor(propertyName);
TypeDescriptor td = cachedIntrospectionResults.getTypeDescriptor(pd);
if (pd == null) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"No property '" + propertyName + "' found");
}
return convertForProperty(propertyName, null, value, pd);
if (td == null) {
td = new TypeDescriptor(property(pd));
cachedIntrospectionResults.putTypeDescriptor(pd, td);
}
return convertForProperty(propertyName, null, value, pd, td);
}
private Object convertForProperty(String propertyName, Object oldValue, Object newValue, PropertyDescriptor pd)
private Object convertForProperty(String propertyName, Object oldValue, Object newValue, PropertyDescriptor pd, TypeDescriptor td)
throws TypeMismatchException {
return convertIfNecessary(propertyName, oldValue, newValue, pd.getPropertyType(), new TypeDescriptor(property(pd)));
return convertIfNecessary(propertyName, oldValue, newValue, pd.getPropertyType(), td);
}
private Property property(PropertyDescriptor pd) {
@@ -710,7 +714,8 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
return nestedBw.getPropertyValue(tokens);
}
private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
@SuppressWarnings("unchecked")
private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
String propertyName = tokens.canonicalName;
String actualName = tokens.actualName;
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
@@ -779,20 +784,20 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
else if (value instanceof List) {
int index = Integer.parseInt(key);
List list = (List) value;
List<Object> list = (List<Object>) value;
growCollectionIfNecessary(list, index, indexedPropertyName, pd, i + 1);
value = list.get(index);
}
else if (value instanceof Set) {
// Apply index to Iterator in case of a Set.
Set set = (Set) value;
Set<Object> set = (Set<Object>) value;
int index = Integer.parseInt(key);
if (index < 0 || index >= set.size()) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"Cannot get element with index " + index + " from Set of size " +
set.size() + ", accessed using property path '" + propertyName + "'");
}
Iterator it = set.iterator();
Iterator<Object> it = set.iterator();
for (int j = 0; it.hasNext(); j++) {
Object elem = it.next();
if (j == index) {
@@ -802,7 +807,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
}
else if (value instanceof Map) {
Map map = (Map) value;
Map<Object, Object> map = (Map<Object, Object>) value;
Class<?> mapKeyType = GenericCollectionTypeResolver.getMapKeyReturnType(pd.getReadMethod(), i + 1);
// IMPORTANT: Do not pass full property name in here - property editors
// must not kick in for map keys but rather only for map values.
@@ -863,16 +868,14 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
}
@SuppressWarnings("unchecked")
private void growCollectionIfNecessary(
Collection collection, int index, String name, PropertyDescriptor pd, int nestingLevel) {
private void growCollectionIfNecessary(Collection<Object> collection, int index,
String name, PropertyDescriptor pd, int nestingLevel) {
if (!this.autoGrowNestedPaths) {
return;
}
int size = collection.size();
if (index >= size && index < this.autoGrowCollectionLimit) {
Class elementType = GenericCollectionTypeResolver.getCollectionReturnType(pd.getReadMethod(), nestingLevel);
Class<?> elementType = GenericCollectionTypeResolver.getCollectionReturnType(pd.getReadMethod(), nestingLevel);
if (elementType != null) {
for (int i = collection.size(); i < index + 1; i++) {
collection.add(newValue(elementType, name));
@@ -958,7 +961,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
if (propValue.getClass().isArray()) {
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
Class requiredType = propValue.getClass().getComponentType();
Class<?> requiredType = propValue.getClass().getComponentType();
int arrayIndex = Integer.parseInt(key);
Object oldValue = null;
try {
@@ -976,9 +979,9 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
else if (propValue instanceof List) {
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
Class requiredType = GenericCollectionTypeResolver.getCollectionReturnType(
Class<?> requiredType = GenericCollectionTypeResolver.getCollectionReturnType(
pd.getReadMethod(), tokens.keys.length);
List list = (List) propValue;
List<Object> list = (List<Object>) propValue;
int index = Integer.parseInt(key);
Object oldValue = null;
if (isExtractOldValueForEditor() && index < list.size()) {
@@ -1013,11 +1016,11 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
else if (propValue instanceof Map) {
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
Class mapKeyType = GenericCollectionTypeResolver.getMapKeyReturnType(
Class<?> mapKeyType = GenericCollectionTypeResolver.getMapKeyReturnType(
pd.getReadMethod(), tokens.keys.length);
Class mapValueType = GenericCollectionTypeResolver.getMapValueReturnType(
Class<?> mapValueType = GenericCollectionTypeResolver.getMapValueReturnType(
pd.getReadMethod(), tokens.keys.length);
Map map = (Map) propValue;
Map<Object, Object> map = (Map<Object, Object>) propValue;
// IMPORTANT: Do not pass full property name in here - property editors
// must not kick in for map keys but rather only for map values.
TypeDescriptor typeDescriptor = (mapKeyType != null ?
@@ -1109,7 +1112,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
}
}
valueToApply = convertForProperty(propertyName, oldValue, originalValue, pd);
valueToApply = convertForProperty(propertyName, oldValue, originalValue, pd, new TypeDescriptor(property(pd)));
}
pv.getOriginalPropertyValue().conversionNecessary = (valueToApply != originalValue);
}
@@ -22,6 +22,7 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -32,7 +33,7 @@ import java.util.WeakHashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
@@ -76,7 +77,7 @@ public class CachedIntrospectionResults {
* Needs to be a WeakHashMap with WeakReferences as values to allow
* for proper garbage collection in case of multiple class loaders.
*/
static final Map<Class, Object> classCache = new WeakHashMap<Class, Object>();
static final Map<Class<?>, Object> classCache = new WeakHashMap<Class<?>, Object>();
/**
@@ -107,7 +108,7 @@ public class CachedIntrospectionResults {
*/
public static void clearClassLoader(ClassLoader classLoader) {
synchronized (classCache) {
for (Iterator<Class> it = classCache.keySet().iterator(); it.hasNext();) {
for (Iterator<Class<?>> it = classCache.keySet().iterator(); it.hasNext();) {
Class<?> beanClass = it.next();
if (isUnderneathClassLoader(beanClass.getClassLoader(), classLoader)) {
it.remove();
@@ -130,6 +131,7 @@ public class CachedIntrospectionResults {
* @return the corresponding CachedIntrospectionResults
* @throws BeansException in case of introspection failure
*/
@SuppressWarnings("unchecked")
static CachedIntrospectionResults forClass(Class<?> beanClass) throws BeansException {
CachedIntrospectionResults results;
Object value;
@@ -137,8 +139,8 @@ public class CachedIntrospectionResults {
value = classCache.get(beanClass);
}
if (value instanceof Reference) {
Reference ref = (Reference) value;
results = (CachedIntrospectionResults) ref.get();
Reference<CachedIntrospectionResults> ref = (Reference<CachedIntrospectionResults>) value;
results = ref.get();
}
else {
results = (CachedIntrospectionResults) value;
@@ -216,6 +218,9 @@ public class CachedIntrospectionResults {
/** PropertyDescriptor objects keyed by property name String */
private final Map<String, PropertyDescriptor> propertyDescriptorCache;
/** TypeDescriptor objects keyed by PropertyDescriptor */
private final Map<PropertyDescriptor, TypeDescriptor> typeDescriptorCache;
/**
* Create a new CachedIntrospectionResults instance for the given class.
@@ -273,6 +278,8 @@ public class CachedIntrospectionResults {
pd = buildGenericTypeAwarePropertyDescriptor(beanClass, pd);
this.propertyDescriptorCache.put(pd.getName(), pd);
}
this.typeDescriptorCache = new HashMap<PropertyDescriptor, TypeDescriptor>();
}
catch (IntrospectionException ex) {
throw new FatalBeanException("Failed to obtain BeanInfo for class [" + beanClass.getName() + "]", ex);
@@ -321,4 +328,12 @@ public class CachedIntrospectionResults {
}
}
TypeDescriptor getTypeDescriptor(PropertyDescriptor pd) {
return this.typeDescriptorCache.get(pd);
}
void putTypeDescriptor(PropertyDescriptor pd, TypeDescriptor td) {
this.typeDescriptorCache.put(pd, td);
}
}

Some files were not shown because too many files have changed in this diff Show More