From e700a3f8c754b49c648fe701e18ad6a69415edf3 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Tue, 11 Aug 2020 20:13:16 +0100 Subject: [PATCH 1/3] Use Opcodes#ASM7 (also allow specifying the API version) --- .../ClassProviderInheritanceProvider.java | 24 +++++++++++++++++-- .../analysis/InheritanceClassInfoVisitor.java | 4 ++-- build.gradle | 2 +- changelogs/0.3.3.md | 11 +++++++++ 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 changelogs/0.3.3.md diff --git a/bombe-asm/src/main/java/org/cadixdev/bombe/asm/analysis/ClassProviderInheritanceProvider.java b/bombe-asm/src/main/java/org/cadixdev/bombe/asm/analysis/ClassProviderInheritanceProvider.java index 5e8fc6a..66a55c4 100644 --- a/bombe-asm/src/main/java/org/cadixdev/bombe/asm/analysis/ClassProviderInheritanceProvider.java +++ b/bombe-asm/src/main/java/org/cadixdev/bombe/asm/analysis/ClassProviderInheritanceProvider.java @@ -33,6 +33,7 @@ import org.cadixdev.bombe.analysis.InheritanceProvider; import org.cadixdev.bombe.asm.jar.ClassProvider; import org.objectweb.asm.ClassReader; +import org.objectweb.asm.Opcodes; import java.util.Optional; @@ -45,19 +46,38 @@ */ public class ClassProviderInheritanceProvider implements InheritanceProvider { + private final int api; private final ClassProvider provider; - public ClassProviderInheritanceProvider(final ClassProvider provider) { + /** + * Creates a new inheritance provider backed by a class provider. + * + * @param api The ASM API version to use + * @param provider The class provider + * @since 0.3.3 + */ + public ClassProviderInheritanceProvider(final int api, final ClassProvider provider) { + this.api = api; this.provider = provider; } + /** + * Creates a new inheritance provider backed by a class provider, defaulting to + * {@link Opcodes#ASM7}. + * + * @param provider The class provider + */ + public ClassProviderInheritanceProvider(final ClassProvider provider) { + this(Opcodes.ASM7, provider); + } + @Override public Optional provide(final String klass) { final byte[] classBytes = this.provider.get(klass); if (classBytes == null) return Optional.empty(); final ClassReader reader = new ClassReader(classBytes); - final InheritanceClassInfoVisitor classInfoVisitor = new InheritanceClassInfoVisitor(); + final InheritanceClassInfoVisitor classInfoVisitor = new InheritanceClassInfoVisitor(this.api); reader.accept(classInfoVisitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); return Optional.of(classInfoVisitor.create()); } diff --git a/bombe-asm/src/main/java/org/cadixdev/bombe/asm/analysis/InheritanceClassInfoVisitor.java b/bombe-asm/src/main/java/org/cadixdev/bombe/asm/analysis/InheritanceClassInfoVisitor.java index 19fe36c..575a541 100644 --- a/bombe-asm/src/main/java/org/cadixdev/bombe/asm/analysis/InheritanceClassInfoVisitor.java +++ b/bombe-asm/src/main/java/org/cadixdev/bombe/asm/analysis/InheritanceClassInfoVisitor.java @@ -56,8 +56,8 @@ class InheritanceClassInfoVisitor extends ClassVisitor { private final Map fieldsByName = new HashMap<>(); private final Map methods = new HashMap<>(); - InheritanceClassInfoVisitor() { - super(Opcodes.ASM6); + InheritanceClassInfoVisitor(final int api) { + super(api); } InheritanceProvider.ClassInfo create() { diff --git a/build.gradle b/build.gradle index 805956c..2926671 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ subprojects { group = 'org.cadixdev' archivesBaseName = project.name.toLowerCase() - version = '0.3.2' + version = '0.3.3-SNAPSHOT' repositories { mavenCentral() diff --git a/changelogs/0.3.3.md b/changelogs/0.3.3.md new file mode 100644 index 0000000..970cd5b --- /dev/null +++ b/changelogs/0.3.3.md @@ -0,0 +1,11 @@ +Bombe 0.3.3 +=========== + +Bombe 0.3.3 resolves an oversight when bumping to ASM 7, notably that our +`ClassProviderInheritanceProvider` was still using `ASM6` - this has now been +resolved to use `ASM7`, in addition to a new constructor to allow for +third-parties to specify which ASM API version they wish to use. + +*As Bombe 0.3.x is still in use by the latest version of Lorenz and Atlas, and +used in software running today - this is why a further release to 0.3 is being +made*. From f16ea728d2209ff05dce6759fab1c46bf4276af9 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Tue, 11 Aug 2020 20:51:14 +0100 Subject: [PATCH 2/3] 0.3.3: Release Time --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2926671..11917ea 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ subprojects { group = 'org.cadixdev' archivesBaseName = project.name.toLowerCase() - version = '0.3.3-SNAPSHOT' + version = '0.3.3' repositories { mavenCentral() From 714d14513945147b20eea12e6e2b0842ed0fc3a1 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Tue, 11 Aug 2020 21:01:33 +0100 Subject: [PATCH 3/3] 0.4.2: Release Time --- build.gradle | 2 +- changelogs/0.4.2.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 changelogs/0.4.2.md diff --git a/build.gradle b/build.gradle index 33565f7..ffa6679 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ subprojects { group = 'org.cadixdev' archivesBaseName = project.name.toLowerCase() - version = '0.4.2-SNAPSHOT' + version = '0.4.2' repositories { mavenCentral() diff --git a/changelogs/0.4.2.md b/changelogs/0.4.2.md new file mode 100644 index 0000000..a4e7982 --- /dev/null +++ b/changelogs/0.4.2.md @@ -0,0 +1,9 @@ +Bombe 0.4.2 +=========== + +Bombe 0.4.2 resolves an oversight when bumping to ASM 7, notably that our +`ClassProviderInheritanceProvider` was still using `ASM6` - this has now been +resolved to use `ASM7`, in addition to a new constructor to allow for +third-parties to specify which ASM API version they wish to use. + +An equivalent change was made in Bombe 0.3.3.