Browse Source

Improve bridge method test, bootstrapping ASM usage

Instead of using a pre-generated JAR, the source code generating the
class with reordered methods (bridge method first) is now compiled
directly before usage. This is possible, because in the previous commit
ASM was put on the Ajc classpath for tests.

Relates to #256.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
tags/V1_9_20_1
Alexander Kriegisch 10 months ago
parent
commit
2af1b06b6a

+ 5
- 2
tests/bugs1921/gh_spring_27761/JpaRepositoryDump.java View File

import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;


import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;


class JpaRepositoryDump implements Opcodes {
public class JpaRepositoryDump implements Opcodes {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
try (FileOutputStream outputStream = new FileOutputStream("JpaRepository.class")) {
// Write class file to test sandbox directory
String classFile = args[0] + File.separator + "JpaRepository.class";
try (FileOutputStream outputStream = new FileOutputStream(classFile)) {
outputStream.write(dump()); outputStream.write(dump());
} }
} }

BIN
tests/bugs1921/gh_spring_27761/JpaRepository_bridge_first.jar View File


+ 6
- 1
tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml View File



<!-- https://github.com/spring-projects/spring-framework/issues/27761 --> <!-- https://github.com/spring-projects/spring-framework/issues/27761 -->
<ajc-test dir="bugs1921/gh_spring_27761" vm="8" title="do not match bridge methods"> <ajc-test dir="bugs1921/gh_spring_27761" vm="8" title="do not match bridge methods">
<compile files="RepositoryAspect.aj" inpath="JpaRepository_bridge_first.jar" options="-8"/>
<!-- (1) Use ASM to generate JpaRepository class with reordered methods -->
<compile files="JpaRepositoryDump.java" options="-8"/>
<run class="JpaRepositoryDump" options="$sandbox"/>
<file deletefile="JpaRepositoryDump.class"/>
<!-- (2) Use AJC to compile the remaining classes and run the test -->
<compile files="RepositoryAspect.aj" options="-8"/>
<run class="RepositoryAspect"> <run class="RepositoryAspect">
<stdout> <stdout>
<line text="execution(List RepositoryImpl.saveAll(Iterable))"/> <line text="execution(List RepositoryImpl.saveAll(Iterable))"/>

Loading…
Cancel
Save