diff -Nru byte-buddy-1.7.10/appveyor.yml byte-buddy-1.7.11/appveyor.yml
--- byte-buddy-1.7.10/appveyor.yml 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/appveyor.yml 2018-03-02 17:30:55.000000000 +0000
@@ -18,5 +18,5 @@
build_script:
- java -Xmx32m -version
- javac -J-Xmx32m -version
- - .\mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -pl "!byte-buddy-gradle-plugin"
- - .\mvnw jacoco:prepare-agent verify jacoco:report %TARGET% -Pintegration -Dnet.bytebuddy.test.ci=true -pl "!byte-buddy-gradle-plugin"
+ - .\mvnw install -DskipTests=true -Dmaven.javadoc.skip=true
+ - .\mvnw jacoco:prepare-agent verify jacoco:report %TARGET% -Pintegration -Dnet.bytebuddy.test.ci=true
diff -Nru byte-buddy-1.7.10/byte-buddy/pom.xml byte-buddy-1.7.11/byte-buddy/pom.xml
--- byte-buddy-1.7.10/byte-buddy/pom.xml 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy/pom.xml 2018-03-02 17:30:55.000000000 +0000
@@ -5,7 +5,7 @@
net.bytebuddybyte-buddy-parent
- 1.7.10
+ 1.7.11byte-buddy
diff -Nru byte-buddy-1.7.10/byte-buddy-agent/pom.xml byte-buddy-1.7.11/byte-buddy-agent/pom.xml
--- byte-buddy-1.7.10/byte-buddy-agent/pom.xml 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-agent/pom.xml 2018-03-02 17:30:55.000000000 +0000
@@ -5,7 +5,7 @@
byte-buddy-parentnet.bytebuddy
- 1.7.10
+ 1.7.11byte-buddy-agent
diff -Nru byte-buddy-1.7.10/byte-buddy-android/pom.xml byte-buddy-1.7.11/byte-buddy-android/pom.xml
--- byte-buddy-1.7.10/byte-buddy-android/pom.xml 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-android/pom.xml 2018-03-02 17:30:55.000000000 +0000
@@ -5,7 +5,7 @@
byte-buddy-parentnet.bytebuddy
- 1.7.10
+ 1.7.11byte-buddy-android
diff -Nru byte-buddy-1.7.10/byte-buddy-benchmark/pom.xml byte-buddy-1.7.11/byte-buddy-benchmark/pom.xml
--- byte-buddy-1.7.10/byte-buddy-benchmark/pom.xml 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-benchmark/pom.xml 2018-03-02 17:30:55.000000000 +0000
@@ -5,7 +5,7 @@
byte-buddy-parentnet.bytebuddy
- 1.7.10
+ 1.7.11byte-buddy-benchmark
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/pom.xml byte-buddy-1.7.11/byte-buddy-dep/pom.xml
--- byte-buddy-1.7.10/byte-buddy-dep/pom.xml 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/pom.xml 2018-03-02 17:30:55.000000000 +0000
@@ -5,7 +5,7 @@
net.bytebuddybyte-buddy-parent
- 1.7.10
+ 1.7.11byte-buddy-dep
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/AgentBuilder.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/AgentBuilder.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/AgentBuilder.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/AgentBuilder.java 2018-03-02 17:30:55.000000000 +0000
@@ -1311,7 +1311,7 @@
}
/**
- * An adapter for a listener wher all methods are implemented as non-operational.
+ * An adapter for a listener where all methods are implemented as non-operational.
*/
abstract class Adapter implements Listener {
@@ -1379,7 +1379,7 @@
/**
* Creates a new stream writing listener that writes to {@link System#err}.
*
- * @return A listener writing events to the standad error stream.
+ * @return A listener writing events to the standard error stream.
*/
public static Listener toSystemError() {
return new StreamWriting(System.err);
@@ -2982,7 +2982,7 @@
public static class Eager extends SelfInjection {
/**
- * Creates a new eager self-injection strategy that uses a default nexus accesor.
+ * Creates a new eager self-injection strategy that uses a default nexus accessor.
*/
public Eager() {
this(new NexusAccessor());
@@ -4267,7 +4267,7 @@
int FIRST_BATCH = 0;
/**
- * Splits a list of types to be retransformed into seperate batches.
+ * Splits a list of types to be retransformed into separate batches.
*
* @param types A list of types which should be retransformed.
* @return An iterable of retransformations within a batch.
@@ -4789,7 +4789,7 @@
},
/**
- * A listener that fails the retransformation after all batches were executed if any error occured.
+ * A listener that fails the retransformation after all batches were executed if any error occurred.
*/
FAIL_LAST {
@Override
@@ -5071,7 +5071,7 @@
}
/**
- * A compound iterator that combines several iteratables.
+ * A compound iterator that combines several iterables.
*/
protected static class CompoundIterator implements Iterator>> {
@@ -5086,7 +5086,7 @@
private final List>>> backlog;
/**
- * Creates a compount iterator.
+ * Creates a compound iterator.
*
* @param iterables The iterables to consider.
*/
@@ -5356,14 +5356,14 @@
class ForFuture implements Cancelable {
/**
- * The future to cancel upon cancelation of this instance.
+ * The future to cancel upon cancellation of this instance.
*/
private final Future> future;
/**
* Creates a cancelable for a future.
*
- * @param future The future to cancel upon cancelation of this instance.
+ * @param future The future to cancel upon cancellation of this instance.
*/
public ForFuture(Future> future) {
this.future = future;
@@ -5784,7 +5784,7 @@
}
}
} catch (Throwable ignored) {
- /* do nothing */
+ /* do nothing */
} finally {
iterator.remove();
}
@@ -6276,7 +6276,7 @@
protected void apply(ByteBuddy byteBuddy,
Instrumentation instrumentation,
ClassFileTransformer classFileTransformer) {
- /* do nothing */
+ /* do nothing */
}
@Override
@@ -6491,7 +6491,7 @@
? classFile
: transformedClassFile;
} catch (Throwable ignored) {
- /* do nothing */
+ /* do nothing */
}
}
return classFile;
@@ -7687,7 +7687,53 @@
* @return An appropriate agent builder.
*/
public static AgentBuilder of(EntryPoint entryPoint, List extends Plugin> plugins) {
- AgentBuilder agentBuilder = new AgentBuilder.Default(entryPoint.getByteBuddy()).with(new TypeStrategy.ForBuildEntryPoint(entryPoint));
+ return of(entryPoint, ClassFileVersion.ofThisVm(), plugins);
+ }
+
+ /**
+ * Creates an {@link AgentBuilder} that realizes the provided build plugins. As {@link EntryPoint}, {@link EntryPoint.Default#REBASE} is implied.
+ *
+ * @param classFileVersion The class file version to use.
+ * @param plugin The build plugins to apply as a Java agent.
+ * @return An appropriate agent builder.
+ */
+ public static AgentBuilder of(ClassFileVersion classFileVersion, Plugin... plugin) {
+ return of(classFileVersion, Arrays.asList(plugin));
+ }
+
+ /**
+ * Creates an {@link AgentBuilder} that realizes the provided build plugins. As {@link EntryPoint}, {@link EntryPoint.Default#REBASE} is implied.
+ *
+ * @param classFileVersion The class file version to use.
+ * @param plugins The build plugins to apply as a Java agent.
+ * @return An appropriate agent builder.
+ */
+ public static AgentBuilder of(ClassFileVersion classFileVersion, List extends Plugin> plugins) {
+ return of(EntryPoint.Default.REBASE, classFileVersion, plugins);
+ }
+
+ /**
+ * Creates an {@link AgentBuilder} that realizes the provided build plugins.
+ *
+ * @param entryPoint The build entry point to use.
+ * @param classFileVersion The class file version to use.
+ * @param plugin The build plugins to apply as a Java agent.
+ * @return An appropriate agent builder.
+ */
+ public static AgentBuilder of(EntryPoint entryPoint, ClassFileVersion classFileVersion, Plugin... plugin) {
+ return of(entryPoint, classFileVersion, Arrays.asList(plugin));
+ }
+
+ /**
+ * Creates an {@link AgentBuilder} that realizes the provided build plugins.
+ *
+ * @param entryPoint The build entry point to use.
+ * @param classFileVersion The class file version to use.
+ * @param plugins The build plugins to apply as a Java agent.
+ * @return An appropriate agent builder.
+ */
+ public static AgentBuilder of(EntryPoint entryPoint, ClassFileVersion classFileVersion, List extends Plugin> plugins) {
+ AgentBuilder agentBuilder = new AgentBuilder.Default(entryPoint.byteBuddy(classFileVersion)).with(new TypeStrategy.ForBuildEntryPoint(entryPoint));
for (Plugin plugin : plugins) {
agentBuilder = agentBuilder.type(plugin).transform(new Transformer.ForBuildPlugin(plugin));
}
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java 2018-03-02 17:30:55.000000000 +0000
@@ -109,7 +109,7 @@
* Note: For the purpose of inlining, Java 5 and Java 6 byte code can be seen as the best candidate for advice methods. These versions do
* no longer allow subroutines, neither do they already allow invokedynamic instructions or method handles. This way, Java 5 and Java 6 byte
* code is compatible to both older and newer versions. One exception for backwards-incompatible byte code is the possibility to load type references
- * from the constant pool onto the operand stack. These instructions can however easily be transformerd for classes compiled to Java 4 and older
+ * from the constant pool onto the operand stack. These instructions can however easily be transformed for classes compiled to Java 4 and older
* by registering a {@link TypeConstantAdjustment} before the advice visitor.
*
*
@@ -137,7 +137,7 @@
public class Advice implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper, Implementation {
/**
- * Indicates that no class reader is available to an adice method.
+ * Indicates that no class reader is available to an advice method.
*/
private static final ClassReader UNDEFINED = null;
@@ -2742,7 +2742,7 @@
/**
* An offset mapping for a parameter where assignments are fully ignored and that is assigned a boxed version of the instrumented
- * method's return valueor {@code null} if the return type is not primitive or {@code void}.
+ * method's return value or {@code null} if the return type is not primitive or {@code void}.
*/
enum ForStubValue implements OffsetMapping, Factory {
@@ -2952,7 +2952,7 @@
protected enum Factory implements OffsetMapping.Factory {
/**
- * The singelton instance.
+ * The singleton instance.
*/
INSTANCE;
@@ -3311,7 +3311,7 @@
/**
* Creates a factory for an offset mapping that binds an annotation property.
*
- * @param annotationType The annotion type to bind.
+ * @param annotationType The annotation type to bind.
* @param property The property to bind.
* @param The annotation type.
* @return A factory for binding a property of the annotation type.
@@ -3605,14 +3605,14 @@
private final MethodDescription instrumentedMethod;
/**
- * The list of types that the instrumented method requires in addition to the method parameters.
+ * A list of virtual method arguments that are available before the instrumented method is executed.
*/
- private final TypeList requiredTypes;
+ private final TypeList enterTypes;
/**
- * A list of types that are yielded by the instrumented method and available to the exit advice.
+ * A list of virtual method arguments that are available after the instrumented method has completed.
*/
- private final TypeList yieldedTypes;
+ private final TypeList exitTypes;
/**
* The maximum stack size required by a visited advice method.
@@ -3628,37 +3628,37 @@
* Creates a new default meta data handler that recomputes the space requirements of an instrumented method.
*
* @param instrumentedMethod The instrumented method.
- * @param requiredTypes The types this meta data handler expects to be available additionally to the instrumented method's parameters.
- * @param yieldedTypes The types that are expected to be added after the instrumented method returns.
+ * @param enterTypes A list of virtual method arguments that are available before the instrumented method is executed.
+ * @param exitTypes A list of virtual method arguments that are available after the instrumented method has completed.
*/
- protected Default(MethodDescription instrumentedMethod, TypeList requiredTypes, TypeList yieldedTypes) {
+ protected Default(MethodDescription instrumentedMethod, TypeList enterTypes, TypeList exitTypes) {
this.instrumentedMethod = instrumentedMethod;
- this.requiredTypes = requiredTypes;
- this.yieldedTypes = yieldedTypes;
+ this.enterTypes = enterTypes;
+ this.exitTypes = exitTypes;
}
/**
* Creates a method size handler applicable for the given instrumented method.
*
* @param instrumentedMethod The instrumented method.
- * @param requiredTypes The list of types that the instrumented method requires in addition to the method parameters.
- * @param yieldedTypes A list of types that are yielded by the instrumented method and available to the exit advice.
+ * @param enterTypes A list of virtual method arguments that are available before the instrumented method is executed.
+ * @param exitTypes A list of virtual method arguments that are available after the instrumented method has completed.
* @param writerFlags The flags supplied to the ASM class writer.
* @return An appropriate method size handler.
*/
protected static MethodSizeHandler.ForInstrumentedMethod of(MethodDescription instrumentedMethod,
- List extends TypeDescription> requiredTypes,
- List extends TypeDescription> yieldedTypes,
+ List extends TypeDescription> enterTypes,
+ List extends TypeDescription> exitTypes,
int writerFlags) {
return (writerFlags & (ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES)) != 0
? NoOp.INSTANCE
- : new Default(instrumentedMethod, new TypeList.Explicit(requiredTypes), new TypeList.Explicit(yieldedTypes));
+ : new Default(instrumentedMethod, new TypeList.Explicit(enterTypes), new TypeList.Explicit(exitTypes));
}
@Override
public MethodSizeHandler.ForAdvice bindEntry(MethodDescription.InDefinedShape adviceMethod) {
stackSize = Math.max(stackSize, adviceMethod.getReturnType().getStackSize().getSize());
- return new ForAdvice(adviceMethod, new TypeList.Empty(), new TypeList.Explicit(requiredTypes));
+ return new ForAdvice(adviceMethod, new TypeList.Empty(), new TypeList.Explicit(enterTypes));
}
@Override
@@ -3666,7 +3666,7 @@
stackSize = Math.max(stackSize, adviceMethod.getReturnType().getStackSize().maximum(skipThrowable
? StackSize.ZERO
: StackSize.SINGLE).getSize());
- return new ForAdvice(adviceMethod, new TypeList.Explicit(CompoundList.of(requiredTypes, yieldedTypes)), new TypeList.Empty());
+ return new ForAdvice(adviceMethod, new TypeList.Explicit(CompoundList.of(enterTypes, exitTypes)), new TypeList.Empty());
}
@Override
@@ -3677,8 +3677,8 @@
@Override
public int compoundLocalVariableLength(int localVariableLength) {
return Math.max(this.localVariableLength, localVariableLength
- + requiredTypes.getStackSize()
- + yieldedTypes.getStackSize());
+ + enterTypes.getStackSize()
+ + exitTypes.getStackSize());
}
@Override
@@ -3697,14 +3697,14 @@
private final MethodDescription.InDefinedShape adviceMethod;
/**
- * A list of types required by this advice method.
+ * A list of virtual method arguments that are available before the instrumented method is executed.
*/
- private final TypeList requiredTypes;
+ private final TypeList enterTypes;
/**
- * A list of types yielded by this advice method.
+ * A list of virtual method arguments that are available after the instrumented method has completed.
*/
- private final TypeList yieldedTypes;
+ private final TypeList exitTypes;
/**
* The padding that this advice method requires additionally to its computed size.
@@ -3714,14 +3714,14 @@
/**
* Creates a new method size handler for an advice method.
*
- * @param adviceMethod The advice method.
- * @param requiredTypes A list of types required by this advice method.
- * @param yieldedTypes A list of types yielded by this advice method.
+ * @param adviceMethod The advice method.
+ * @param enterTypes A list of virtual method arguments that are available before the instrumented method is executed.
+ * @param exitTypes A list of virtual method arguments that are available after the instrumented method has completed.
*/
- protected ForAdvice(MethodDescription.InDefinedShape adviceMethod, TypeList requiredTypes, TypeList yieldedTypes) {
+ protected ForAdvice(MethodDescription.InDefinedShape adviceMethod, TypeList enterTypes, TypeList exitTypes) {
this.adviceMethod = adviceMethod;
- this.requiredTypes = requiredTypes;
- this.yieldedTypes = yieldedTypes;
+ this.enterTypes = enterTypes;
+ this.exitTypes = exitTypes;
stackSize = Math.max(stackSize, adviceMethod.getReturnType().getStackSize().getSize());
}
@@ -3741,8 +3741,8 @@
Default.this.localVariableLength = Math.max(Default.this.localVariableLength, localVariableLength
- adviceMethod.getStackSize()
+ instrumentedMethod.getStackSize()
- + requiredTypes.getStackSize()
- + yieldedTypes.getStackSize());
+ + enterTypes.getStackSize()
+ + exitTypes.getStackSize());
}
@Override
@@ -3901,14 +3901,14 @@
protected final MethodDescription instrumentedMethod;
/**
- * A list of intermediate types to be considered as part of the instrumented method's steady signature.
+ * A list of virtual method arguments that are available before the instrumented method is executed.
*/
- protected final TypeList requiredTypes;
+ protected final TypeList enterTypes;
/**
- * The types that are expected to be added after the instrumented method returns.
+ * A list of virtual method arguments that are available after the instrumented method has completed.
*/
- protected final TypeList yieldedTypes;
+ protected final TypeList exitTypes;
/**
* {@code true} if the meta data handler is expected to expand its frames.
@@ -3925,19 +3925,19 @@
*
* @param instrumentedType The instrumented type.
* @param instrumentedMethod The instrumented method.
- * @param requiredTypes A list of intermediate types to be considered as part of the instrumented method's steady signature.
- * @param yieldedTypes The types that are expected to be added after the instrumented method returns.
+ * @param enterTypes A list of virtual method arguments that are available before the instrumented method is executed.
+ * @param exitTypes A list of virtual method arguments that are available after the instrumented method has completed.
* @param expandFrames {@code true} if the meta data handler is expected to expand its frames.
*/
protected Default(TypeDescription instrumentedType,
MethodDescription instrumentedMethod,
- TypeList requiredTypes,
- TypeList yieldedTypes,
+ TypeList enterTypes,
+ TypeList exitTypes,
boolean expandFrames) {
this.instrumentedType = instrumentedType;
this.instrumentedMethod = instrumentedMethod;
- this.requiredTypes = requiredTypes;
- this.yieldedTypes = yieldedTypes;
+ this.enterTypes = enterTypes;
+ this.exitTypes = exitTypes;
this.expandFrames = expandFrames;
}
@@ -3946,23 +3946,23 @@
*
* @param instrumentedType The instrumented type.
* @param instrumentedMethod The instrumented method.
- * @param requiredTypes A list of intermediate types to be considered as part of the instrumented method's steady signature.
- * @param yieldedTypes The types that are expected to be added after the instrumented method returns.
+ * @param enterTypes A list of virtual method arguments that are available before the instrumented method is executed.
+ * @param exitTypes A list of virtual method arguments that are available after the instrumented method has completed.
* @param classFileVersion The instrumented type's class file version.
- * @param writerFlags The flags supplied to the ASM writier.
+ * @param writerFlags The flags supplied to the ASM writer.
* @param readerFlags The reader flags supplied to the ASM reader.
- * @return An approrpiate stack map frame handler for an instrumented method.
+ * @return An appropriate stack map frame handler for an instrumented method.
*/
protected static ForInstrumentedMethod of(TypeDescription instrumentedType,
MethodDescription instrumentedMethod,
- List extends TypeDescription> requiredTypes,
- List extends TypeDescription> yieldedTypes,
+ List extends TypeDescription> enterTypes,
+ List extends TypeDescription> exitTypes,
ClassFileVersion classFileVersion,
int writerFlags,
int readerFlags) {
return (writerFlags & ClassWriter.COMPUTE_FRAMES) != 0 || classFileVersion.isLessThan(ClassFileVersion.JAVA_V6)
? NoOp.INSTANCE
- : new Default(instrumentedType, instrumentedMethod, new TypeList.Explicit(requiredTypes), new TypeList.Explicit(yieldedTypes), (readerFlags & ClassReader.EXPAND_FRAMES) != 0);
+ : new Default(instrumentedType, instrumentedMethod, new TypeList.Explicit(enterTypes), new TypeList.Explicit(exitTypes), (readerFlags & ClassReader.EXPAND_FRAMES) != 0);
}
/**
@@ -3991,12 +3991,12 @@
@Override
public StackMapFrameHandler.ForAdvice bindEntry(MethodDescription.InDefinedShape adviceMethod) {
- return new ForAdvice(adviceMethod, new TypeList.Empty(), requiredTypes, TranslationMode.ENTRY);
+ return new ForAdvice(adviceMethod, new TypeList.Empty(), enterTypes, TranslationMode.ENTRY);
}
@Override
public StackMapFrameHandler.ForAdvice bindExit(MethodDescription.InDefinedShape adviceMethod) {
- return new ForAdvice(adviceMethod, new TypeList.Explicit(CompoundList.of(requiredTypes, yieldedTypes)), new TypeList.Empty(), TranslationMode.EXIT);
+ return new ForAdvice(adviceMethod, new TypeList.Explicit(CompoundList.of(enterTypes, exitTypes)), new TypeList.Empty(), TranslationMode.EXIT);
}
@Override
@@ -4016,7 +4016,7 @@
translateFrame(methodVisitor,
TranslationMode.COPY,
instrumentedMethod,
- requiredTypes,
+ enterTypes,
type,
localVariableLength,
localVariable,
@@ -4055,6 +4055,9 @@
break;
case Opcodes.F_CHOP:
currentFrameDivergence -= localVariableLength;
+ if (currentFrameDivergence < 0) {
+ throw new IllegalStateException(methodDescription + " dropped " + Math.abs(currentFrameDivergence) + " implicit frames");
+ }
break;
case Opcodes.F_FULL:
case Opcodes.F_NEW:
@@ -4109,7 +4112,7 @@
methodVisitor.visitFrame(Opcodes.F_SAME1, EMPTY.length, EMPTY, 1, new Object[]{toFrame(instrumentedMethod.getReturnType().asErasure())});
}
} else {
- injectFullFrame(methodVisitor, requiredTypes, instrumentedMethod.getReturnType().represents(void.class)
+ injectFullFrame(methodVisitor, enterTypes, instrumentedMethod.getReturnType().represents(void.class)
? Collections.emptyList()
: Collections.singletonList(instrumentedMethod.getReturnType().asErasure()));
}
@@ -4120,7 +4123,7 @@
if (!expandFrames && currentFrameDivergence == 0) {
methodVisitor.visitFrame(Opcodes.F_SAME1, EMPTY.length, EMPTY, 1, new Object[]{Type.getInternalName(Throwable.class)});
} else {
- injectFullFrame(methodVisitor, requiredTypes, Collections.singletonList(TypeDescription.THROWABLE));
+ injectFullFrame(methodVisitor, enterTypes, Collections.singletonList(TypeDescription.THROWABLE));
}
}
@@ -4130,15 +4133,15 @@
if (secondary) {
methodVisitor.visitFrame(Opcodes.F_SAME, EMPTY.length, EMPTY, EMPTY.length, EMPTY);
} else {
- Object[] local = new Object[yieldedTypes.size()];
+ Object[] local = new Object[exitTypes.size()];
int index = 0;
- for (TypeDescription typeDescription : yieldedTypes) {
+ for (TypeDescription typeDescription : exitTypes) {
local[index++] = toFrame(typeDescription);
}
methodVisitor.visitFrame(Opcodes.F_APPEND, local.length, local, EMPTY.length, EMPTY);
}
} else {
- injectFullFrame(methodVisitor, CompoundList.of(requiredTypes, yieldedTypes), Collections.emptyList());
+ injectFullFrame(methodVisitor, CompoundList.of(enterTypes, exitTypes), Collections.emptyList());
}
}
@@ -4294,14 +4297,14 @@
protected final MethodDescription.InDefinedShape adviceMethod;
/**
- * A list of intermediate types to be considered as part of the instrumented method's steady signature.
+ * A list of virtual method arguments that are available before the instrumented method is executed.
*/
- protected final TypeList requiredTypes;
+ protected final TypeList enterTypes;
/**
- * The types that this method yields as a result.
+ * A list of virtual method arguments that are available after the instrumented method has completed.
*/
- private final TypeList yieldedTypes;
+ private final TypeList exitTypes;
/**
* The translation mode to apply for this advice method. Should be either {@link TranslationMode#ENTRY} or {@link TranslationMode#EXIT}.
@@ -4312,18 +4315,18 @@
* Creates a new meta data handler for an advice method.
*
* @param adviceMethod The method description for which frames are translated.
- * @param requiredTypes A list of expected types to be considered as part of the instrumented method's steady signature.
- * @param yieldedTypes The types that this method yields as a result.
+ * @param enterTypes A list of virtual method arguments that are available before the instrumented method is executed.
+ * @param exitTypes A list of virtual method arguments that are available after the instrumented method has completed.
* @param translationMode The translation mode to apply for this advice method. Should be
* either {@link TranslationMode#ENTRY} or {@link TranslationMode#EXIT}.
*/
protected ForAdvice(MethodDescription.InDefinedShape adviceMethod,
- TypeList requiredTypes,
- TypeList yieldedTypes,
+ TypeList enterTypes,
+ TypeList exitTypes,
TranslationMode translationMode) {
this.adviceMethod = adviceMethod;
- this.requiredTypes = requiredTypes;
- this.yieldedTypes = yieldedTypes;
+ this.enterTypes = enterTypes;
+ this.exitTypes = exitTypes;
this.translationMode = translationMode;
}
@@ -4337,7 +4340,7 @@
Default.this.translateFrame(methodVisitor,
translationMode,
adviceMethod,
- requiredTypes,
+ enterTypes,
type,
localVariableLength,
localVariable,
@@ -4348,13 +4351,13 @@
@Override
public void injectReturnFrame(MethodVisitor methodVisitor) {
if (!expandFrames && currentFrameDivergence == 0) {
- if (yieldedTypes.isEmpty() || adviceMethod.getReturnType().represents(void.class)) {
+ if (exitTypes.isEmpty() || adviceMethod.getReturnType().represents(void.class)) {
methodVisitor.visitFrame(Opcodes.F_SAME, EMPTY.length, EMPTY, EMPTY.length, EMPTY);
} else {
methodVisitor.visitFrame(Opcodes.F_SAME1, EMPTY.length, EMPTY, 1, new Object[]{toFrame(adviceMethod.getReturnType().asErasure())});
}
} else {
- injectFullFrame(methodVisitor, requiredTypes, yieldedTypes.isEmpty() || adviceMethod.getReturnType().represents(void.class)
+ injectFullFrame(methodVisitor, enterTypes, exitTypes.isEmpty() || adviceMethod.getReturnType().represents(void.class)
? Collections.emptyList()
: Collections.singletonList(adviceMethod.getReturnType().asErasure()));
}
@@ -4365,25 +4368,25 @@
if (!expandFrames && currentFrameDivergence == 0) {
methodVisitor.visitFrame(Opcodes.F_SAME1, EMPTY.length, EMPTY, 1, new Object[]{Type.getInternalName(Throwable.class)});
} else {
- injectFullFrame(methodVisitor, requiredTypes, Collections.singletonList(TypeDescription.THROWABLE));
+ injectFullFrame(methodVisitor, enterTypes, Collections.singletonList(TypeDescription.THROWABLE));
}
}
@Override
public void injectCompletionFrame(MethodVisitor methodVisitor, boolean secondary) {
- if ((!expandFrames && currentFrameDivergence == 0 && yieldedTypes.size() < 4)) {
- if (secondary || yieldedTypes.isEmpty()) {
+ if ((!expandFrames && currentFrameDivergence == 0 && exitTypes.size() < 4)) {
+ if (secondary || exitTypes.isEmpty()) {
methodVisitor.visitFrame(Opcodes.F_SAME, EMPTY.length, EMPTY, EMPTY.length, EMPTY);
} else {
- Object[] local = new Object[yieldedTypes.size()];
+ Object[] local = new Object[exitTypes.size()];
int index = 0;
- for (TypeDescription typeDescription : yieldedTypes) {
+ for (TypeDescription typeDescription : exitTypes) {
local[index++] = toFrame(typeDescription);
}
methodVisitor.visitFrame(Opcodes.F_APPEND, local.length, local, EMPTY.length, EMPTY);
}
} else {
- injectFullFrame(methodVisitor, CompoundList.of(requiredTypes, yieldedTypes), Collections.emptyList());
+ injectFullFrame(methodVisitor, CompoundList.of(enterTypes, exitTypes), Collections.emptyList());
}
}
}
@@ -6672,7 +6675,7 @@
protected final MethodSizeHandler.ForAdvice methodSizeHandler;
/**
- * A handler for translating and injecting stack map frmes.
+ * A handler for translating and injecting stack map frames.
*/
protected final StackMapFrameHandler.ForAdvice stackMapFrameHandler;
@@ -7214,7 +7217,7 @@
* @param instrumentedMethod The instrumented method.
* @param methodEnter The method enter advice.
* @param methodExit The method exit advice.
- * @param yieldedTypes The types that are expected to be added after the instrumented method returns.
+ * @param exitTypes A list of virtual method arguments that are available after the instrumented method has completed.
* @param writerFlags The ASM writer flags that were set.
* @param readerFlags The ASM reader flags that were set.
*/
@@ -7227,21 +7230,21 @@
MethodDescription instrumentedMethod,
Dispatcher.Resolved.ForMethodEnter methodEnter,
Dispatcher.Resolved.ForMethodExit methodExit,
- List extends TypeDescription> yieldedTypes,
+ List extends TypeDescription> exitTypes,
int writerFlags,
int readerFlags) {
super(Opcodes.ASM6, delegate);
this.methodVisitor = methodVisitor;
this.instrumentedMethod = instrumentedMethod;
padding = methodEnter.getEnterType().getStackSize().getSize();
- List requiredTypes = methodEnter.getEnterType().represents(void.class)
+ List enterTypes = methodEnter.getEnterType().represents(void.class)
? Collections.emptyList()
: Collections.singletonList(methodEnter.getEnterType().asErasure());
- methodSizeHandler = MethodSizeHandler.Default.of(instrumentedMethod, requiredTypes, yieldedTypes, writerFlags);
+ methodSizeHandler = MethodSizeHandler.Default.of(instrumentedMethod, enterTypes, exitTypes, writerFlags);
stackMapFrameHandler = StackMapFrameHandler.Default.of(instrumentedType,
instrumentedMethod,
- requiredTypes,
- yieldedTypes,
+ enterTypes,
+ exitTypes,
implementationContext.getClassFileVersion(),
writerFlags,
readerFlags);
@@ -7478,7 +7481,7 @@
* @param instrumentedMethod A description of the instrumented method.
* @param methodEnter The dispatcher to be used for method entry.
* @param methodExit The dispatcher to be used for method exit.
- * @param yieldedTypes The types that are expected to be added after the instrumented method returns.
+ * @param exitTypes A list of virtual method arguments that are available after the instrumented method has completed.
* @param writerFlags The ASM writer flags that were set.
* @param readerFlags The ASM reader flags that were set.
*/
@@ -7490,7 +7493,7 @@
MethodDescription instrumentedMethod,
Dispatcher.Resolved.ForMethodEnter methodEnter,
Dispatcher.Resolved.ForMethodExit methodExit,
- List extends TypeDescription> yieldedTypes,
+ List extends TypeDescription> exitTypes,
int writerFlags,
int readerFlags) {
super(methodVisitor,
@@ -7502,7 +7505,7 @@
instrumentedMethod,
methodEnter,
methodExit,
- yieldedTypes,
+ exitTypes,
writerFlags,
readerFlags);
returnHandler = new Label();
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/asm/AsmVisitorWrapper.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/asm/AsmVisitorWrapper.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/asm/AsmVisitorWrapper.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/asm/AsmVisitorWrapper.java 2018-03-02 17:30:55.000000000 +0000
@@ -58,7 +58,7 @@
* @param implementationContext The implementation context of the current instrumentation.
* @param typePool The type pool that was provided for the class creation.
* @param fields The instrumented type's fields.
- * @param methods The instrumented type's methods non-ingored declared and virtually inherited methods.
+ * @param methods The instrumented type's methods non-ignored declared and virtually inherited methods.
* @param writerFlags The ASM {@link org.objectweb.asm.ClassWriter} flags to consider.
* @param readerFlags The ASM {@link org.objectweb.asm.ClassReader} flags to consider.
* @return A new {@code ClassVisitor} that usually delegates to the {@code ClassVisitor} delivered in the argument.
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java 2018-03-02 17:30:55.000000000 +0000
@@ -257,7 +257,7 @@
/**
* Subs any interaction with a matched byte code element. Any value read from the element will be replaced with the stubbed
- * value's default, i.e. {@code null} for reference types and the specific {@code 0} value for primitive types. Any writen
+ * value's default, i.e. {@code null} for reference types and the specific {@code 0} value for primitive types. Any written
* value will simply be discarded.
*
* @return A member substitution that stubs any interaction with a matched byte code element.
@@ -330,7 +330,7 @@
*
*
* A replacement can only be applied if the method is compatible to the original byte code element, i.e. consumes compatible
- * arguments and returns a compatible value. If the method is not {@code static}, it is treated as if {@code this} was an implcit
+ * arguments and returns a compatible value. If the method is not {@code static}, it is treated as if {@code this} was an implicit
* first argument.
*
*
@@ -348,11 +348,11 @@
*
*
* A replacement can only be applied if the method is compatible to the original byte code element, i.e. consumes compatible
- * arguments and returns a compatible value. If the method is not {@code static}, it is treated as if {@code this} was an implcit
+ * arguments and returns a compatible value. If the method is not {@code static}, it is treated as if {@code this} was an implicit
* first argument.
*
*
- * Important: It is not allowed to specifiy a constructor or the static type initializer as a replacement.
+ * Important: It is not allowed to specify a constructor or the static type initializer as a replacement.
*
*
* @param methodDescription The method to invoke instead of interacting with any of the matched byte code elements.
@@ -892,6 +892,11 @@
class MethodInvoking implements Resolver {
/**
+ * Indicates the argument index of the {@code this} reference for a virtual method call.
+ */
+ private static final int THIS_REFERENCE = 0;
+
+ /**
* The method that is used for substitution.
*/
private final MethodDescription methodDescription;
@@ -932,7 +937,7 @@
}
}
return methodDescription.isVirtual()
- ? MethodInvocation.invoke(methodDescription).virtual(target.getDeclaringType().asErasure())
+ ? MethodInvocation.invoke(methodDescription).virtual(mapped.get(THIS_REFERENCE).asErasure())
: MethodInvocation.invoke(methodDescription);
}
}
@@ -999,7 +1004,7 @@
}
/**
- * A substution that does not substitute any byte code elements.
+ * A substitution that does not substitute any byte code elements.
*/
enum NoOp implements Substitution {
@@ -1031,7 +1036,7 @@
private final ElementMatcher super FieldDescription.InDefinedShape> fieldMatcher;
/**
- * A matcher to determine method substituion.
+ * A matcher to determine method substitution.
*/
private final ElementMatcher super MethodDescription> methodMatcher;
@@ -1104,7 +1109,7 @@
}
/**
- * Creates a new subsitution that applies element matchers to determine what byte code elements to substitute.
+ * Creates a new substitution that applies element matchers to determine what byte code elements to substitute.
*
* @param fieldMatcher The field matcher to determine fields to substitute.
* @param methodMatcher The method matcher to determine methods to substitute.
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/build/EntryPoint.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/build/EntryPoint.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/build/EntryPoint.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/build/EntryPoint.java 2018-03-02 17:30:55.000000000 +0000
@@ -2,6 +2,7 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.bytebuddy.ByteBuddy;
+import net.bytebuddy.ClassFileVersion;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType;
@@ -19,9 +20,10 @@
/**
* Returns the Byte Buddy instance to use.
*
+ * @param classFileVersion The class file version in which to represent class files.
* @return The Byte Buddy instance to use.
*/
- ByteBuddy getByteBuddy();
+ ByteBuddy byteBuddy(ClassFileVersion classFileVersion);
/**
* Applies a transformation.
@@ -46,7 +48,12 @@
/**
* An entry point that rebases a type.
*/
- REBASE(new ByteBuddy()) {
+ REBASE {
+ @Override
+ public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) {
+ return new ByteBuddy(classFileVersion);
+ }
+
@Override
public DynamicType.Builder> transform(TypeDescription typeDescription,
ByteBuddy byteBuddy,
@@ -59,7 +66,12 @@
/**
* An entry point that redefines a type.
*/
- REDEFINE(new ByteBuddy()) {
+ REDEFINE {
+ @Override
+ public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) {
+ return new ByteBuddy(classFileVersion);
+ }
+
@Override
public DynamicType.Builder> transform(TypeDescription typeDescription,
ByteBuddy byteBuddy,
@@ -73,7 +85,12 @@
* An entry point that redefines a type and which does not change the dynamic type's shape, i.e. does
* not add any methods or considers intercepting inherited methods.
*/
- REDEFINE_LOCAL(new ByteBuddy().with(Implementation.Context.Disabled.Factory.INSTANCE)) {
+ REDEFINE_LOCAL {
+ @Override
+ public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) {
+ return new ByteBuddy(classFileVersion).with(Implementation.Context.Disabled.Factory.INSTANCE);
+ }
+
@Override
public DynamicType.Builder> transform(TypeDescription typeDescription,
ByteBuddy byteBuddy,
@@ -81,25 +98,6 @@
MethodNameTransformer methodNameTransformer) {
return byteBuddy.redefine(typeDescription, classFileLocator).ignoreAlso(not(isDeclaredBy(typeDescription)));
}
- };
-
- /**
- * The Byte Buddy instance to use.
- */
- private final ByteBuddy byteBuddy;
-
- /**
- * Creates a default entry point.
- *
- * @param byteBuddy The Byte Buddy instance to use.
- */
- Default(ByteBuddy byteBuddy) {
- this.byteBuddy = byteBuddy;
- }
-
- @Override
- public ByteBuddy getByteBuddy() {
- return byteBuddy;
}
}
}
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java 2018-03-02 17:30:55.000000000 +0000
@@ -70,7 +70,7 @@
*
* ByteBuddy byteBuddy = new ByteBuddy();
* byteBuddy.foo()
- * Instead, the following method chain is corrent use of the API:
+ * Instead, the following method chain is correct use of the API:
*
* ByteBuddy byteBuddy = new ByteBuddy().foo();
*
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java 2018-03-02 17:30:55.000000000 +0000
@@ -74,7 +74,7 @@
/**
* The class file version of Java 10 (preliminary).
*/
- public static final ClassFileVersion JAVA_V10 = new ClassFileVersion(Opcodes.V9);
+ public static final ClassFileVersion JAVA_V10 = new ClassFileVersion(Opcodes.V9 + 1);
/**
* A version locator for the executing JVM.
@@ -110,6 +110,39 @@
}
/**
+ * Returns the Java class file by its representation by a version string in accordance to the formats known to javac.
+ *
+ * @param javaVersionString The Java version string.
+ * @return The appropriate class file version.
+ */
+ public static ClassFileVersion ofJavaVersionString(String javaVersionString) {
+ if (javaVersionString.equals("1.1")) {
+ return JAVA_V1;
+ } else if (javaVersionString.equals("1.2")) {
+ return JAVA_V2;
+ } else if (javaVersionString.equals("1.3")) {
+ return JAVA_V3;
+ } else if (javaVersionString.equals("1.4")) {
+ return JAVA_V4;
+ } else if (javaVersionString.equals("1.5") || javaVersionString.equals("5")) {
+ return JAVA_V5;
+ } else if (javaVersionString.equals("1.6") || javaVersionString.equals("6")) {
+ return JAVA_V6;
+ } else if (javaVersionString.equals("1.7") || javaVersionString.equals("7")) {
+ return JAVA_V7;
+ } else if (javaVersionString.equals("1.8") || javaVersionString.equals("8")) {
+ return JAVA_V8;
+ } else if (javaVersionString.equals("1.9") || javaVersionString.equals("9")) {
+ return JAVA_V9;
+ } else if (javaVersionString.equals("1.10") || javaVersionString.equals("10")) {
+ return JAVA_V10;
+ } else {
+ throw new IllegalArgumentException("Unknown Java version string: " + javaVersionString);
+ }
+ }
+
+
+ /**
* Creates a class file version for a given major release of Java. Currently, all versions reaching from
* Java 1 to Java 9 are supported.
*
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java 2018-03-02 17:30:55.000000000 +0000
@@ -36,7 +36,7 @@
public interface AnnotationDescription {
/**
- * Indicates an inexistent annotation in a type-safe manner.
+ * Indicates a nonexistent annotation in a type-safe manner.
*/
AnnotationDescription.Loadable> UNDEFINED = null;
@@ -540,7 +540,7 @@
/**
* The annotation's loaded type which might be loaded by a different class loader than the value's
- * annotation type but must be structually equal to it.
+ * annotation type but must be structurally equal to it.
*/
private final Class annotationType;
@@ -559,7 +559,7 @@
*
* @param annotation The annotation to represent.
* @param annotationType The annotation's loaded type which might be loaded by a different class loader than the value's
- * annotation type but must be structually equal to it.
+ * annotation type but must be structurally equal to it.
*/
private ForLoadedAnnotation(S annotation, Class annotationType) {
this.annotation = annotation;
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/description/package-info.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/description/package-info.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/description/package-info.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/description/package-info.java 2018-03-02 17:30:55.000000000 +0000
@@ -1,6 +1,6 @@
/**
* Classes of this package allow the representation of Java classes, their member and their meta data. Using the
* reflection API, it would be required to load classes but by using these descriptions, it is possible to
- * represent byte code elements without pripor loading.
+ * represent byte code elements without prior loading.
*/
package net.bytebuddy.description;
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeDescription.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeDescription.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeDescription.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeDescription.java 2018-03-02 17:30:55.000000000 +0000
@@ -358,7 +358,7 @@
Generic UNDEFINED = null;
/**
- * Returns this type as a raw type. This ressembles calling {@code asErasure().asGenericType()}.
+ * Returns this type as a raw type. This resembles calling {@code asErasure().asGenericType()}.
*
* @return This type as a raw type.
*/
@@ -1439,7 +1439,7 @@
class ForSignatureVisitor implements Visitor {
/**
- * Index of a {@link String}'s only character to improve code readabilty.
+ * Index of a {@link String}'s only character to improve code readability.
*/
private static final int ONLY_CHARACTER = 0;
@@ -2045,7 +2045,7 @@
}
/**
- * An annotation reader is responsible for lazily evaluting type annotations if this language
+ * An annotation reader is responsible for lazily evaluating type annotations if this language
* feature is available on the current JVM.
*/
interface AnnotationReader {
@@ -4613,7 +4613,7 @@
@Override
public Generic get(int index) {
- // Onfuscators sometimes render parameterized type arguments as null values.
+ // Obfuscators sometimes render parameterized type arguments as null values.
return Sort.describe(argumentType[index], annotationReader.ofTypeArgument(index));
}
@@ -5248,7 +5248,7 @@
/**
* A lazy projection of a generic type. Such projections allow to only read generic type information in case it is required. This
- * is meaningful as the Java virtual needs to process generic type information which requires extra ressources. Also, this allows
+ * is meaningful as the Java virtual needs to process generic type information which requires extra resources. Also, this allows
* the extraction of non-generic type information even if the generic type information is invalid.
*/
abstract class LazyProjection extends AbstractBase {
@@ -5989,7 +5989,7 @@
}
/**
- * Creates a symolic type variable of the given name.
+ * Creates a symbolic type variable of the given name.
*
* @param symbol The symbolic name of the type variable.
* @return A builder for creating a type variable.
@@ -6250,7 +6250,7 @@
}
/**
- * Creates a new builder for the current type and the spplied type annotations.
+ * Creates a new builder for the current type and the applied type annotations.
*
* @param annotations Type annotations to be declared by the current type.
* @return A new builder where the current type declares the supplied type annotations.
@@ -7418,7 +7418,7 @@
private final int arity;
/**
- * Crrates a new array projection.
+ * Creates a new array projection.
*
* @param componentType The base component type of the array which is itself not an array.
* @param arity The arity of this array.
@@ -7429,7 +7429,7 @@
}
/**
- * Creates an array projection of an arrity of one.
+ * Creates an array projection of an arity of one.
*
* @param componentType The component type of the array.
* @return A projection of the component type as an array of the given value with an arity of one.
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeList.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeList.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeList.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeList.java 2018-03-02 17:30:55.000000000 +0000
@@ -397,7 +397,7 @@
* Creates a list of the type variables of the supplied generic declaration.
*
* @param genericDeclaration The generic declaration to represent.
- * @return A genric type list for the returned generic declaration.
+ * @return A generic type list for the returned generic declaration.
*/
public static Generic of(GenericDeclaration genericDeclaration) {
return new OfTypeVariables(genericDeclaration.getTypeParameters());
@@ -525,7 +525,7 @@
/**
* Creates a list of generic type descriptions that are resolved lazily, i.e. type variables are not resolved
- * when computing an erausre.
+ * when computing an erasure.
*
* @param detachedTypes The detached types this list represents.
* @param visitor The visitor to use for attaching the detached types.
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/ClassFileLocator.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/ClassFileLocator.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/ClassFileLocator.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/ClassFileLocator.java 2018-03-02 17:30:55.000000000 +0000
@@ -778,7 +778,7 @@
/**
*
* Resolves a class file locator for a Java module path that reads class files directly from the file system. All
- * elements of the module path are resolved releatively to this VM's {@code user.dir}.
+ * elements of the module path are resolved relative to this VM's {@code user.dir}.
*
*
* Note: The resulting class file locator does not include classes of the bootstrap class loader.
@@ -1156,7 +1156,7 @@
Vector> extract(ClassLoader classLoader);
/**
- * An unitialized version of a dispatcher for extracting a class loader's loaded classes.
+ * An uninitialized version of a dispatcher for extracting a class loader's loaded classes.
*/
interface Initializable {
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/DynamicType.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/DynamicType.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/DynamicType.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/DynamicType.java 2018-03-02 17:30:55.000000000 +0000
@@ -432,7 +432,7 @@
*
* @param matcher The matcher to decide what type variables to transform.
* @param transformer The transformer to apply to the matched type variables.
- * @return A new builder that is equal to this builder but with the supplied transformer applied to all type varaibles.
+ * @return A new builder that is equal to this builder but with the supplied transformer applied to all type variables.
*/
Builder transform(ElementMatcher super TypeDescription.Generic> matcher, Transformer transformer);
@@ -1727,7 +1727,7 @@
}
/**
- * An abstract base implementation for defining an implementation of a method and optionally definign a type variable.
+ * An abstract base implementation for defining an implementation of a method and optionally defining a type variable.
*
* @param A loaded type that the built type is guaranteed to be a subclass of.
*/
@@ -1795,7 +1795,7 @@
ExceptionDefinition throwing(Collection extends TypeDefinition> types);
/**
- * An abstract base implementation for defining an implementation of a method and optionally definign a type variable or thrown exception.
+ * An abstract base implementation for defining an implementation of a method and optionally defining a type variable or thrown exception.
*
* @param A loaded type that the built type is guaranteed to be a subclass of.
*/
@@ -1899,7 +1899,7 @@
interface Annotatable extends ParameterDefinition {
/**
- * Annotates the previously defined parameter with the specifed annotations.
+ * Annotates the previously defined parameter with the specified annotations.
*
* @param annotation The annotations to declare on the previously defined parameter.
* @return A new builder that is equal to this builder but with the previously defined parameter annotated with
@@ -1908,7 +1908,7 @@
Annotatable annotateParameter(Annotation... annotation);
/**
- * Annotates the previously defined parameter with the specifed annotations.
+ * Annotates the previously defined parameter with the specified annotations.
*
* @param annotations The annotations to declare on the previously defined parameter.
* @return A new builder that is equal to this builder but with the previously defined parameter annotated with
@@ -1917,7 +1917,7 @@
Annotatable annotateParameter(List extends Annotation> annotations);
/**
- * Annotates the previously defined parameter with the specifed annotations.
+ * Annotates the previously defined parameter with the specified annotations.
*
* @param annotation The annotations to declare on the previously defined parameter.
* @return A new builder that is equal to this builder but with the previously defined parameter annotated with
@@ -1926,7 +1926,7 @@
Annotatable annotateParameter(AnnotationDescription... annotation);
/**
- * Annotates the previously defined parameter with the specifed annotations.
+ * Annotates the previously defined parameter with the specified annotations.
*
* @param annotations The annotations to declare on the previously defined parameter.
* @return A new builder that is equal to this builder but with the previously defined parameter annotated with
@@ -2041,7 +2041,7 @@
interface Annotatable extends Simple {
/**
- * Annotates the previously defined parameter with the specifed annotations.
+ * Annotates the previously defined parameter with the specified annotations.
*
* @param annotation The annotations to declare on the previously defined parameter.
* @return A new builder that is equal to this builder but with the previously defined parameter annotated with
@@ -2050,7 +2050,7 @@
Annotatable annotateParameter(Annotation... annotation);
/**
- * Annotates the previously defined parameter with the specifed annotations.
+ * Annotates the previously defined parameter with the specified annotations.
*
* @param annotations The annotations to declare on the previously defined parameter.
* @return A new builder that is equal to this builder but with the previously defined parameter annotated with
@@ -2059,7 +2059,7 @@
Annotatable annotateParameter(List extends Annotation> annotations);
/**
- * Annotates the previously defined parameter with the specifed annotations.
+ * Annotates the previously defined parameter with the specified annotations.
*
* @param annotation The annotations to declare on the previously defined parameter.
* @return A new builder that is equal to this builder but with the previously defined parameter annotated with
@@ -2068,7 +2068,7 @@
Annotatable annotateParameter(AnnotationDescription... annotation);
/**
- * Annotates the previously defined parameter with the specifed annotations.
+ * Annotates the previously defined parameter with the specified annotations.
*
* @param annotations The annotations to declare on the previously defined parameter.
* @return A new builder that is equal to this builder but with the previously defined parameter annotated with
@@ -2249,7 +2249,7 @@
}
/**
- * An abstract base implementation for defining an implementation of a method and optionally definign a type variable, thrown exception or parameter type.
+ * An abstract base implementation for defining an implementation of a method and optionally defining a type variable, thrown exception or parameter type.
*
* @param A loaded type that the built type is guaranteed to be a subclass of.
*/
@@ -3838,7 +3838,7 @@
/**
* Materializes the method definition with the supplied handler.
*
- * @param handler The handler that implementes any method matched by this instances matcher.
+ * @param handler The handler that implements any method matched by this instances matcher.
* @return A method definition where any matched method is implemented by the supplied handler.
*/
private MethodDefinition.ReceiverTypeDefinition materialize(MethodRegistry.Handler handler) {
@@ -3886,7 +3886,7 @@
*
* @param handler The handler that determines how a method is implemented.
* @param methodAttributeAppenderFactory The method attribute appender factory to apply onto the method that is currently being implemented.
- * @param transformer The method transformer to apply onto the method that is currently being implemnted.
+ * @param transformer The method transformer to apply onto the method that is currently being implemented.
*/
protected AnnotationAdapter(MethodRegistry.Handler handler,
MethodAttributeAppender.Factory methodAttributeAppenderFactory,
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java 2018-03-02 17:30:55.000000000 +0000
@@ -279,7 +279,7 @@
/**
* Initializes this dispatcher.
*
- * @return The initiailized dispatcher.
+ * @return The initialized dispatcher.
*/
Dispatcher initialize();
}
@@ -290,7 +290,7 @@
enum CreationAction implements PrivilegedAction {
/**
- * The singelton instance.
+ * The singleton instance.
*/
INSTANCE;
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassLoadingStrategy.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassLoadingStrategy.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassLoadingStrategy.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassLoadingStrategy.java 2018-03-02 17:30:55.000000000 +0000
@@ -359,7 +359,7 @@
private final ClassLoader classLoader;
/**
- * Creaes a new class loading strategy that uses a lookup type.
+ * Creates a new class loading strategy that uses a lookup type.
*
* @param classInjector The class injector to use.
* @param classLoader The class loader in the supplied class injector defines classes.
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java 2018-03-02 17:30:55.000000000 +0000
@@ -110,15 +110,13 @@
* @return A suitable class reloading strategy.
*/
public static ClassReloadingStrategy of(Instrumentation instrumentation) {
- Strategy strategy;
- if (instrumentation.isRedefineClassesSupported()) {
- strategy = Strategy.REDEFINITION;
- } else if (instrumentation.isRetransformClassesSupported()) {
- strategy = Strategy.RETRANSFORMATION;
+ if (instrumentation.isRetransformClassesSupported()) {
+ return new ClassReloadingStrategy(instrumentation, Strategy.RETRANSFORMATION);
+ } else if (instrumentation.isRedefineClassesSupported()) {
+ return new ClassReloadingStrategy(instrumentation, Strategy.REDEFINITION);
} else {
- throw new IllegalArgumentException("Instrumentation does not support manipulation of loaded classes: " + instrumentation);
+ throw new IllegalArgumentException("Instrumentation does not support reloading of classes: " + instrumentation);
}
- return new ClassReloadingStrategy(instrumentation, strategy);
}
/**
@@ -132,7 +130,8 @@
*
*
* or after the start up using the Attach API. A convenience installer for the OpenJDK is provided by the
- * {@code ByteBuddyAgent} within the {@code byte-buddy-agent} module.
+ * {@code ByteBuddyAgent} within the {@code byte-buddy-agent} module. The strategy is determined by the agent's support
+ * for redefinition where are retransformation is prefered over a redefinition.
*
* @return A class reloading strategy which uses the Byte Buddy agent's {@link java.lang.instrument.Instrumentation}.
*/
@@ -145,6 +144,35 @@
} catch (RuntimeException exception) {
throw exception;
} catch (Exception exception) {
+ throw new IllegalStateException("The Byte Buddy agent is not installed or not accessible", exception);
+ }
+ }
+
+ /**
+ *
+ * Obtains a {@link net.bytebuddy.dynamic.loading.ClassReloadingStrategy} from an installed Byte Buddy agent. This
+ * agent must be installed either by adding the {@code byte-buddy-agent.jar} when starting up the JVM by
+ *
+ * or after the start up using the Attach API. A convenience installer for the OpenJDK is provided by the
+ * {@code ByteBuddyAgent} within the {@code byte-buddy-agent} module.
+ *
+ * @param strategy The strategy to use.
+ * @return A class reloading strategy which uses the Byte Buddy agent's {@link java.lang.instrument.Instrumentation}.
+ */
+ public static ClassReloadingStrategy fromInstalledAgent(Strategy strategy) {
+ try {
+ return new ClassReloadingStrategy((Instrumentation) ClassLoader.getSystemClassLoader()
+ .loadClass(INSTALLER_TYPE)
+ .getMethod(INSTRUMENTATION_GETTER)
+ .invoke(STATIC_MEMBER), strategy);
+ } catch (RuntimeException exception) {
+ throw exception;
+ } catch (Exception exception) {
throw new IllegalStateException("The Byte Buddy agent is not installed or not accessible", exception);
}
}
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/NexusAccessor.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/NexusAccessor.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/NexusAccessor.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/NexusAccessor.java 2018-03-02 17:30:55.000000000 +0000
@@ -53,7 +53,7 @@
}
/**
- * Creates a new accessor for a {@link Nexus} where any GC eligible are enqueued to the supplid reference queue. Any such enqueued
+ * Creates a new accessor for a {@link Nexus} where any GC eligible are enqueued to the supplied reference queue. Any such enqueued
* reference can be explicitly removed from the nexus via the {@link NexusAccessor#clean(Reference)} method. Nexus entries can
* become stale if a class loader is garbage collected after a class was loaded but before a class was initialized.
*
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/inline/MethodRebaseResolver.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/inline/MethodRebaseResolver.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/inline/MethodRebaseResolver.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/inline/MethodRebaseResolver.java 2018-03-02 17:30:55.000000000 +0000
@@ -27,7 +27,7 @@
* This way a method can exist in two versions within a class:
*
*
The rebased method which represents the original implementation as it is present in a class file.
- *
An overriden method which implements user code which is still able to invoke the original, rebased method.
+ *
An overridden method which implements user code which is still able to invoke the original, rebased method.
*
*/
public interface MethodRebaseResolver {
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java 2018-03-02 17:30:55.000000000 +0000
@@ -1416,7 +1416,7 @@
* @param fieldPool The field pool to use.
* @param auxiliaryTypes The explicit auxiliary types to add to the created type.
* @param fields The instrumented type's declared fields.
- * @param methods The instrumented type's declared and virtually inhertied methods.
+ * @param methods The instrumented type's declared and virtually inherited methods.
* @param instrumentedMethods The instrumented methods relevant to this type creation.
* @param loadedTypeInitializer The loaded type initializer to apply onto the created type after loading.
* @param typeInitializer The type initializer to include in the created type's type initializer.
@@ -3198,7 +3198,7 @@
}
/**
- * A frame writer is responsible for adding empty frames on jumo instructions.
+ * A frame writer is responsible for adding empty frames on jump instructions.
*/
protected interface FrameWriter {
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/Transformer.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/Transformer.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/Transformer.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/Transformer.java 2018-03-02 17:30:55.000000000 +0000
@@ -83,7 +83,7 @@
}
/**
- * Creates a field transformer that patches the transformed field by the givien modifier contributors.
+ * Creates a field transformer that patches the transformed field by the given modifier contributors.
*
* @param modifierContributor The modifier contributors to apply.
* @return A suitable field transformer.
@@ -93,7 +93,7 @@
}
/**
- * Creates a field transformer that patches the transformed field by the givien modifier contributors.
+ * Creates a field transformer that patches the transformed field by the given modifier contributors.
*
* @param modifierContributors The modifier contributors to apply.
* @return A suitable field transformer.
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/attribute/AnnotationAppender.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/attribute/AnnotationAppender.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/attribute/AnnotationAppender.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/attribute/AnnotationAppender.java 2018-03-02 17:30:55.000000000 +0000
@@ -364,7 +364,7 @@
private static final char INNER_CLASS_PATH = '.';
/**
- * Represents an index tzpe delimiter within a type path.
+ * Represents an index type delimiter within a type path.
*/
private static final char INDEXED_TYPE_DELIMITER = ';';
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/FieldProxy.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/FieldProxy.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/FieldProxy.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/FieldProxy.java 2018-03-02 17:30:55.000000000 +0000
@@ -295,9 +295,9 @@
protected interface FieldResolver {
/**
- * Returns {@code true} if the field access can be establised.
+ * Returns {@code true} if the field access can be established.
*
- * @return {@code true} if the field access can be establised.
+ * @return {@code true} if the field access can be established.
*/
boolean isResolved();
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/Super.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/Super.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/Super.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/Super.java 2018-03-02 17:30:55.000000000 +0000
@@ -47,7 +47,7 @@
* proxy by default. If this is absolutely necessary, this can however be enabled by setting {@link Super#ignoreFinalizer()}
* to {@code false}.
*
- * If a method parameter is not a super type of the instrumented type, the method with the parameter that is annoted by
+ * If a method parameter is not a super type of the instrumented type, the method with the parameter that is annotated by
* #{@code Super} is not considered a possible delegation target.
*
* @see net.bytebuddy.implementation.MethodDelegation
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/SuperMethod.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/SuperMethod.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/SuperMethod.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/SuperMethod.java 2018-03-02 17:30:55.000000000 +0000
@@ -40,7 +40,7 @@
boolean cached() default true;
/**
- * Indicates that the assigned method should attemt the invocation of an unambiguous default method if no super method is available.
+ * Indicates that the assigned method should attempt the invocation of an unambiguous default method if no super method is available.
*
* @return {@code true} if a default method should be invoked if it is not ambiguous and no super class method is available.
*/
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/TargetMethodAnnotationDrivenBinder.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/TargetMethodAnnotationDrivenBinder.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/TargetMethodAnnotationDrivenBinder.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/annotation/TargetMethodAnnotationDrivenBinder.java 2018-03-02 17:30:55.000000000 +0000
@@ -37,7 +37,7 @@
/**
* Creates a new target method annotation-driven binder.
*
- * @param delegationProcessor The delegation proessor to use.
+ * @param delegationProcessor The delegation processor to use.
*/
protected TargetMethodAnnotationDrivenBinder(DelegationProcessor delegationProcessor) {
this.delegationProcessor = delegationProcessor;
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/ArgumentTypeResolver.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/ArgumentTypeResolver.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/ArgumentTypeResolver.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/ArgumentTypeResolver.java 2018-03-02 17:30:55.000000000 +0000
@@ -18,7 +18,7 @@
* type is considered as dominant.
*
If this result is dominant for both the left and the right target method, this resolver will consider the binding as
* ambiguous.
- *
If none of the methods is dominant and if the comparison did not result in an ambigous resolution, the method that
+ *
If none of the methods is dominant and if the comparison did not result in an ambiguous resolution, the method that
* consists of the most one-to-one parameter bindings is considered dominant.
*
* Primitive types are considered dominant in the same manner as by the Java compiler.
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/MethodDelegationBinder.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/MethodDelegationBinder.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/MethodDelegationBinder.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bind/MethodDelegationBinder.java 2018-03-02 17:30:55.000000000 +0000
@@ -46,7 +46,7 @@
*
* @param implementationTarget The target of the current implementation onto which this binding is to be applied.
* @param source The method that is to be bound to the {@code target} method.
- * @param terminationHandler Ther termination handler to apply.
+ * @param terminationHandler The termination handler to apply.
* @param methodInvoker The method invoker to use.
* @param assigner The assigner to use.
* @return A binding representing this attempt to bind the {@code source} method to the {@code target} method.
@@ -639,7 +639,7 @@
}
/**
- * Bindinds a method using another resolver and prints the selected binding to a {@link PrintStream}.
+ * Binds a method using another resolver and prints the selected binding to a {@link PrintStream}.
*/
@EqualsAndHashCode
class StreamWriting implements BindingResolver {
@@ -968,7 +968,7 @@
}
/**
- * A helper class that allows to identify a best binding for a given type and source method chosing from a list of given
+ * A helper class that allows to identify a best binding for a given type and source method choosing from a list of given
* target methods by using a given {@link net.bytebuddy.implementation.bind.MethodDelegationBinder}
* and an {@link net.bytebuddy.implementation.bind.MethodDelegationBinder.AmbiguityResolver}.
*
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/assign/primitive/PrimitiveBoxingDelegate.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/assign/primitive/PrimitiveBoxingDelegate.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/assign/primitive/PrimitiveBoxingDelegate.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/assign/primitive/PrimitiveBoxingDelegate.java 2018-03-02 17:30:55.000000000 +0000
@@ -96,7 +96,7 @@
* Locates a boxing delegate for a given primitive type.
*
* @param typeDefinition A non-void primitive type.
- * @return A delegate capable of boxing the given primitve type.
+ * @return A delegate capable of boxing the given primitive type.
*/
public static PrimitiveBoxingDelegate forPrimitive(TypeDefinition typeDefinition) {
if (typeDefinition.represents(boolean.class)) {
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/FieldConstant.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/FieldConstant.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/FieldConstant.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/FieldConstant.java 2018-03-02 17:30:55.000000000 +0000
@@ -33,7 +33,7 @@
}
/**
- * Retruns a cached version of this field constant.
+ * Returns a cached version of this field constant.
*
* @return A cached version of this field constant.
*/
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/FieldAccessor.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/FieldAccessor.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/FieldAccessor.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/FieldAccessor.java 2018-03-02 17:30:55.000000000 +0000
@@ -467,7 +467,7 @@
}
/**
- * A field accessor for an implicit property where a getter or setter property is infered from the signature.
+ * A field accessor for an implicit property where a getter or setter property is inferred from the signature.
*/
protected static class ForImplicitProperty extends FieldAccessor implements OwnerTypeLocatable {
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvokeDynamic.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvokeDynamic.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvokeDynamic.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvokeDynamic.java 2018-03-02 17:30:55.000000000 +0000
@@ -2829,7 +2829,7 @@
* @param terminationHandler A handler that handles the method return.
* @param assigner The assigner to be used.
* @param typing Indicates if dynamic type castings should be attempted for incompatible assignments.
- * @param index The index of of the argument to supply to the bootstapped method.
+ * @param index The index of of the argument to supply to the bootstrapped method.
*/
protected OfArgument(MethodDescription.InDefinedShape bootstrapMethod,
List> handleArguments,
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodCall.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodCall.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodCall.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodCall.java 2018-03-02 17:30:55.000000000 +0000
@@ -1902,7 +1902,7 @@
* Invokes the specified method on the instrumented method's argument of the given index.
*
* @param index The index of the method's argument on which the specified method should be invoked.
- * @return Amethod call that invokes the provided method on the given method argument.
+ * @return A method call that invokes the provided method on the given method argument.
*/
public MethodCall onArgument(int index) {
if (index < 0) {
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java 2018-03-02 17:30:55.000000000 +0000
@@ -337,7 +337,7 @@
* a delegation target if the delegation is targeting the instrumented type.
*
* @param target The target instance for the delegation.
- * @param type The most specific type of which {@code target} should be cosnidered. Must be a super type of the target's actual type.
+ * @param type The most specific type of which {@code target} should be considered. Must be a super type of the target's actual type.
* @return A method delegation that redirects method calls to a static method of the supplied type.
*/
public static MethodDelegation to(Object target, Type type) {
@@ -352,7 +352,7 @@
* a delegation target if the delegation is targeting the instrumented type.
*
* @param target The target instance for the delegation.
- * @param type The most specific type of which {@code target} should be cosnidered. Must be a super type of the target's actual type.
+ * @param type The most specific type of which {@code target} should be considered. Must be a super type of the target's actual type.
* @param methodGraphCompiler The method graph compiler to use.
* @return A method delegation that redirects method calls to a static method of the supplied type.
*/
@@ -368,7 +368,7 @@
* a delegation target if the delegation is targeting the instrumented type.
*
* @param target The target instance for the delegation.
- * @param type The most specific type of which {@code target} should be cosnidered. Must be a super type of the target's actual type.
+ * @param type The most specific type of which {@code target} should be considered. Must be a super type of the target's actual type.
* @param fieldName The name of the field that is holding the {@code target} instance.
* @return A method delegation that redirects method calls to a static method of the supplied type.
*/
@@ -384,7 +384,7 @@
* a delegation target if the delegation is targeting the instrumented type.
*
* @param target The target instance for the delegation.
- * @param type The most specific type of which {@code target} should be cosnidered. Must be a super type of the target's actual type.
+ * @param type The most specific type of which {@code target} should be considered. Must be a super type of the target's actual type.
* @param fieldName The name of the field that is holding the {@code target} instance.
* @param methodGraphCompiler The method graph compiler to use.
* @return A method delegation that redirects method calls to a static method of the supplied type.
@@ -426,7 +426,7 @@
* considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
* case if the method's declaring type is either public or in the same package as the instrumented type and if the method
* is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
- * a delegation target if the ddelegation is targeting the instrumented type.
+ * a delegation target if the delegation is targeting the instrumented type.
*
* @param name The field's name.
* @return A delegation that redirects invocations to a method of the specified field's instance.
@@ -440,7 +440,7 @@
* considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
* case if the method's declaring type is either public or in the same package as the instrumented type and if the method
* is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
- * a delegation target if the ddelegation is targeting the instrumented type.
+ * a delegation target if the delegation is targeting the instrumented type.
*
* @param name The field's name.
* @param fieldLocatorFactory The field locator factory to use.
@@ -455,7 +455,7 @@
* considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
* case if the method's declaring type is either public or in the same package as the instrumented type and if the method
* is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
- * a delegation target if the ddelegation is targeting the instrumented type.
+ * a delegation target if the delegation is targeting the instrumented type.
*
* @param name The field's name.
* @param methodGraphCompiler The method graph compiler to use.
@@ -470,7 +470,7 @@
* considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
* case if the method's declaring type is either public or in the same package as the instrumented type and if the method
* is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
- * a delegation target if the ddelegation is targeting the instrumented type.
+ * a delegation target if the delegation is targeting the instrumented type.
*
* @param name The field's name.
* @param fieldLocatorFactory The field locator factory to use.
@@ -1282,7 +1282,7 @@
* a delegation target if the delegation is targeting the instrumented type.
*
* @param target The target instance for the delegation.
- * @param type The most specific type of which {@code target} should be cosnidered. Must be a super type of the target's actual type.
+ * @param type The most specific type of which {@code target} should be considered. Must be a super type of the target's actual type.
* @return A method delegation that redirects method calls to a static method of the supplied type.
*/
public MethodDelegation to(Object target, Type type) {
@@ -1297,7 +1297,7 @@
* a delegation target if the delegation is targeting the instrumented type.
*
* @param target The target instance for the delegation.
- * @param type The most specific type of which {@code target} should be cosnidered. Must be a super type of the target's actual type.
+ * @param type The most specific type of which {@code target} should be considered. Must be a super type of the target's actual type.
* @param methodGraphCompiler The method graph compiler to use.
* @return A method delegation that redirects method calls to a static method of the supplied type.
*/
@@ -1316,7 +1316,7 @@
* a delegation target if the delegation is targeting the instrumented type.
*
* @param target The target instance for the delegation.
- * @param type The most specific type of which {@code target} should be cosnidered. Must be a super type of the target's actual type.
+ * @param type The most specific type of which {@code target} should be considered. Must be a super type of the target's actual type.
* @param fieldName The name of the field that is holding the {@code target} instance.
* @return A method delegation that redirects method calls to a static method of the supplied type.
*/
@@ -1332,7 +1332,7 @@
* a delegation target if the delegation is targeting the instrumented type.
*
* @param target The target instance for the delegation.
- * @param type The most specific type of which {@code target} should be cosnidered. Must be a super type of the target's actual type.
+ * @param type The most specific type of which {@code target} should be considered. Must be a super type of the target's actual type.
* @param fieldName The name of the field that is holding the {@code target} instance.
* @param methodGraphCompiler The method graph compiler to use.
* @return A method delegation that redirects method calls to a static method of the supplied type.
@@ -1414,7 +1414,7 @@
* considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
* case if the method's declaring type is either public or in the same package as the instrumented type and if the method
* is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
- * a delegation target if the ddelegation is targeting the instrumented type.
+ * a delegation target if the delegation is targeting the instrumented type.
*
* @param name The field's name.
* @param methodGraphCompiler The method graph compiler to use.
@@ -1429,7 +1429,7 @@
* considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
* case if the method's declaring type is either public or in the same package as the instrumented type and if the method
* is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
- * a delegation target if the ddelegation is targeting the instrumented type.
+ * a delegation target if the delegation is targeting the instrumented type.
*
* @param name The field's name.
* @param fieldLocatorFactory The field locator factory to use.
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/package-info.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/package-info.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/package-info.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/package-info.java 2018-03-02 17:30:55.000000000 +0000
@@ -11,6 +11,6 @@
* .getLoaded();
* dynamicType.newInstance().toString; // returns "Hello World!"
* creates a subclass of the {@link java.lang.Object} class which implements the {@link java.io.Serializable}
- * interface. The {@link java.lang.Object#toString()} method is overriden to return {@code Hello World!}.
+ * interface. The {@link java.lang.Object#toString()} method is overridden to return {@code Hello World!}.
*/
package net.bytebuddy;
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/TypeCache.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/TypeCache.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/TypeCache.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/TypeCache.java 2018-03-02 17:30:55.000000000 +0000
@@ -206,7 +206,7 @@
};
/**
- * Wrapes a type as a {@link Reference}.
+ * Wraps a type as a {@link Reference}.
*
* @param type The type to wrap.
* @return The reference that represents the type.
@@ -314,7 +314,7 @@
public static class WithInlineExpunction extends TypeCache {
/**
- * Creats a new type cache with inlined expunction.
+ * Creates a new type cache with inlined expunction.
*
* @param sort The reference type to use for stored types.
*/
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/utility/CompoundList.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/utility/CompoundList.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/utility/CompoundList.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/utility/CompoundList.java 2018-03-02 17:30:55.000000000 +0000
@@ -10,7 +10,7 @@
public class CompoundList {
/**
- * A compund list cannot be created.
+ * A compound list cannot be created.
*/
private CompoundList() {
throw new UnsupportedOperationException("Cannot create a compound list");
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java 2018-03-02 17:30:55.000000000 +0000
@@ -845,7 +845,7 @@
}
/**
- * An abstract base impleementation of a dispatcher.
+ * An abstract base implementation of a dispatcher.
*/
@EqualsAndHashCode
abstract class AbstractBase implements Dispatcher, Initializable {
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/agent/builder/AgentBuilderDefaultTest.java byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/agent/builder/AgentBuilderDefaultTest.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/agent/builder/AgentBuilderDefaultTest.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/agent/builder/AgentBuilderDefaultTest.java 2018-03-02 17:30:55.000000000 +0000
@@ -1,6 +1,7 @@
package net.bytebuddy.agent.builder;
import net.bytebuddy.ByteBuddy;
+import net.bytebuddy.ClassFileVersion;
import net.bytebuddy.build.EntryPoint;
import net.bytebuddy.build.Plugin;
import net.bytebuddy.description.type.TypeDescription;
@@ -2145,7 +2146,7 @@
Plugin plugin = mock(Plugin.class);
EntryPoint entryPoint = mock(EntryPoint.class);
ByteBuddy byteBuddy = mock(ByteBuddy.class);
- when(entryPoint.getByteBuddy()).thenReturn(byteBuddy);
+ when(entryPoint.byteBuddy(ClassFileVersion.ofThisVm())).thenReturn(byteBuddy);
assertThat(AgentBuilder.Default.of(entryPoint, plugin), is((AgentBuilder) new AgentBuilder.Default(byteBuddy)
.with(new AgentBuilder.TypeStrategy.ForBuildEntryPoint(entryPoint))
.type(plugin)
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/asm/AdviceInconsistentFrameTest.java byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/asm/AdviceInconsistentFrameTest.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/asm/AdviceInconsistentFrameTest.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/asm/AdviceInconsistentFrameTest.java 2018-03-02 17:30:55.000000000 +0000
@@ -46,6 +46,23 @@
@Test(expected = IllegalStateException.class)
@JavaVersionRule.Enforce(7)
+ public void testFrameDropImplicit() throws Exception {
+ Class> type = new ByteBuddy()
+ .subclass(Object.class)
+ .defineMethod(FOO, String.class, Visibility.PUBLIC)
+ .intercept(new DropImplicitMethod())
+ .make()
+ .load(ClassLoadingStrategy.BOOTSTRAP_LOADER, ClassLoadingStrategy.Default.WRAPPER_PERSISTENT)
+ .getLoaded();
+ assertThat(type.getDeclaredMethod(FOO).invoke(type.getDeclaredConstructor().newInstance()), is((Object) BAR));
+ new ByteBuddy()
+ .redefine(type)
+ .visit(Advice.to(TrivialAdvice.class).on(named(FOO)))
+ .make();
+ }
+
+ @Test(expected = IllegalStateException.class)
+ @JavaVersionRule.Enforce(7)
public void testFrameInconsistentThisParameter() throws Exception {
Class> type = new ByteBuddy()
.subclass(Object.class)
@@ -79,7 +96,6 @@
.make();
}
-
@SuppressWarnings("all")
private static class TrivialAdvice {
@@ -107,6 +123,27 @@
methodVisitor.visitLdcInsn(BAR);
methodVisitor.visitInsn(Opcodes.ARETURN);
return new Size(1, 2);
+ }
+ }
+
+ private static class DropImplicitMethod implements Implementation, ByteCodeAppender {
+
+ @Override
+ public ByteCodeAppender appender(Target implementationTarget) {
+ return this;
+ }
+
+ @Override
+ public InstrumentedType prepare(InstrumentedType instrumentedType) {
+ return instrumentedType;
+ }
+
+ @Override
+ public Size apply(MethodVisitor methodVisitor, Context implementationContext, MethodDescription instrumentedMethod) {
+ methodVisitor.visitFrame(Opcodes.F_CHOP, 1, new Object[0], 0, null);
+ methodVisitor.visitLdcInsn(BAR);
+ methodVisitor.visitInsn(Opcodes.ARETURN);
+ return new Size(1, 2);
}
}
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/asm/MemberSubstitutionTest.java byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/asm/MemberSubstitutionTest.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/asm/MemberSubstitutionTest.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/asm/MemberSubstitutionTest.java 2018-03-02 17:30:55.000000000 +0000
@@ -9,6 +9,8 @@
import net.bytebuddy.test.utility.ClassFileExtraction;
import org.junit.Test;
+import java.util.concurrent.Callable;
+
import static net.bytebuddy.matcher.ElementMatchers.any;
import static net.bytebuddy.matcher.ElementMatchers.*;
import static org.hamcrest.CoreMatchers.is;
@@ -549,6 +551,23 @@
assertThat(type.getDeclaredMethod(RUN).invoke(instance), is((Object) 2));
}
+ @Test
+ public void testVirtualMethodSuperCallSubstitutionExternal() throws Exception {
+ Class> type = new ByteBuddy()
+ .redefine(VirtualMethodCallSubstitutionExternalSample.class)
+ .visit(MemberSubstitution.strict().method(named(FOO)).replaceWith(Callable.class.getDeclaredMethod("call")).on(named(BAR)))
+ .make()
+ .load(ClassLoadingStrategy.BOOTSTRAP_LOADER, ClassLoadingStrategy.Default.WRAPPER)
+ .getLoaded();
+ Object instance = type.getDeclaredConstructor().newInstance();
+ assertThat(type.getDeclaredMethod(BAR, Callable.class).invoke(instance, new Callable() {
+ @Override
+ public String call() {
+ return FOO;
+ }
+ }), is((Object) FOO));
+ }
+
@Test(expected = IllegalStateException.class)
public void testFieldNotAccessible() throws Exception {
new ByteBuddy()
@@ -791,6 +810,17 @@
}
}
+ public static class VirtualMethodCallSubstitutionExternalSample {
+
+ public Object bar(Callable argument) {
+ return foo(argument);
+ }
+
+ private static Object foo(Callable argument) {
+ throw new AssertionError();
+ }
+ }
+
@SuppressWarnings("unused")
public static class ValidationTarget {
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/build/EntryPointDefaultTest.java byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/build/EntryPointDefaultTest.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/build/EntryPointDefaultTest.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/build/EntryPointDefaultTest.java 2018-03-02 17:30:55.000000000 +0000
@@ -1,6 +1,7 @@
package net.bytebuddy.build;
import net.bytebuddy.ByteBuddy;
+import net.bytebuddy.ClassFileVersion;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType;
@@ -42,7 +43,7 @@
@Test
@SuppressWarnings("unchecked")
public void testRebase() throws Exception {
- assertThat(EntryPoint.Default.REBASE.getByteBuddy(), is(new ByteBuddy()));
+ assertThat(EntryPoint.Default.REBASE.byteBuddy(ClassFileVersion.ofThisVm()), is(new ByteBuddy()));
when(byteBuddy.rebase(typeDescription, classFileLocator, methodNameTransformer)).thenReturn((DynamicType.Builder) builder);
assertThat(EntryPoint.Default.REBASE.transform(typeDescription, byteBuddy, classFileLocator, methodNameTransformer), is((DynamicType.Builder) builder));
}
@@ -50,7 +51,7 @@
@Test
@SuppressWarnings("unchecked")
public void testRedefine() throws Exception {
- assertThat(EntryPoint.Default.REDEFINE.getByteBuddy(), is(new ByteBuddy()));
+ assertThat(EntryPoint.Default.REDEFINE.byteBuddy(ClassFileVersion.ofThisVm()), is(new ByteBuddy()));
when(byteBuddy.redefine(typeDescription, classFileLocator)).thenReturn((DynamicType.Builder) builder);
assertThat(EntryPoint.Default.REDEFINE.transform(typeDescription, byteBuddy, classFileLocator, methodNameTransformer), is((DynamicType.Builder) builder));
}
@@ -58,7 +59,7 @@
@Test
@SuppressWarnings("unchecked")
public void testRedefineLocal() throws Exception {
- assertThat(EntryPoint.Default.REDEFINE_LOCAL.getByteBuddy(), is(new ByteBuddy().with(Implementation.Context.Disabled.Factory.INSTANCE)));
+ assertThat(EntryPoint.Default.REDEFINE_LOCAL.byteBuddy(ClassFileVersion.ofThisVm()), is(new ByteBuddy().with(Implementation.Context.Disabled.Factory.INSTANCE)));
when(byteBuddy.redefine(typeDescription, classFileLocator)).thenReturn((DynamicType.Builder) builder);
when(builder.ignoreAlso(not(isDeclaredBy(typeDescription)))).thenReturn((DynamicType.Builder) otherBuilder);
assertThat(EntryPoint.Default.REDEFINE_LOCAL.transform(typeDescription, byteBuddy, classFileLocator, methodNameTransformer), is((DynamicType.Builder) otherBuilder));
diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionKnownVersionsTest.java byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionKnownVersionsTest.java
--- byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionKnownVersionsTest.java 2018-02-01 20:13:47.000000000 +0000
+++ byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionKnownVersionsTest.java 2018-03-02 17:30:55.000000000 +0000
@@ -8,6 +8,8 @@
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
@@ -18,6 +20,8 @@
private final int javaVersion;
+ private final Collection javaVersionStrings;
+
private final int minorMajorVersion;
private final int majorVersion;
@@ -31,6 +35,7 @@
private final boolean atLeastJava8;
public ClassFileVersionKnownVersionsTest(int javaVersion,
+ Collection javaVersionStrings,
int minorMajorVersion,
int majorVersion,
int minorVersion,
@@ -38,6 +43,7 @@
boolean atLeastJava7,
boolean atLeastJava8) {
this.javaVersion = javaVersion;
+ this.javaVersionStrings = javaVersionStrings;
this.minorMajorVersion = minorMajorVersion;
this.majorVersion = majorVersion;
this.minorVersion = minorVersion;
@@ -49,15 +55,16 @@
@Parameterized.Parameters
public static Collection