mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Compare commits
155 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a4b36479a | |||
| 85b0bfff58 | |||
| 8f569264da | |||
| 3ac14e7cd8 | |||
| 14468e80f3 | |||
| b1485420b6 | |||
| 1dff45c38a | |||
| 7713a55f6b | |||
| d4245610a2 | |||
| 526555de85 | |||
| c2b56c07e5 | |||
| fd1b48139f | |||
| bb5a53f7f7 | |||
| cea049b791 | |||
| cb46ef86c6 | |||
| 6c1f62b19d | |||
| f5a310ad57 | |||
| 2a52decbbc | |||
| 41332728f9 | |||
| e62cd84ca2 | |||
| ab2949f2b7 | |||
| 69238ba66f | |||
| e3e1c1bcec | |||
| eb8b5c435c | |||
| 5e02a6dda3 | |||
| 47ef45d152 | |||
| 92e144a8a8 | |||
| 079fb2db73 | |||
| 10f5d96a78 | |||
| 8f1fefc159 | |||
| 3e4b3cad6a | |||
| 8958912c94 | |||
| 676ad125a1 | |||
| bd8469990d | |||
| de890fd100 | |||
| ce917d5cbb | |||
| e8dead247c | |||
| b0b40dade1 | |||
| 043a41e382 | |||
| 15698860e1 | |||
| 690051f46c | |||
| e764c8d897 | |||
| a31ac882c5 | |||
| c7c395d0d0 | |||
| 64f593db8f | |||
| c5779e2ed6 | |||
| ef3a3b03ce | |||
| 119e793994 | |||
| ce3e55743f | |||
| a5d87fffd9 | |||
| 412f74f679 | |||
| 1e6f2e79b9 | |||
| 1ee816b473 | |||
| e6952f41b7 | |||
| e9f78f6043 | |||
| 4e82416ba9 | |||
| 59002f2456 | |||
| 4de3291dc7 | |||
| f888b8816f | |||
| f39bb02628 | |||
| 70164cb145 | |||
| 519f78c3f5 | |||
| 009e362709 | |||
| ad402dcb4a | |||
| 44c5eaeaa3 | |||
| a613126be0 | |||
| 665251fa2f | |||
| 127bc07cda | |||
| f3504b2fd5 | |||
| d9c4470461 | |||
| 87e443b429 | |||
| d0ab131a57 | |||
| a41958435a | |||
| 2a05e6afa1 | |||
| 7c3cdf82cc | |||
| 3200f3e9a7 | |||
| cfe7a525e2 | |||
| 639b2cb12e | |||
| 4385da7b84 | |||
| 02f7803860 | |||
| 5c7eaaa969 | |||
| b830d7362d | |||
| 45afd4fbe2 | |||
| 63c143be61 | |||
| f6f0adf63b | |||
| 41cdbd292a | |||
| 6a9e116d78 | |||
| 0de112198e | |||
| 2ea5360b82 | |||
| cc4faa5990 | |||
| 6f2004f4f8 | |||
| e54fc7bbdc | |||
| 5d8b008a8b | |||
| 8d4d5af30a | |||
| 8dd5e6da46 | |||
| a7251041f1 | |||
| 99cf06bfc9 | |||
| 13bef4fd2d | |||
| 8e60bbc3ee | |||
| 7d7f0063f8 | |||
| cb858a3b01 | |||
| ea08d4b49c | |||
| 4b0de69246 | |||
| dfa7483812 | |||
| e910326bf7 | |||
| 35b9b8400b | |||
| 2597cd2339 | |||
| 54571bf038 | |||
| b43901ed86 | |||
| ddebda1121 | |||
| 6802f813de | |||
| e84885c655 | |||
| 9600bf07c7 | |||
| df5d22e120 | |||
| 72dec7d0fe | |||
| d67fe1db86 | |||
| 5915b23e8a | |||
| 930d187723 | |||
| 6a1ca41cb7 | |||
| 6900645d59 | |||
| 2a6c1f75e7 | |||
| 6a18daea33 | |||
| 0340cc5f03 | |||
| c09f85172b | |||
| 467c770b4d | |||
| b5bd4d8a8a | |||
| e9a24da225 | |||
| 0aedd81ccc | |||
| dcc6ef262d | |||
| 18b69903ca | |||
| 7bf4324f0f | |||
| 3476d11fb8 | |||
| 2e57cf8bfc | |||
| 0eeb6717e0 | |||
| c6c5555034 | |||
| 2ae6a6a341 | |||
| c5fcf19535 | |||
| 4ac680103b | |||
| 8f81a12236 | |||
| eed1a323d1 | |||
| 935bd25b09 | |||
| e146e53d9b | |||
| bedb8e965f | |||
| 6ef9cbe473 | |||
| fd0b6caf9e | |||
| 50d3f71923 | |||
| b093b84954 | |||
| 49758a2a96 | |||
| 00474ceecd | |||
| 13ed423387 | |||
| 44dee37130 | |||
| 7ed108e974 | |||
| 7b2ac6d194 | |||
| 1dc7ff8604 | |||
| a32b94f85d |
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -1 +1 @@
|
||||
version=4.0.0.RC1
|
||||
version=4.0.0.RC2
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+5
-5
@@ -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
@@ -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
@@ -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"
|
||||
|
||||
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
+12
-12
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+6
-9
@@ -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);
|
||||
|
||||
+1
-2
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-11
@@ -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
|
||||
|
||||
+1
-1
@@ -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};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-6
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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.");
|
||||
}
|
||||
|
||||
+10
-12
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+7
-7
@@ -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) {
|
||||
|
||||
+5
-5
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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));
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+5
-13
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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 + "'");
|
||||
}
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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));
|
||||
}
|
||||
|
||||
+3
-3
@@ -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;
|
||||
|
||||
+2
-2
@@ -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() + "]");
|
||||
}
|
||||
|
||||
+4
-4
@@ -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 {
|
||||
|
||||
+1
-1
@@ -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)) {
|
||||
|
||||
+1
-1
@@ -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 =
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
+1
-1
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+9
-9
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
+6
-6
@@ -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.
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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));
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -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;
|
||||
|
||||
|
||||
+3
@@ -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;
|
||||
}
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -31,7 +31,6 @@ import test.annotation.EmptySpringAnnotation;
|
||||
import test.annotation.transaction.Tx;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
|
||||
/**
|
||||
* Java5-specific {@link AspectJExpressionPointcutTests}.
|
||||
*
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -25,7 +25,6 @@ import org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactoryT
|
||||
|
||||
import test.aop.PerTargetAspect;
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
* @author Rod Johnson
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-2
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
-1
@@ -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.
|
||||
|
||||
+9
@@ -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)) {
|
||||
|
||||
-1
@@ -28,7 +28,6 @@ import org.springframework.cache.config.CacheableService;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
|
||||
|
||||
/**
|
||||
* @author Costin Leau
|
||||
*/
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
+6
-7
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -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);
|
||||
}
|
||||
|
||||
+20
-5
@@ -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
Reference in New Issue
Block a user