Skip to content

Commit

Permalink
Merge branch 'hotfix-0.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamierocks committed Aug 11, 2020
2 parents 709d4c6 + 714d145 commit 0c7bd12
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.cadixdev.bombe.analysis.InheritanceProvider;
import org.cadixdev.bombe.jar.ClassProvider;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Opcodes;

import java.util.Optional;

Expand All @@ -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<ClassInfo> 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class InheritanceClassInfoVisitor extends ClassVisitor {
private final Map<String, InheritanceType> fieldsByName = new HashMap<>();
private final Map<MethodSignature, InheritanceType> methods = new HashMap<>();

InheritanceClassInfoVisitor() {
super(Opcodes.ASM6);
InheritanceClassInfoVisitor(final int api) {
super(api);
}

InheritanceProvider.ClassInfo create() {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ subprojects {

group = 'org.cadixdev'
archivesBaseName = project.name.toLowerCase()
version = '0.4.1'
version = '0.4.2'

repositories {
mavenCentral()
Expand Down
11 changes: 11 additions & 0 deletions changelogs/0.3.3.md
Original file line number Diff line number Diff line change
@@ -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*.
9 changes: 9 additions & 0 deletions changelogs/0.4.2.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 0c7bd12

Please sign in to comment.