diff options
author | Andy Clement <aclement@pivotal.io> | 2021-05-22 17:55:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-22 17:55:00 -0700 |
commit | d2d5533f8f2f7b8116d6e171cc4e7d39f6ce1a29 (patch) | |
tree | c4978f635d6c49f287c14057d7de526b15c97b43 | |
parent | 95fc5eec2de1b46c069f805a0a8657427a1a0a0a (diff) | |
parent | 221c3948785b28e842af7c6ea4662a2ea33d24e5 (diff) | |
download | aspectj-d2d5533f8f2f7b8116d6e171cc4e7d39f6ce1a29.tar.gz aspectj-d2d5533f8f2f7b8116d6e171cc4e7d39f6ce1a29.zip |
Merge pull request #53 from kriegaex/remove-asm-renamed
Remove ASM-renamed, replace by dynamic relocation via Maven Shade
-rw-r--r-- | ajde.core/pom.xml | 4 | ||||
-rw-r--r-- | ajde/pom.xml | 4 | ||||
-rw-r--r-- | ajdoc/pom.xml | 4 | ||||
-rw-r--r-- | asm-renamed/pom.xml | 184 | ||||
-rw-r--r-- | aspectjtools/aspectjtools-assembly.xml | 2 | ||||
-rw-r--r-- | aspectjtools/pom.xml | 50 | ||||
-rw-r--r-- | aspectjweaver/aspectjweaver-assembly.xml | 2 | ||||
-rw-r--r-- | aspectjweaver/pom.xml | 50 | ||||
-rw-r--r-- | loadtime/pom.xml | 4 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/pom.xml | 4 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java | 8 | ||||
-rw-r--r-- | pom.xml | 5 | ||||
-rw-r--r-- | run-all-junit-tests/pom.xml | 6 | ||||
-rw-r--r-- | taskdefs/pom.xml | 4 | ||||
-rw-r--r-- | testing-drivers/pom.xml | 4 | ||||
-rw-r--r-- | testing/pom.xml | 4 | ||||
-rw-r--r-- | tests/java5/ataspectj/ataspectj/UnweavableTest.java | 8 | ||||
-rw-r--r-- | tests/pom.xml | 4 | ||||
-rw-r--r-- | weaver/pom.xml | 4 | ||||
-rw-r--r-- | weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java | 6 | ||||
-rw-r--r-- | weaver/src/main/java/org/aspectj/weaver/bcel/asm/AsmDetector.java | 17 | ||||
-rw-r--r-- | weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java | 10 |
22 files changed, 145 insertions, 243 deletions
diff --git a/ajde.core/pom.xml b/ajde.core/pom.xml index 3121c4f49..9cb66316f 100644 --- a/ajde.core/pom.xml +++ b/ajde.core/pom.xml @@ -42,8 +42,8 @@ <artifactId>org.eclipse.jdt.core</artifactId> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> <dependency> <groupId>org.aspectj</groupId> diff --git a/ajde/pom.xml b/ajde/pom.xml index e48254e59..79d229318 100644 --- a/ajde/pom.xml +++ b/ajde/pom.xml @@ -33,8 +33,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> <dependency> <groupId>org.aspectj</groupId> diff --git a/ajdoc/pom.xml b/ajdoc/pom.xml index e071e10c3..60b39e6cb 100644 --- a/ajdoc/pom.xml +++ b/ajdoc/pom.xml @@ -55,8 +55,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> <dependency> <groupId>org.aspectj</groupId> diff --git a/asm-renamed/pom.xml b/asm-renamed/pom.xml deleted file mode 100644 index a94b1863c..000000000 --- a/asm-renamed/pom.xml +++ /dev/null @@ -1,184 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <!-- The AspectJ root POM is the parent, but this module is not a submodule --> - <parent> - <groupId>org.aspectj</groupId> - <artifactId>aspectj-parent</artifactId> - <version>1.9.7.BUILD-SNAPSHOT</version> - </parent> - - <artifactId>asm-renamed</artifactId> - <version>${asm.version}</version> - - <name>ASM for AspectJ</name> - <description> - This module relocates the original ASM artifact from package name 'org.objectweb.asm' to 'aj.org.objectweb.asm', - using Maven Shade Plugin. - - In order to avoid committing the binary to the AspectJ SCM repository and using it as a system-scoped dependency, we - deploy it to aspectj.dev. - - Whenever it is necessary to upgrade to a new ASM version in order to make AspectJ compatible with a new Java - version, please build and deploy this module after upgrading property 'asm.version'. Make sure you have the - credentials for write access to the aspectj.dev Maven repository WebDAV share and the correct server, profile and - property entries in settings.xml. - - Then you should be able to run 'mvn clean deploy' for this module and be fine. - - Caveat for IntelliJ IDEA: The project cannot be built in IDEA (Ctrl-F9) if this module is visible in the Maven view. - If so, right-click it and select "Unlink Maven Projects". Unfortunately, "Ignore Projects" is not enough. If Maven - knows of this Maven module, it cannot compile other modules depending on shaded class names, because it cannot find - the binaries. IDEA will just stop looking at the local Maven repository in this case. - </description> - - <properties> - <!-- By default, do not deploy artifacts - but deploy this one used by the main build --> - <maven.deploy.skip>false</maven.deploy.skip> - </properties> - - <build> - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <executions> - <!-- Nothing to compile in this module --> - <execution> - <id>default-compile</id> - <phase>none</phase> - </execution> - <execution> - <id>default-testCompile</id> - <phase>none</phase> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <configuration> - <!-- Re-create original source JAR in order to avoid re-shading already shaded JAR in non-clean builds --> - <forceCreation>true</forceCreation> - <!-- - Avoid attaching the source JAR here, because Maven Shade will add the source uber JAR later. Because both - JARs have the same final name, Maven Install/Deploy would see two artifacts attached to the build, which - would lead to double deployment and hence to an error "Transfer failed for ...-sources.jar 409 Conflict". - See also https://issues.apache.org/jira/browse/MDEPLOY-254 and comments by Alexander Kriegisch. - --> - <attach>false</attach> - <archive> - <addMavenDescriptor>false</addMavenDescriptor> - </archive> - </configuration> - <executions> - <execution> - <id>attach-sources</id> - <phase>package</phase> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <addMavenDescriptor>false</addMavenDescriptor> - </archive> - <!-- Re-create original JAR in order to avoid re-shading already shaded JAR in non-clean builds --> - <forceCreation>true</forceCreation> - </configuration> - <executions> - <execution> - <!-- Avoid creating test JAR --> - <id>test-jar</id> - <phase>none</phase> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <configuration> - <createSourcesJar>true</createSourcesJar> - <createDependencyReducedPom>false</createDependencyReducedPom> - <shadedArtifactAttached>false</shadedArtifactAttached> - </configuration> - <executions> - <execution> - <id>asm-relocate</id> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <minimizeJar>false</minimizeJar> - <shadeSourcesContent>true</shadeSourcesContent> - <artifactSet> - <excludes> - <exclude>${project.groupId}</exclude> - </excludes> - </artifactSet> - <filters> - <filter> - <artifact>*</artifact> - <excludes> - <exclude>META-INF/*</exclude> - </excludes> - </filter> - </filters> - <relocations> - <relocation> - <pattern>org.objectweb.asm</pattern> - <shadedPattern>aj.org.objectweb.asm</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>flatten-maven-plugin</artifactId> - <version>1.2.2</version> - <executions> - <!-- Remove shaded dependencies from uber JAR --> - <execution> - <id>flatten</id> - <phase>process-resources</phase> - <goals> - <goal>flatten</goal> - </goals> - <configuration> - <flattenMode>defaults</flattenMode> - <pomElements> - <dependencies>remove</dependencies> - </pomElements> - <outputDirectory>${project.build.directory}</outputDirectory> - <flattenedPomFilename>flattened-pom.xml</flattenedPomFilename> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>org.ow2.asm</groupId> - <artifactId>asm</artifactId> - </dependency> - </dependencies> - -</project> diff --git a/aspectjtools/aspectjtools-assembly.xml b/aspectjtools/aspectjtools-assembly.xml index 9a6777509..004e1048e 100644 --- a/aspectjtools/aspectjtools-assembly.xml +++ b/aspectjtools/aspectjtools-assembly.xml @@ -17,7 +17,7 @@ <useProjectArtifact>false</useProjectArtifact> <includes> <include>org.aspectj:org.eclipse.jdt.core</include> - <include>org.aspectj:asm-renamed</include> + <include>org.ow2.asm:asm</include> </includes> </dependencySet> </dependencySets> diff --git a/aspectjtools/pom.xml b/aspectjtools/pom.xml index edd60f711..0d5eb7913 100644 --- a/aspectjtools/pom.xml +++ b/aspectjtools/pom.xml @@ -50,7 +50,8 @@ <configuration> <classifier>sources</classifier> <!--<failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>--> - <includeArtifactIds>org.eclipse.jdt.core,asm-renamed</includeArtifactIds> + <includeGroupIds>org.aspectj,org.ow2.asm</includeGroupIds> + <includeArtifactIds>org.eclipse.jdt.core,asm</includeArtifactIds> <outputDirectory>${project.build.directory}/unzipped-sources</outputDirectory> <!-- Avoid accidentally shading test-scoped dependencies like JUnit --> <includeScope>runtime</includeScope> @@ -140,6 +141,49 @@ </executions> </plugin> + <!-- + Relocate ASM from 'org.objectweb.asm' to 'aj.org.objectweb.asm' + + TODO: Using Maven Shade after Maven Assembly instead of creating uber JAR and relocating package names at the + same time is suboptimal and maybe slower than doing both at the same time. Migrating from Assembly to Shade + requires all dependencies to produce source JARs, though, which currently is not the case. Because we also + want to create a complete source JAR, for now we keep Assembly around, because it manually copies project + sources from their respective directories before zipping them up. + --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <configuration> + <createSourcesJar>true</createSourcesJar> + <createDependencyReducedPom>false</createDependencyReducedPom> + <shadedArtifactAttached>false</shadedArtifactAttached> + </configuration> + <executions> + <execution> + <id>asm-relocate</id> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <minimizeJar>false</minimizeJar> + <shadeSourcesContent>true</shadeSourcesContent> + <artifactSet> + <includes> + <include>${project.groupId}:${project.artifactId}</include> + </includes> + </artifactSet> + <relocations> + <relocation> + <pattern>org.objectweb.asm</pattern> + <shadedPattern>aj.org.objectweb.asm</shadedPattern> + </relocation> + </relocations> + </configuration> + </execution> + </executions> + </plugin> + <!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module --> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -179,8 +223,8 @@ <artifactId>org.eclipse.jdt.core</artifactId> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> </dependencies> diff --git a/aspectjweaver/aspectjweaver-assembly.xml b/aspectjweaver/aspectjweaver-assembly.xml index 332504316..3433f6555 100644 --- a/aspectjweaver/aspectjweaver-assembly.xml +++ b/aspectjweaver/aspectjweaver-assembly.xml @@ -16,7 +16,7 @@ <!-- Avoid warning when trying to add non-existing main artifact JAR --> <useProjectArtifact>false</useProjectArtifact> <includes> - <include>org.aspectj:asm-renamed</include> + <include>org.ow2.asm:asm</include> </includes> </dependencySet> </dependencySets> diff --git a/aspectjweaver/pom.xml b/aspectjweaver/pom.xml index a9147dd14..6689fbb6e 100644 --- a/aspectjweaver/pom.xml +++ b/aspectjweaver/pom.xml @@ -50,7 +50,8 @@ <configuration> <classifier>sources</classifier> <!--<failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>--> - <includeArtifactIds>asm-renamed</includeArtifactIds> + <includeGroupIds>org.ow2.asm</includeGroupIds> + <includeArtifactIds>asm</includeArtifactIds> <outputDirectory>${project.build.directory}/unzipped-sources</outputDirectory> <!-- Avoid accidentally shading test-scoped dependencies like JUnit --> <includeScope>runtime</includeScope> @@ -143,6 +144,49 @@ </executions> </plugin> + <!-- + Relocate ASM from 'org.objectweb.asm' to 'aj.org.objectweb.asm' + + TODO: Using Maven Shade after Maven Assembly instead of creating uber JAR and relocating package names at the + same time is suboptimal and maybe slower than doing both at the same time. Migrating from Assembly to Shade + requires all dependencies to produce source JARs, though, which currently is not the case. Because we also + want to create a complete source JAR, for now we keep Assembly around, because it manually copies project + sources from their respective directories before zipping them up. + --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <configuration> + <createSourcesJar>true</createSourcesJar> + <createDependencyReducedPom>false</createDependencyReducedPom> + <shadedArtifactAttached>false</shadedArtifactAttached> + </configuration> + <executions> + <execution> + <id>asm-relocate</id> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <minimizeJar>false</minimizeJar> + <shadeSourcesContent>true</shadeSourcesContent> + <artifactSet> + <includes> + <include>${project.groupId}:${project.artifactId}</include> + </includes> + </artifactSet> + <relocations> + <relocation> + <pattern>org.objectweb.asm</pattern> + <shadedPattern>aj.org.objectweb.asm</shadedPattern> + </relocation> + </relocations> + </configuration> + </execution> + </executions> + </plugin> + <!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module --> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -178,8 +222,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> </dependencies> diff --git a/loadtime/pom.xml b/loadtime/pom.xml index ae0645a92..7bc38c2fc 100644 --- a/loadtime/pom.xml +++ b/loadtime/pom.xml @@ -38,8 +38,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> <dependency> <groupId>org.aspectj</groupId> diff --git a/org.aspectj.ajdt.core/pom.xml b/org.aspectj.ajdt.core/pom.xml index 747fce918..6117b1580 100644 --- a/org.aspectj.ajdt.core/pom.xml +++ b/org.aspectj.ajdt.core/pom.xml @@ -64,8 +64,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> </dependencies> diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java index 6a93731a5..22db23d17 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java @@ -63,12 +63,12 @@ public abstract class AjcTestCase extends TestCase { */ protected Ajc ajc; - public static final String CLASSPATH_ASM_RENAMED = + public static final String CLASSPATH_ASM = Arrays.stream(System.getProperty("java.class.path") .split(File.pathSeparator)) - .filter(path -> path.contains("asm-renamed")) + .filter(path -> path.replace('\\', '/').contains("org/ow2/asm/")) .findFirst() - .orElseThrow(() -> new RuntimeException("library 'asm-renamed' not found on classpath")); + .orElseThrow(() -> new RuntimeException("ASM library not found on classpath")); // see Ajc and AntSpec public static final String DEFAULT_CLASSPATH_ENTRIES = @@ -76,7 +76,7 @@ public abstract class AjcTestCase extends TestCase { + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "junit" + File.separator + "junit.jar" + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator + "bcel.jar" + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator + "bcel-verifier.jar" - + File.pathSeparator + CLASSPATH_ASM_RENAMED + + File.pathSeparator + CLASSPATH_ASM + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "test" + File.separator + "testing-client.jar" // hmmm, this next one should perhaps point to an aj-build jar... + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "test" + File.separator + "aspectjrt.jar" @@ -148,11 +148,6 @@ <module>run-all-junit-tests</module> <module>docs</module> - <!-- FYI: These are NOT meant to be sub-modules but a stand-alone projects built and deployed independently. --> - <!-- - <module>asm-renamed</module> - --> - <!-- create the important artifacts we care about --> <module>aspectjrt</module> <module>aspectjweaver</module> diff --git a/run-all-junit-tests/pom.xml b/run-all-junit-tests/pom.xml index c1d3a1fe4..7a3f8abe9 100644 --- a/run-all-junit-tests/pom.xml +++ b/run-all-junit-tests/pom.xml @@ -157,8 +157,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> <scope>test</scope> </dependency> <dependency> @@ -245,7 +245,7 @@ <usedDependencies> <!-- The tests need these during runtime, even though no direct usage is in our classes --> <usedDependency>ant:ant-launcher</usedDependency> - <usedDependency>org.aspectj:asm-renamed</usedDependency> + <usedDependency>org.ow2.asm:asm</usedDependency> <usedDependency>org.aspectj:ajde</usedDependency> <usedDependency>org.aspectj:build</usedDependency> <usedDependency>org.aspectj:tests</usedDependency> diff --git a/taskdefs/pom.xml b/taskdefs/pom.xml index d44faf2ca..39e120e21 100644 --- a/taskdefs/pom.xml +++ b/taskdefs/pom.xml @@ -39,8 +39,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> <dependency> <!-- Identical to lib/ant/lib/ant.jar, a former system-scoped dependency --> diff --git a/testing-drivers/pom.xml b/testing-drivers/pom.xml index d15888cef..b252d276a 100644 --- a/testing-drivers/pom.xml +++ b/testing-drivers/pom.xml @@ -35,8 +35,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> </dependencies> diff --git a/testing/pom.xml b/testing/pom.xml index dfd975838..335da941d 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -49,8 +49,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> <dependency> <groupId>org.aspectj</groupId> diff --git a/tests/java5/ataspectj/ataspectj/UnweavableTest.java b/tests/java5/ataspectj/ataspectj/UnweavableTest.java index 95f9e2712..066b30b05 100644 --- a/tests/java5/ataspectj/ataspectj/UnweavableTest.java +++ b/tests/java5/ataspectj/ataspectj/UnweavableTest.java @@ -22,10 +22,10 @@ import java.io.Serializable; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; -import aj.org.objectweb.asm.ClassWriter; -import aj.org.objectweb.asm.Opcodes; -import aj.org.objectweb.asm.MethodVisitor; -import aj.org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.AnnotationVisitor; /** * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> diff --git a/tests/pom.xml b/tests/pom.xml index 95f91d838..99d1809ec 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -40,8 +40,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> <dependency> <groupId>org.aspectj</groupId> diff --git a/weaver/pom.xml b/weaver/pom.xml index b812ffba1..f47c1ddc5 100644 --- a/weaver/pom.xml +++ b/weaver/pom.xml @@ -62,8 +62,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm-renamed</artifactId> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> </dependency> </dependencies> </project> diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java index 5e72d84ce..22c7945f0 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java @@ -754,7 +754,11 @@ public final class LazyClassGen { // are required (unless turning off the verifier) if ((myGen.getMajor() == Constants.MAJOR_1_6 && world.shouldGenerateStackMaps()) || myGen.getMajor() > Constants.MAJOR_1_6) { if (!AsmDetector.isAsmAround) { - throw new BCException("Unable to find Asm for stackmap generation (Looking for 'aj.org.objectweb.asm.ClassReader'). Stackmap generation for woven code is required to avoid verify errors on a Java 1.7 or higher runtime"); + throw new BCException( + "Unable to find ASM classes (" + AsmDetector.CLASS_READER + ", " + AsmDetector.CLASS_VISITOR + ") " + + "for stackmap generation. Stackmap generation for woven code is required to avoid verify errors " + + "on a Java 1.7 or higher runtime." + ); } wovenClassFileData = StackMapAdder.addStackMaps(world, wovenClassFileData); } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/asm/AsmDetector.java b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/AsmDetector.java index 5d5bb6990..5fa7bd006 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/asm/AsmDetector.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/AsmDetector.java @@ -11,26 +11,25 @@ * ******************************************************************/ package org.aspectj.weaver.bcel.asm; -import java.lang.reflect.Method; - /** * Determines if a version of asm is around that will enable us to add stack map attributes to classes that we produce. - * + * * @author Andy Clement */ public class AsmDetector { - + public static final String CLASS_READER = "org.objectweb.asm.ClassReader"; + public static final String CLASS_VISITOR = "org.objectweb.asm.ClassVisitor"; public static boolean isAsmAround; static { try { - Class<?> reader = Class.forName("aj.org.objectweb.asm.ClassReader"); - Class<?> visitor = Class.forName("aj.org.objectweb.asm.ClassVisitor"); - Method m = reader.getMethod("accept", new Class[] { visitor, Integer.TYPE }); - isAsmAround = m != null; + Class<?> reader = Class.forName(CLASS_READER); + Class<?> visitor = Class.forName(CLASS_VISITOR); + reader.getMethod("accept", visitor, Integer.TYPE); + isAsmAround = true; } catch (Exception e) { isAsmAround = false; } - // System.out.println(isAsmAround?"ASM detected":"No ASM found"); + //System.out.println(isAsmAround ? "ASM detected" : "No ASM found"); } } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java index 1de90f888..07f3435ae 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java @@ -15,11 +15,11 @@ import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; -import aj.org.objectweb.asm.ClassReader; -import aj.org.objectweb.asm.ClassVisitor; -import aj.org.objectweb.asm.ClassWriter; -import aj.org.objectweb.asm.MethodVisitor; -import aj.org.objectweb.asm.Opcodes; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; /** * Uses asm to add the stack map attribute to methods in a class. The class is passed in as pure byte data and then a reader/writer |