diff --git a/.settings/gradle/com.springsource.sts.gradle.core.import.prefs b/.settings/gradle/com.springsource.sts.gradle.core.import.prefs index 5c6fb183d1..4b545cea5a 100644 --- a/.settings/gradle/com.springsource.sts.gradle.core.import.prefs +++ b/.settings/gradle/com.springsource.sts.gradle.core.import.prefs @@ -1,9 +1,9 @@ #com.springsource.sts.gradle.core.preferences.GradleImportPreferences -#Thu Feb 23 14:10:34 CET 2012 +#Thu Aug 9 11:34:43 CEST 2012 enableAfterTasks=true afterTasks=afterEclipseImport; enableDependendencyManagement=false enableBeforeTasks=true -projects=;spring-aop;spring-asm;spring-aspects;spring-beans;spring-context;spring-context-support;spring-core;spring-expression;spring-instrument;spring-instrument-tomcat;spring-jdbc;spring-jms;spring-orm;spring-oxm;spring-struts;spring-test;spring-tx;spring-web;spring-webmvc;spring-webmvc-portlet; +projects=;spring-aop;spring-aspects;spring-beans;spring-context;spring-context-support;spring-core;spring-expression;spring-instrument;spring-instrument-tomcat;spring-jdbc;spring-jms;spring-orm;spring-oxm;spring-struts;spring-test;spring-tx;spring-web;spring-webmvc;spring-webmvc-portlet; enableDSLD=false -beforeTasks=cleanEclipse;eclipse;\:spring-asm\:jar;\:spring-oxm\:compileTestJava; +beforeTasks=cleanEclipse;eclipse;\:spring-oxm\:compileTestJava; diff --git a/.settings/gradle/com.springsource.sts.gradle.refresh.prefs b/.settings/gradle/com.springsource.sts.gradle.refresh.prefs index 1ce9b8323d..023f99f901 100644 --- a/.settings/gradle/com.springsource.sts.gradle.refresh.prefs +++ b/.settings/gradle/com.springsource.sts.gradle.refresh.prefs @@ -1,9 +1,9 @@ #com.springsource.sts.gradle.core.actions.GradleRefreshPreferences -#Thu Feb 23 14:12:55 CET 2012 +#Thu Aug 9 11:34:43 CEST 2012 enableAfterTasks=true afterTasks=afterEclipseImport; useHierarchicalNames=false enableBeforeTasks=true addResourceFilters=false enableDSLD=false -beforeTasks=cleanEclipse;eclipse;\:spring-asm\:jar;\:spring-oxm\:compileTestJava; +beforeTasks=cleanEclipse;eclipse;\:spring-oxm\:compileTestJava; diff --git a/build.gradle b/build.gradle index 30a47bab51..2870f9cafd 100644 --- a/build.gradle +++ b/build.gradle @@ -88,30 +88,27 @@ configure(subprojects) { subproject -> } -project("spring-asm") { - description = 'Spring ASM' - ext.asmVersion = '2.2.3' +project('spring-core') { + description = 'Spring Core' + + def asmVersion = '4.0' configurations { - asm jarjar - } - dependencies { - asm "asm:asm:${asmVersion}@jar", "asm:asm-commons:${asmVersion}@jar" - jarjar 'com.googlecode.jarjar:jarjar:1.3' + asm } - task repackageAsm(type: Jar) { jar -> - jar.baseName = "asm-repack" - jar.version = asmVersion + task asmRepackJar(type: Jar) { repackJar -> + repackJar.baseName = "spring-asm-repack" + repackJar.version = asmVersion doLast() { project.ant { taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask", classpath: configurations.jarjar.asPath - jarjar(destfile: archivePath, index: "true", filesetmanifest: "merge") { - configurations.asm.each { jarfile -> - zipfileset(src: jarfile) + jarjar(destfile: repackJar.archivePath) { + configurations.asm.each { originalJar -> + zipfileset(src: originalJar) } rule(pattern: 'org.objectweb.asm.**', result: 'org.springframework.asm.@1') } @@ -119,24 +116,11 @@ project("spring-asm") { } } - jar { - dependsOn repackageAsm - from(zipTree(repackageAsm.archivePath)) { - exclude 'META-INF/INDEX.LIST' - } - } -} - -project('spring-core') { - description = 'Spring Core' dependencies { - // depend on spring-asm project in order to have it show up as a - // in the generated pom - compile project(":spring-asm") - // depend directly on the spring-asm jar to avoid errors in Eclipse/STS - compile files(project(":spring-asm").jar.archivePath) { - builtBy project(":spring-asm").jar - } + asm "org.ow2.asm:asm:${asmVersion}@jar", "org.ow2.asm:asm-commons:${asmVersion}@jar" + jarjar 'com.googlecode.jarjar:jarjar:1.3' + + compile files(asmRepackJar) compile "commons-logging:commons-logging:1.1.1" compile("org.aspectj:aspectjweaver:${aspectjVersion}", optional) compile("net.sf.jopt-simple:jopt-simple:3.0") { dep -> @@ -153,6 +137,13 @@ project('spring-core') { testCompile "xmlunit:xmlunit:1.2" testCompile "org.codehaus.woodstox:wstx-asl:3.2.7" } + + jar { + // inline all repackaged asm classes directly into the spring-core jar + from(asmRepackJar) { + exclude 'META-INF/**' + } + } } project('spring-beans') { diff --git a/settings.gradle b/settings.gradle index 61485fa319..f882ae2634 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,6 @@ rootProject.name = 'spring' include 'spring-aop' -include 'spring-asm' include 'spring-aspects' include 'spring-beans' include 'spring-context' diff --git a/spring-asm/src/main/java/org/springframework/asm/package-info.java b/spring-asm/src/main/java/org/springframework/asm/package-info.java deleted file mode 100644 index 80d6dc4a11..0000000000 --- a/spring-asm/src/main/java/org/springframework/asm/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Spring's repackaging of {@code org.objectweb.asm.*} (for internal use only). - *

