Skip to content

Commit

Permalink
Include instrumented type in type pool that is offered to frame compu…
Browse files Browse the repository at this point in the history
…tation.
  • Loading branch information
raphw committed Mar 28, 2023
1 parent c2d3a30 commit ac27842
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .mvn/checksums.sha256
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ net.bytebuddy:byte-buddy-maven-plugin:jar:1.13.0 69948daabf5c9aa150d68140af7ec9d
net.bytebuddy:byte-buddy-maven-plugin:jar:1.14.0 cd5194f72dda1e634479278c8feb07125b9043cade15e6620fc8020af7ed3f8d
net.bytebuddy:byte-buddy-maven-plugin:jar:1.14.1 9cb63d477916fa6b02b021fc44681da43172284c8c49e9cc1a5917f4705d82ae
net.bytebuddy:byte-buddy-maven-plugin:jar:1.14.2 f5d2be6baf531ebbde91274181504fcb92ff07d0a2c21c55dcc7ff6a87cbc790
net.bytebuddy:byte-buddy-maven-plugin:jar:1.14.3 3d52c7d65b9fdac180f90612c377a39fc9b81e1d48f02aced9fbdcdfeda57659
net.bytebuddy:byte-buddy-maven-plugin:pom:1.12.19 c2051f8cbdf328692f36077627be07168334ee9167b72e5bf608eae624163b4f
net.bytebuddy:byte-buddy-maven-plugin:pom:1.12.20 2d112ff342e7db7da484d038807749c1a87c81419b789a86b950a37bdd65b207
net.bytebuddy:byte-buddy-maven-plugin:pom:1.12.21 13576ca6b9c44ab9789ada11ee400dcd3f4bcc22a7cab6f7052aeeb49a8c02e1
Expand All @@ -610,6 +611,7 @@ net.bytebuddy:byte-buddy-maven-plugin:pom:1.13.0 067042fddc12ef162cc9e323fb61b69
net.bytebuddy:byte-buddy-maven-plugin:pom:1.14.0 77180195e35ece94e22f50d5645c15ee7b31205f6726b42f58175911dde0508d
net.bytebuddy:byte-buddy-maven-plugin:pom:1.14.1 b823df6013839c201a837490dc085af9753cd179d7dd0287d62549d7ec417148
net.bytebuddy:byte-buddy-maven-plugin:pom:1.14.2 d8b553fee46eba6a96de2d9b4bea1efc23fa13e33c9e935b0db492935e447f4c
net.bytebuddy:byte-buddy-maven-plugin:pom:1.14.3 8ddbd06f4a027c86e16d3d5e9e685d5980be893c5f3991ebbda600c6e260fa1e
net.bytebuddy:byte-buddy-parent:pom:1.12.19 72ab6fef409e812921f4728b3c4b6ef4fa53bc25fabb0488fc2cae367368b54d
net.bytebuddy:byte-buddy-parent:pom:1.12.20 ac59dd7bc0316c51ab29e7c44ae7941ba8c7bf84789edb1dc8fbef2f16535b99
net.bytebuddy:byte-buddy-parent:pom:1.12.21 ff66d886607137e2095f20c90ee093f3c80329164eff091a0688bdce37e3e6b2
Expand All @@ -619,6 +621,7 @@ net.bytebuddy:byte-buddy-parent:pom:1.13.0 9d03c3cc08c753cf3bab0f2f9ea281af84b90
net.bytebuddy:byte-buddy-parent:pom:1.14.0 c5f22b13c9e304af7d0439d1ce982e07967f6667685c5b610dc3da4888281dde
net.bytebuddy:byte-buddy-parent:pom:1.14.1 1b64c399c745548ac41d6f11429f2f39a749acc33a7cae3d28c5f0301cc9a131
net.bytebuddy:byte-buddy-parent:pom:1.14.2 6db003ef2b312e8c30e67cf5a7f39d8be1eaa3bac99e79d715c03d02c520f587
net.bytebuddy:byte-buddy-parent:pom:1.14.3 18d87a7371f2d5d7bf9473124e51ed8a9ae1ad86ed1085cc151c8266deb519d2
net.bytebuddy:byte-buddy:jar:1.12.19 030704139e46f32c38d27060edee9e0676b0a0fff8a8be53461515154ba8a7be
net.bytebuddy:byte-buddy:jar:1.12.20 0a9b2795e0e2391117062f0fc7f6ae98fa3c2a7c927847ff1e01bb7cffcd9167
net.bytebuddy:byte-buddy:jar:1.12.21 f6f45c2237a7f132c16745ad2a52c4cdde58028b11ee80b09f0d422f4930d685
Expand All @@ -628,6 +631,7 @@ net.bytebuddy:byte-buddy:jar:1.13.0 b864bd7ad2399b4d79d6b34b7a6d7ce115eda8123129
net.bytebuddy:byte-buddy:jar:1.14.0 0af7cfa59aaf7dff002de984896eb43c987c596f726ae635e0e0d8229f154297
net.bytebuddy:byte-buddy:jar:1.14.1 63479f9a0a1b28f98313230d688a46b02bd80d09a700e127482d0bd635b47bad
net.bytebuddy:byte-buddy:jar:1.14.2 042e6b26e1f3fdd1e6244e9dcb381065b15d230ecd93838691dcc03918c9d525
net.bytebuddy:byte-buddy:jar:1.14.3 1db7ee74714ed852a2bd23c33d066e8a4f6031411cbd0ce75daa58b7670894ad
net.bytebuddy:byte-buddy:pom:1.12.19 435fb8664aa9b7e120c8dd6c707d4eafa642fa262dff6d5e3f71dc25c69e89eb
net.bytebuddy:byte-buddy:pom:1.12.20 46353d5c52659c40f0f54d05c757665552e492be36087c19307598d1bf07bbfb
net.bytebuddy:byte-buddy:pom:1.12.21 95eb42c89fd04f62187dd33b9cdf04d2df1b876b375c16ad32c0a5a1cc1a070b
Expand All @@ -637,6 +641,7 @@ net.bytebuddy:byte-buddy:pom:1.13.0 de30e6a985a016b3ac15c86e6d74f794667bf0014e77
net.bytebuddy:byte-buddy:pom:1.14.0 e8a0805e953c75ed5a5803288e87f2721244df4427a995b0cb962b1c0cc29865
net.bytebuddy:byte-buddy:pom:1.14.1 2b6c20e711394870362fcbeec485abbd5026620974dacad719d454bc1077f192
net.bytebuddy:byte-buddy:pom:1.14.2 c18ad7b621b3910528c7a9038d74e7e33fe79aca88e7f2b58bb853eabb6b33ff
net.bytebuddy:byte-buddy:pom:1.14.3 50e1c99fcf83f3131f32aed4225ee8ff56e40496ffed4daf946b24e50873481d
net.i2p.crypto:eddsa:jar:0.3.0 4dda1120db856640dbec04140ed23242215a075fe127bdefa0dcfa29fb31267d
net.i2p.crypto:eddsa:pom:0.3.0 b6b13878e4bae8b768d7ea5732cb4d66ab2f5e9fe707c0a1a776cde9de52051b
net.java.dev.jna:jna-platform:jar:5.12.1 8ce969116cac95bd61b07a8d5e07174b352e63301473caac72c395e3c08488d2
Expand Down
2 changes: 1 addition & 1 deletion byte-buddy-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.2</version>
<version>1.14.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
12 changes: 6 additions & 6 deletions byte-buddy-dep/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<plugin>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-maven-plugin</artifactId>
<version>1.14.2</version>
<version>1.14.3</version>
<executions>
<execution>
<phase>compile</phase>
Expand All @@ -142,7 +142,7 @@
<transformation>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.2</version>
<version>1.14.3</version>
<plugin>net.bytebuddy.build.HashCodeAndEqualsPlugin$WithNonNullableFields</plugin>
<arguments>
<argument>
Expand All @@ -154,13 +154,13 @@
<transformation>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.2</version>
<version>1.14.3</version>
<plugin>net.bytebuddy.build.CachedReturnPlugin</plugin>
</transformation>
<transformation>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.2</version>
<version>1.14.3</version>
<plugin>net.bytebuddy.build.AccessControllerPlugin</plugin>
<arguments>
<argument>
Expand All @@ -172,13 +172,13 @@
<transformation>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.2</version>
<version>1.14.3</version>
<plugin>net.bytebuddy.build.DispatcherAnnotationPlugin</plugin>
</transformation>
<transformation>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.2</version>
<version>1.14.3</version>
<plugin>net.bytebuddy.build.RepeatedAnnotationPlugin</plugin>
</transformation>
</transformations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ protected TypeWriter<T> toTypeWriter(TypePool typePool) {
implementationContextFactory,
typeValidation,
classWriterStrategy,
typePool,
TypePool.Explicit.wrap(instrumentedType, auxiliaryTypes, typePool),
classFileLocator);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ protected TypeWriter<T> toTypeWriter(TypePool typePool) {
implementationContextFactory,
typeValidation,
classWriterStrategy,
typePool,
TypePool.Explicit.wrap(instrumentedType, auxiliaryTypes, typePool),
originalType,
classFileLocator,
methodRebaseResolver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ protected TypeWriter<T> toTypeWriter(TypePool typePool) {
implementationContextFactory,
typeValidation,
classWriterStrategy,
typePool,
TypePool.Explicit.wrap(instrumentedType, auxiliaryTypes, typePool),
originalType,
classFileLocator);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ protected TypeWriter<T> toTypeWriter(TypePool typePool) {
implementationContextFactory,
typeValidation,
classWriterStrategy,
typePool);
TypePool.Explicit.wrap(instrumentedType, auxiliaryTypes, typePool));
}