This repackaging technique avoids any potential conflicts with - * dependencies on ASM at the application level or from other third-party - * libraries and frameworks. - *

As this repackaging happens at the classfile level, sources and Javadoc - * are not available here. See the original ObjectWeb - * ASM 2.2.3 Javadoc - * for details when working with these classes. - */ -package org.springframework.asm; diff --git a/spring-asm/src/main/java/org/springframework/asm/SpringAsmInfo.java b/spring-core/src/main/java/org/springframework/asm/SpringAsmInfo.java similarity index 75% rename from spring-asm/src/main/java/org/springframework/asm/SpringAsmInfo.java rename to spring-core/src/main/java/org/springframework/asm/SpringAsmInfo.java index 115efb3989..a2c3a1074a 100644 --- a/spring-asm/src/main/java/org/springframework/asm/SpringAsmInfo.java +++ b/spring-core/src/main/java/org/springframework/asm/SpringAsmInfo.java @@ -17,10 +17,9 @@ package org.springframework.asm; /** - * Placeholder to allow Javadoc generation. Required because - * this bug - * does not allow the generation of Javadoc for packages having only a - * {@code package-info.java} file. + * Utility class exposing constants related to Spring's internal repackaging of the ASM + * bytecode manipulation library. + * *

See package-level Javadoc for more * information on {@code org.springframework.asm}. * @@ -28,4 +27,12 @@ package org.springframework.asm; * @since 3.2 */ public final class SpringAsmInfo { + + /** + * The ASM version used internally throughout the framework. + * + * @see Opcodes#ASM4 + */ + public static final int ASM_VERSION = Opcodes.ASM4; + } diff --git a/spring-core/src/main/java/org/springframework/asm/package-info.java b/spring-core/src/main/java/org/springframework/asm/package-info.java new file mode 100644 index 0000000000..842143aa51 --- /dev/null +++ b/spring-core/src/main/java/org/springframework/asm/package-info.java @@ -0,0 +1,30 @@ +/* + * Copyright 2002-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring's repackaging of org.objectweb.asm 4 (for + * internal use only). + *

This repackaging technique avoids any potential conflicts with + * dependencies on ASM at the application level or from other third-party + * libraries and frameworks. + *

As this repackaging happens at the classfile level, sources and Javadoc + * are not available here. See the original ObjectWeb + * ASM 4 Javadoc + * for details when working with these classes. + * + * @since 3.2 + */ +package org.springframework.asm; diff --git a/spring-core/src/main/java/org/springframework/asm/util/package-info.java b/spring-core/src/main/java/org/springframework/asm/util/package-info.java new file mode 100644 index 0000000000..f03a2e8d87 --- /dev/null +++ b/spring-core/src/main/java/org/springframework/asm/util/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright 2002-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Dummy implementations of asm-util classes (for internal use only). + * + * @since 3.2 + */ +package org.springframework.asm.util; diff --git a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java index 9cf3f92a89..b852628072 100644 --- a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java @@ -29,11 +29,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.asm.ClassReader; +import org.springframework.asm.ClassVisitor; import org.springframework.asm.Label; import org.springframework.asm.MethodVisitor; import org.springframework.asm.Opcodes; +import org.springframework.asm.SpringAsmInfo; import org.springframework.asm.Type; -import org.springframework.asm.commons.EmptyVisitor; import org.springframework.util.ClassUtils; /** @@ -49,6 +50,7 @@ import org.springframework.util.ClassUtils; * @author Adrian Colyer * @author Costin Leau * @author Juergen Hoeller + * @author Chris Beams * @since 2.0 */ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameDiscoverer { @@ -77,7 +79,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD return null; } - public String[] getParameterNames(Constructor ctor) { + public String[] getParameterNames(Constructor ctor) { Class declaringClass = ctor.getDeclaringClass(); Map map = this.parameterNamesCache.get(declaringClass); if (map == null) { @@ -110,7 +112,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD try { ClassReader classReader = new ClassReader(is); Map map = new ConcurrentHashMap(); - classReader.accept(new ParameterNameDiscoveringVisitor(clazz, map), false); + classReader.accept(new ParameterNameDiscoveringVisitor(clazz, map), 0); return map; } catch (IOException ex) { @@ -135,7 +137,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD * Helper class that inspects all methods (constructor included) and then * attempts to find the parameter names for that member. */ - private static class ParameterNameDiscoveringVisitor extends EmptyVisitor { + private static class ParameterNameDiscoveringVisitor extends ClassVisitor { private static final String STATIC_CLASS_INIT = ""; @@ -143,6 +145,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD private final Map memberMap; public ParameterNameDiscoveringVisitor(Class clazz, Map memberMap) { + super(SpringAsmInfo.ASM_VERSION); this.clazz = clazz; this.memberMap = memberMap; } @@ -166,7 +169,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD } - private static class LocalVariableTableVisitor extends EmptyVisitor { + private static class LocalVariableTableVisitor extends MethodVisitor { private static final String CONSTRUCTOR = ""; @@ -187,6 +190,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD public LocalVariableTableVisitor(Class clazz, Map map, String name, String desc, boolean isStatic) { + super(SpringAsmInfo.ASM_VERSION); this.clazz = clazz; this.memberMap = map; this.name = name; diff --git a/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java index bd32dbdcdf..59f03a5939 100644 --- a/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 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. @@ -49,6 +49,6 @@ public interface ParameterNameDiscoverer { * @return an array of parameter names if the names can be resolved, * or null if they cannot */ - String[] getParameterNames(Constructor ctor); + String[] getParameterNames(Constructor ctor); } diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java b/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java index c71d06bf06..cdf49fd6b6 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java @@ -29,6 +29,7 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.asm.AnnotationVisitor; +import org.springframework.asm.SpringAsmInfo; import org.springframework.asm.Type; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.annotation.AnnotationUtils; @@ -41,7 +42,7 @@ import org.springframework.util.ReflectionUtils; * @author Juergen Hoeller * @since 3.1.1 */ -abstract class AbstractRecursiveAnnotationVisitor implements AnnotationVisitor { +abstract class AbstractRecursiveAnnotationVisitor extends AnnotationVisitor { protected final Log logger = LogFactory.getLog(this.getClass()); @@ -51,6 +52,7 @@ abstract class AbstractRecursiveAnnotationVisitor implements AnnotationVisitor { public AbstractRecursiveAnnotationVisitor(ClassLoader classLoader, AnnotationAttributes attributes) { + super(SpringAsmInfo.ASM_VERSION); this.classLoader = classLoader; this.attributes = attributes; } diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java b/spring-core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java index d69a75bb3d..45785bc8a3 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 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. @@ -25,7 +25,7 @@ import org.springframework.asm.ClassVisitor; import org.springframework.asm.FieldVisitor; import org.springframework.asm.MethodVisitor; import org.springframework.asm.Opcodes; -import org.springframework.asm.commons.EmptyVisitor; +import org.springframework.asm.SpringAsmInfo; import org.springframework.core.type.ClassMetadata; import org.springframework.util.ClassUtils; @@ -38,9 +38,10 @@ import org.springframework.util.ClassUtils; * @author Costin Leau * @author Mark Fisher * @author Ramnivas Laddad + * @author Chris Beams * @since 2.5 */ -class ClassMetadataReadingVisitor implements ClassVisitor, ClassMetadata { +class ClassMetadataReadingVisitor extends ClassVisitor implements ClassMetadata { private String className; @@ -61,6 +62,11 @@ class ClassMetadataReadingVisitor implements ClassVisitor, ClassMetadata { private Set memberClassNames = new LinkedHashSet(); + public ClassMetadataReadingVisitor() { + super(SpringAsmInfo.ASM_VERSION); + } + + public void visit(int version, int access, String name, String signature, String supername, String[] interfaces) { this.className = ClassUtils.convertResourcePathToClassName(name); this.isInterface = ((access & Opcodes.ACC_INTERFACE) != 0); @@ -99,7 +105,7 @@ class ClassMetadataReadingVisitor implements ClassVisitor, ClassMetadata { public AnnotationVisitor visitAnnotation(String desc, boolean visible) { // no-op - return new EmptyVisitor(); + return new EmptyAnnotationVisitor(); } public void visitAttribute(Attribute attr) { @@ -108,12 +114,12 @@ class ClassMetadataReadingVisitor implements ClassVisitor, ClassMetadata { public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { // no-op - return new EmptyVisitor(); + return new EmptyFieldVisitor(); } public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { // no-op - return new EmptyVisitor(); + return new EmptyMethodVisitor(); } public void visitEnd() { @@ -170,3 +176,38 @@ class ClassMetadataReadingVisitor implements ClassVisitor, ClassMetadata { } } + + +class EmptyAnnotationVisitor extends AnnotationVisitor { + + public EmptyAnnotationVisitor() { + super(SpringAsmInfo.ASM_VERSION); + } + + @Override + public AnnotationVisitor visitAnnotation(String name, String desc) { + return this; + } + + @Override + public AnnotationVisitor visitArray(String name) { + return this; + } +} + + +class EmptyMethodVisitor extends MethodVisitor { + + public EmptyMethodVisitor() { + super(SpringAsmInfo.ASM_VERSION); + } +} + + +class EmptyFieldVisitor extends FieldVisitor { + + public EmptyFieldVisitor() { + super(SpringAsmInfo.ASM_VERSION); + } + +} \ No newline at end of file diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java b/spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java index 43476425aa..4cae5b5829 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java @@ -20,10 +20,10 @@ import java.util.LinkedHashMap; import java.util.Map; import org.springframework.asm.AnnotationVisitor; -import org.springframework.asm.MethodAdapter; +import org.springframework.asm.MethodVisitor; import org.springframework.asm.Opcodes; +import org.springframework.asm.SpringAsmInfo; import org.springframework.asm.Type; -import org.springframework.asm.commons.EmptyVisitor; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.type.MethodMetadata; import org.springframework.util.MultiValueMap; @@ -39,7 +39,7 @@ import org.springframework.util.MultiValueMap; * @author Chris Beams * @since 3.0 */ -final class MethodMetadataReadingVisitor extends MethodAdapter implements MethodMetadata { +final class MethodMetadataReadingVisitor extends MethodVisitor implements MethodMetadata { private final String name; @@ -55,7 +55,7 @@ final class MethodMetadataReadingVisitor extends MethodAdapter implements Method public MethodMetadataReadingVisitor(String name, int access, String declaringClassName, ClassLoader classLoader, MultiValueMap methodMetadataMap) { - super(new EmptyVisitor()); + super(SpringAsmInfo.ASM_VERSION); this.name = name; this.access = access; this.declaringClassName = declaringClassName; diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java b/spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java index 78e7a413ac..182dac134c 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java @@ -56,7 +56,7 @@ final class SimpleMetadataReader implements MetadataReader { } AnnotationMetadataReadingVisitor visitor = new AnnotationMetadataReadingVisitor(classLoader); - classReader.accept(visitor, true); + classReader.accept(visitor, ClassReader.SKIP_DEBUG); this.annotationMetadata = visitor; // (since AnnotationMetadataReader extends ClassMetadataReadingVisitor) diff --git a/src/dist/changelog.txt b/src/dist/changelog.txt index bcb7659bd6..adc5615a88 100644 --- a/src/dist/changelog.txt +++ b/src/dist/changelog.txt @@ -36,6 +36,7 @@ Changes in version 3.2 M2 (2012-08-xx) * introduced countRowsInTableWhere() and dropTables() in JdbcTestUtils (SPR-9235) * introduced JdbcTemplate in tx base classes in the TestContext framework (SPR-8990) * introduced countRowsInTableWhere() and dropTables() in tx base test classes (SPR-9665) +* inlined ASM 4.0 into spring-core, removed spring-asm subproject and jar (SPR-9669) Changes in version 3.2 M1 (2012-05-28) diff --git a/src/dist/license.txt b/src/dist/license.txt index eb67bf6877..af01a07e6e 100644 --- a/src/dist/license.txt +++ b/src/dist/license.txt @@ -202,18 +202,18 @@ ======================================================================= -SPRING FRAMEWORK 3.1 SUBCOMPONENTS: +SPRING FRAMEWORK 3.2 SUBCOMPONENTS: -Spring Framework 3.1 includes a number of subcomponents with +Spring Framework 3.2 includes a number of subcomponents with separate copyright notices and license terms. The product that includes this file does not necessarily use all the open source subcomponents referred to below. Your use of the source code for these subcomponents is subject to the terms and conditions of the following licenses. ->>> asm-2.2.3: +>>> asm-4.0: -Copyright (c) 2000-2005 INRIA, France Telecom +Copyright (c) 2000-2011 INRIA, France Telecom All rights reserved. Redistribution and use in source and binary forms, with or without