/**
Expand Down
51 changes: 47 additions & 4 deletions byte-buddy-dep/src/main/java/net/bytebuddy/pool/TypePool.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@
import net.bytebuddy.description.method.MethodList;
import net.bytebuddy.description.method.ParameterDescription;
import net.bytebuddy.description.method.ParameterList;
import net.bytebuddy.description.type.*;
import net.bytebuddy.description.type.PackageDescription;
import net.bytebuddy.description.type.RecordComponentDescription;
import net.bytebuddy.description.type.RecordComponentList;
import net.bytebuddy.description.type.TypeDefinition;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.description.type.TypeList;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
import net.bytebuddy.implementation.bytecode.StackSize;
import net.bytebuddy.matcher.ElementMatcher;
Expand All @@ -40,7 +46,17 @@
import net.bytebuddy.utility.nullability.AlwaysNull;
import net.bytebuddy.utility.nullability.MaybeNull;
import net.bytebuddy.utility.nullability.UnknownNull;
import org.objectweb.asm.*;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.RecordComponentVisitor;
import org.objectweb.asm.Type;
import org.objectweb.asm.TypePath;
import org.objectweb.asm.TypeReference;
import org.objectweb.asm.signature.SignatureReader;
import org.objectweb.asm.signature.SignatureVisitor;

Expand All @@ -49,12 +65,20 @@
import java.lang.annotation.Annotation;
import java.lang.ref.SoftReference;
import java.lang.reflect.GenericSignatureFormatError;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReference;

import static net.bytebuddy.matcher.ElementMatchers.*;
import static net.bytebuddy.matcher.ElementMatchers.hasDescriptor;
import static net.bytebuddy.matcher.ElementMatchers.hasMethodName;
import static net.bytebuddy.matcher.ElementMatchers.is;
import static net.bytebuddy.matcher.ElementMatchers.named;

/**
* A type pool allows the retrieval of {@link TypeDescription} by its name.
Expand Down Expand Up @@ -9130,6 +9154,25 @@ public Explicit(TypePool parent, Map<String, TypeDescription> types) {
this.types = types;
}

/**
* Wraps another type pool for an instrumented type and its auxiliary types.
*
* @param instrumentedType The instrumented type.
* @param auxiliaryTypes The auxiliary types.
* @param typePool The type pool to wrap.
* @return A type pool that also represents the instrumented type and its auxiliary types.
*/
public static TypePool wrap(TypeDescription instrumentedType, List<? extends DynamicType> auxiliaryTypes, TypePool typePool) {
Map<String, TypeDescription> typeDescriptions = new HashMap<String, TypeDescription>();
typeDescriptions.put(instrumentedType.getName(), instrumentedType);
for (DynamicType auxiliaryType : auxiliaryTypes) {
for (TypeDescription typeDescription : auxiliaryType.getAllTypes().keySet()) {
typeDescriptions.put(typeDescription.getName(), typeDescription);
}
}
return new Explicit(typePool, typeDescriptions);
}

@Override
protected Resolution doDescribe(String name) {
TypeDescription typeDescription = types.get(name);
Expand Down
5 changes: 5 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Byte Buddy release notes
------------------------

### 13. March 2023: version 1.14.3

- Make `MethodGraph.Compiler` failsafe when processing incomplete methods.
- Update ASM.

### 13. March 2023: version 1.14.2

- Fix offset mapping for local variable array remapping in `Advice`.
Expand Down

0 comments on commit ac27842

Please sign in to comment.