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.bytebuddy byte-buddy-parent - 1.7.10 + 1.7.11 byte-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-parent net.bytebuddy - 1.7.10 + 1.7.11 byte-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-parent net.bytebuddy - 1.7.10 + 1.7.11 byte-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-parent net.bytebuddy - 1.7.10 + 1.7.11 byte-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.bytebuddy byte-buddy-parent - 1.7.10 + 1.7.11 byte-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 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 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 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 requiredTypes, - List yieldedTypes, + List enterTypes, + List 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 requiredTypes, - List yieldedTypes, + List enterTypes, + List 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 yieldedTypes, + List 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 yieldedTypes, + List 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 fieldMatcher; /** - * A matcher to determine method substituion. + * A matcher to determine method substitution. */ private final ElementMatcher 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 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 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 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 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 + *

+ *

+ * + * java -javaagent:byte-buddy-agent.jar -jar app.jar + * + *

+ * 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: *
    *
  1. The rebased method which represents the original implementation as it is present in a class file.
  2. - *
  3. An overriden method which implements user code which is still able to invoke the original, rebased method.
  4. + *
  5. An overridden method which implements user code which is still able to invoke the original, rebased method.
  6. *
*/ 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 data() { return Arrays.asList(new Object[][]{ - {1, Opcodes.V1_1, 45, 3, false, false, false}, - {2, Opcodes.V1_2, 46, 0, false, false, false}, - {3, Opcodes.V1_3, 47, 0, false, false, false}, - {4, Opcodes.V1_4, 48, 0, false, false, false}, - {5, Opcodes.V1_5, 49, 0, true, false, false}, - {6, Opcodes.V1_6, 50, 0, true, false, false}, - {7, Opcodes.V1_7, 51, 0, true, true, false}, - {8, Opcodes.V1_8, 52, 0, true, true, true}, - {9, Opcodes.V9, 53, 0, true, true, true} + {1, Collections.singleton("1.1"), Opcodes.V1_1, 45, 3, false, false, false}, + {2, Collections.singleton("1.2"), Opcodes.V1_2, 46, 0, false, false, false}, + {3, Collections.singleton("1.3"), Opcodes.V1_3, 47, 0, false, false, false}, + {4, Collections.singleton("1.4"), Opcodes.V1_4, 48, 0, false, false, false}, + {5, Arrays.asList("1.5", "5"), Opcodes.V1_5, 49, 0, true, false, false}, + {6, Arrays.asList("1.6", "6"), Opcodes.V1_6, 50, 0, true, false, false}, + {7, Arrays.asList("1.7", "7"), Opcodes.V1_7, 51, 0, true, true, false}, + {8, Arrays.asList("1.8", "8"), Opcodes.V1_8, 52, 0, true, true, true}, + {9, Arrays.asList("1.9", "9"), Opcodes.V9, 53, 0, true, true, true}, + {10, Arrays.asList("1.10", "10"), Opcodes.V9 + 1, 54, 0, true, true, true} }); } @@ -112,6 +119,13 @@ } @Test + public void testJavaVersionString() throws Exception { + for (String javaVersionString : javaVersionStrings) { + assertThat(ClassFileVersion.ofJavaVersionString(javaVersionString).getJavaVersion(), is(javaVersion)); + } + } + + @Test public void testSimpleClassCreation() throws Exception { ClassFileVersion classFileVersion = ClassFileVersion.ofJavaVersion(javaVersion); if (ClassFileVersion.ofThisVm().compareTo(classFileVersion) >= 0) { diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionTest.java byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionTest.java --- byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionTest.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/ClassFileVersionTest.java 2018-03-02 17:30:55.000000000 +0000 @@ -15,7 +15,7 @@ @Test public void testExplicitConstructionOfUnknownVersion() throws Exception { - assertThat(ClassFileVersion.ofMinorMajor(Opcodes.V9).getMinorMajorVersion(), is(Opcodes.V9)); + assertThat(ClassFileVersion.ofMinorMajor(Opcodes.V9 + 2).getMinorMajorVersion(), is(Opcodes.V9 + 2)); } @Test(expected = IllegalArgumentException.class) diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategyTest.java byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategyTest.java --- byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategyTest.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategyTest.java 2018-03-02 17:30:55.000000000 +0000 @@ -40,14 +40,14 @@ public MethodRule javaVersionRule = new JavaVersionRule(); @Test - @AgentAttachmentRule.Enforce(redefinesClasses = true) + @AgentAttachmentRule.Enforce(retransformsClasses = true) public void testStrategyCreation() throws Exception { assertThat(ByteBuddyAgent.install(), instanceOf(Instrumentation.class)); assertThat(ClassReloadingStrategy.fromInstalledAgent(), notNullValue()); } @Test - @AgentAttachmentRule.Enforce(redefinesClasses = true) + @AgentAttachmentRule.Enforce(retransformsClasses = true) public void testFromAgentClassReloadingStrategy() throws Exception { assertThat(ByteBuddyAgent.install(), instanceOf(Instrumentation.class)); Foo foo = new Foo(); @@ -68,7 +68,7 @@ } @Test - @AgentAttachmentRule.Enforce(redefinesClasses = true) + @AgentAttachmentRule.Enforce(retransformsClasses = true) public void testFromAgentClassWithAuxiliaryReloadingStrategy() throws Exception { assertThat(ByteBuddyAgent.install(), instanceOf(Instrumentation.class)); Foo foo = new Foo(); @@ -92,7 +92,7 @@ } @Test - @AgentAttachmentRule.Enforce(redefinesClasses = true) + @AgentAttachmentRule.Enforce(retransformsClasses = true) public void testClassRedefinitionRenamingWithStackMapFrames() throws Exception { assertThat(ByteBuddyAgent.install(), instanceOf(Instrumentation.class)); ClassReloadingStrategy classReloadingStrategy = ClassReloadingStrategy.fromInstalledAgent(); @@ -115,7 +115,7 @@ assertThat(ByteBuddyAgent.install(), instanceOf(Instrumentation.class)); Foo foo = new Foo(); assertThat(foo.foo(), is(FOO)); - ClassReloadingStrategy classReloadingStrategy = new ClassReloadingStrategy(ByteBuddyAgent.getInstrumentation(), ClassReloadingStrategy.Strategy.REDEFINITION); + ClassReloadingStrategy classReloadingStrategy = ClassReloadingStrategy.fromInstalledAgent(ClassReloadingStrategy.Strategy.REDEFINITION); new ByteBuddy() .redefine(Foo.class) .method(named(FOO)) @@ -136,7 +136,7 @@ assertThat(ByteBuddyAgent.install(), instanceOf(Instrumentation.class)); Foo foo = new Foo(); assertThat(foo.foo(), is(FOO)); - ClassReloadingStrategy classReloadingStrategy = new ClassReloadingStrategy(ByteBuddyAgent.getInstrumentation(), ClassReloadingStrategy.Strategy.RETRANSFORMATION); + ClassReloadingStrategy classReloadingStrategy = ClassReloadingStrategy.fromInstalledAgent(ClassReloadingStrategy.Strategy.RETRANSFORMATION); new ByteBuddy() .redefine(Foo.class) .method(named(FOO)) @@ -233,9 +233,9 @@ @Test public void testResetEmptyNoEffectImplicitLocator() throws Exception { Instrumentation instrumentation = mock(Instrumentation.class); - when(instrumentation.isRedefineClassesSupported()).thenReturn(true); + when(instrumentation.isRetransformClassesSupported()).thenReturn(true); ClassReloadingStrategy.of(instrumentation).reset(); - verify(instrumentation, times(2)).isRedefineClassesSupported(); + verify(instrumentation, times(2)).isRetransformClassesSupported(); verifyNoMoreInteractions(instrumentation); } @@ -243,9 +243,9 @@ public void testResetEmptyNoEffect() throws Exception { Instrumentation instrumentation = mock(Instrumentation.class); ClassFileLocator classFileLocator = mock(ClassFileLocator.class); - when(instrumentation.isRedefineClassesSupported()).thenReturn(true); + when(instrumentation.isRetransformClassesSupported()).thenReturn(true); ClassReloadingStrategy.of(instrumentation).reset(classFileLocator); - verify(instrumentation, times(2)).isRedefineClassesSupported(); + verify(instrumentation, times(2)).isRetransformClassesSupported(); verifyNoMoreInteractions(instrumentation); verifyZeroInteractions(classFileLocator); } diff -Nru byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/TypeCacheTest.java byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/TypeCacheTest.java --- byte-buddy-1.7.10/byte-buddy-dep/src/test/java/net/bytebuddy/TypeCacheTest.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-dep/src/test/java/net/bytebuddy/TypeCacheTest.java 2018-03-02 17:30:55.000000000 +0000 @@ -86,7 +86,7 @@ .getLoaded(); assertThat(typeCache.insert(classLoader, key, type), is((Object) type)); assertThat(typeCache.find(classLoader, key), is((Object) type)); - type = null; // Make eligable for GC + type = null; // Make eligible for GC for (int index = 0; index < 2; index++) { System.gc(); Thread.sleep(50L); diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/gradlew byte-buddy-1.7.11/byte-buddy-gradle-plugin/gradlew --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/gradlew 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/gradlew 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/gradlew.bat byte-buddy-1.7.11/byte-buddy-gradle-plugin/gradlew.bat --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/gradlew.bat 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/gradlew.bat 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/pom.xml byte-buddy-1.7.11/byte-buddy-gradle-plugin/pom.xml --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/pom.xml 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/pom.xml 2018-03-02 17:30:55.000000000 +0000 @@ -3,7 +3,7 @@ byte-buddy-parent net.bytebuddy - 1.7.10 + 1.7.11 4.0.0 @@ -22,10 +22,11 @@ --> - 1.0.8 1.8 1.12 - gradle/wrapper/gradle-2.14.1-bin.zip + 1.0.10 + 0.2 + 4.5 @@ -56,9 +57,10 @@ true + - org.fortasoft + codes.rafael.gradlemavenplugin gradle-maven-plugin ${version.plugin.gradlerun} @@ -75,7 +77,7 @@ --info - file://${project.basedir}/${gradle.binary} + ${project.basedir}/gradle/${version.gradle}/gradle-${version.gradle}-bin.zip @@ -96,7 +98,7 @@ -Dnet.bytebuddy.test.integration=${bytebuddy.integration} -Dnet.bytebuddy.misc.extras=${bytebuddy.extras} - file://${project.basedir}/${gradle.binary} + ${project.basedir}/gradle/${version.gradle}/gradle-${version.gradle}-bin.zip @@ -126,6 +128,18 @@ + gradle-legacy + + false + 1.6 + + + 1.0.9 + 2.14.1 + + + + extras diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/AbstractUserConfiguration.java byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/AbstractUserConfiguration.java --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/AbstractUserConfiguration.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/AbstractUserConfiguration.java 2018-03-02 17:30:55.000000000 +0000 @@ -49,13 +49,13 @@ private final File file; /** - * The iterable containing the reminder files. + * The iterable containing the remainder files. */ private final Iterable files; /** * @param file The prefixed file. - * @param files The iterable containing the reminder files. + * @param files The iterable containing the remainder files. */ protected PrefixIterable(File file, Iterable files) { this.file = file; @@ -86,7 +86,7 @@ private final File file; /** - * An iterator over the reminind files. + * An iterator over the remainder files. */ private final Iterator files; @@ -99,7 +99,7 @@ * Creates a prefix iterator. * * @param file The file being prefixed. - * @param files An iterator over the reminind files. + * @param files An iterator over the remainder files. */ protected PrefixIterator(File file, Iterator files) { this.file = file; diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/PostCompilationAction.java byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/PostCompilationAction.java --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/PostCompilationAction.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/PostCompilationAction.java 2018-03-02 17:30:55.000000000 +0000 @@ -20,7 +20,7 @@ private final ByteBuddyExtension byteBuddyExtension; /** - * Createsa a new post compilation action. + * Creates a new post compilation action. * * @param project The current project. * @param byteBuddyExtension The Byte Buddy extension of this build. diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/TransformationAction.java byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/TransformationAction.java --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/TransformationAction.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/TransformationAction.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.build.gradle; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.build.Plugin; import net.bytebuddy.description.type.TypeDescription; @@ -13,6 +14,7 @@ import org.gradle.api.GradleException; import org.gradle.api.Project; import org.gradle.api.Task; +import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.tasks.compile.AbstractCompile; import java.io.File; @@ -128,9 +130,17 @@ TypePool.Default.ReaderMode.FAST, TypePool.ClassLoading.ofBootPath()); project.getLogger().info("Processing class files located in in: {}", root); + JavaPluginConvention convention = (JavaPluginConvention) project.getConvention().getPlugins().get("java"); ByteBuddy byteBuddy; try { - byteBuddy = entryPoint.getByteBuddy(); + if (convention == null) { + ClassFileVersion classFileVersion = ClassFileVersion.ofThisVm(); + project.getLogger().warn("Could not locate Java target version, build is JDK dependant: {}", classFileVersion.getMajorVersion()); + byteBuddy = entryPoint.byteBuddy(classFileVersion); + } else { + project.getLogger().debug("Java version detected: {}", convention.getTargetCompatibility().getMajorVersion()); + byteBuddy = entryPoint.byteBuddy(ClassFileVersion.ofJavaVersion(Integer.parseInt(convention.getTargetCompatibility().getMajorVersion()))); + } } catch (Throwable throwable) { throw new GradleException("Cannot create Byte Buddy instance", throwable); } diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/build/gradle/InitializationTest.java byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/build/gradle/InitializationTest.java --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/build/gradle/InitializationTest.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/build/gradle/InitializationTest.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.build.gradle; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; @@ -115,7 +116,7 @@ public static class Foo implements EntryPoint { @Override - public ByteBuddy getByteBuddy() { + public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) { throw new AssertionError(); } diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/build/gradle/TransformationActionTest.java byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/build/gradle/TransformationActionTest.java --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/build/gradle/TransformationActionTest.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/build/gradle/TransformationActionTest.java 2018-03-02 17:30:55.000000000 +0000 @@ -12,6 +12,7 @@ import org.gradle.api.Task; import org.gradle.api.file.FileCollection; import org.gradle.api.logging.Logger; +import org.gradle.api.plugins.Convention; import org.gradle.api.tasks.compile.AbstractCompile; import org.junit.After; import org.junit.Before; @@ -31,8 +32,8 @@ import static junit.framework.TestCase.fail; import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -48,6 +49,9 @@ private Project project; @Mock + private Convention convention; + + @Mock private Logger logger; @Mock @@ -78,6 +82,8 @@ target = File.createTempFile(FOO, TEMP); assertThat(target.delete(), is(true)); assertThat(target.mkdir(), is(true)); + when(project.getConvention()).thenReturn(convention); + when(convention.getPlugins()).thenReturn(Collections.emptyMap()); when(project.getLogger()).thenReturn(logger); when(byteBuddyExtension.getTransformations()).thenReturn(Collections.singletonList(transformation)); when(byteBuddyExtension.getInitialization()).thenReturn(initialization); diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/IllegalEntryPoint.java byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/IllegalEntryPoint.java --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/IllegalEntryPoint.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/IllegalEntryPoint.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.test; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; @@ -10,7 +11,7 @@ public class IllegalEntryPoint implements EntryPoint { @Override - public ByteBuddy getByteBuddy() { + public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) { throw new RuntimeException(); } diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/IllegalTransformEntryPoint.java byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/IllegalTransformEntryPoint.java --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/IllegalTransformEntryPoint.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/IllegalTransformEntryPoint.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.test; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; @@ -10,8 +11,8 @@ public class IllegalTransformEntryPoint implements EntryPoint { @Override - public ByteBuddy getByteBuddy() { - return new ByteBuddy(); + public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) { + return new ByteBuddy(classFileVersion); } @Override diff -Nru byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/SimpleEntryPoint.java byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/SimpleEntryPoint.java --- byte-buddy-1.7.10/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/SimpleEntryPoint.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-gradle-plugin/src/test/java/net/bytebuddy/test/SimpleEntryPoint.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.test; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; @@ -10,8 +11,8 @@ public class SimpleEntryPoint implements EntryPoint { @Override - public ByteBuddy getByteBuddy() { - return new ByteBuddy(); + public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) { + return new ByteBuddy(classFileVersion); } @Override diff -Nru byte-buddy-1.7.10/byte-buddy-maven-plugin/pom.xml byte-buddy-1.7.11/byte-buddy-maven-plugin/pom.xml --- byte-buddy-1.7.10/byte-buddy-maven-plugin/pom.xml 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-maven-plugin/pom.xml 2018-03-02 17:30:55.000000000 +0000 @@ -3,7 +3,7 @@ byte-buddy-parent net.bytebuddy - 1.7.10 + 1.7.11 4.0.0 @@ -44,6 +44,12 @@ ${version.maven.aether} + org.apache.maven + maven-core + ${version.maven} + provided + + org.eclipse.aether aether-util ${version.maven.aether} @@ -84,4 +90,4 @@ - \ No newline at end of file + diff -Nru byte-buddy-1.7.10/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ByteBuddyMojo.java byte-buddy-1.7.11/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ByteBuddyMojo.java --- byte-buddy-1.7.10/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ByteBuddyMojo.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ByteBuddyMojo.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.build.EntryPoint; import net.bytebuddy.build.Plugin; import net.bytebuddy.description.type.TypeDescription; @@ -10,21 +11,20 @@ import net.bytebuddy.dynamic.scaffold.inline.MethodNameTransformer; import net.bytebuddy.implementation.LoadedTypeInitializer; import net.bytebuddy.pool.TypePool; +import net.bytebuddy.utility.CompoundList; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.*; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.xml.Xpp3Dom; import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.repository.RemoteRepository; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * A Maven plugin for applying Byte Buddy transformations during a build. @@ -55,6 +55,12 @@ protected String version; /** + * The Maven project. + */ + @Parameter(defaultValue = "${project}", readonly = true) + protected MavenProject project; + + /** *

    * The list of transformations. A transformation must specify the {@code plugin} property, containing the name of a class to apply. * Additionally, it is possible to optionally specify Maven coordinates for a project that contains this plugin class as {@code groupId}, @@ -239,15 +245,15 @@ * @param entryPoint The transformation's entry point. * @param classPath A list of class path elements expected by the processed classes. * @param plugins The plugins to apply. + * @return The transformation execution status. * @throws MojoExecutionException If the user configuration results in an error. * @throws MojoFailureException If the plugin application raises an error. * @throws IOException If an I/O exception occurs. - * @return transformation execution status */ private ExecutionStatus transform(File root, - EntryPoint entryPoint, - List classPath, - List plugins) throws MojoExecutionException, MojoFailureException, IOException { + EntryPoint entryPoint, + List classPath, + List plugins) throws MojoExecutionException, MojoFailureException, IOException { List classFileLocators = new ArrayList(classPath.size() + 1); classFileLocators.add(new ClassFileLocator.ForFolder(root)); for (String target : classPath) { @@ -265,11 +271,19 @@ getLog().info("Processing class files located in in: " + root); ByteBuddy byteBuddy; try { - byteBuddy = entryPoint.getByteBuddy(); + String javaVersionString = findJavaVersionString(project); + if (javaVersionString == null) { + ClassFileVersion classFileVersion = ClassFileVersion.ofThisVm(); + getLog().warn("Could not locate Java target version, build is JDK dependant: " + classFileVersion.getMajorVersion()); + byteBuddy = entryPoint.byteBuddy(classFileVersion); + } else { + getLog().debug("Java version detected: " + javaVersionString); + byteBuddy = entryPoint.byteBuddy(ClassFileVersion.ofJavaVersionString(javaVersionString)); + } } catch (Throwable throwable) { throw new MojoExecutionException("Cannot create Byte Buddy instance", throwable); } - ExecutionStatus processDirectoryStatus = processDirectory(root, + return processDirectory(root, root, byteBuddy, entryPoint, @@ -279,7 +293,6 @@ classFileLocator, typePool, plugins); - return processDirectoryStatus; } finally { classFileLocator.close(); } @@ -296,18 +309,18 @@ * @param classFileLocator The class file locator to use. * @param typePool The type pool to query for type descriptions. * @param plugins The plugins to apply. + * @return execution status of directory processing * @throws MojoExecutionException If the user configuration results in an error. * @throws MojoFailureException If the plugin application raises an error. - * @return execution status of directory processing */ private ExecutionStatus processDirectory(File root, - File folder, - ByteBuddy byteBuddy, - EntryPoint entryPoint, - MethodNameTransformer methodNameTransformer, - ClassFileLocator classFileLocator, - TypePool typePool, - List plugins) throws MojoExecutionException, MojoFailureException { + File folder, + ByteBuddy byteBuddy, + EntryPoint entryPoint, + MethodNameTransformer methodNameTransformer, + ClassFileLocator classFileLocator, + TypePool typePool, + List plugins) throws MojoExecutionException, MojoFailureException { File[] file = folder.listFiles(); Set overallStatus = new HashSet(); if (file != null) { @@ -344,18 +357,18 @@ * @param classFileLocator The class file locator to use. * @param typePool The type pool to query for type descriptions. * @param plugins The plugins to apply. + * @return execution status of class processing * @throws MojoExecutionException If the user configuration results in an error. * @throws MojoFailureException If the plugin application raises an error. - * @return execution status of class processing */ private ExecutionStatus processClassFile(File root, - String file, - ByteBuddy byteBuddy, - EntryPoint entryPoint, - MethodNameTransformer methodNameTransformer, - ClassFileLocator classFileLocator, - TypePool typePool, - List plugins) throws MojoExecutionException, MojoFailureException { + String file, + ByteBuddy byteBuddy, + EntryPoint entryPoint, + MethodNameTransformer methodNameTransformer, + ClassFileLocator classFileLocator, + TypePool typePool, + List plugins) throws MojoExecutionException, MojoFailureException { String typeName = file.replace('/', '.').substring(0, file.length() - CLASS_FILE_EXTENSION.length()); getLog().debug("Processing class file: " + typeName); TypeDescription typeDescription = typePool.describe(typeName).resolve(); @@ -407,6 +420,33 @@ } /** + * Makes a best effort of locating the configured Java target version. + * + * @param project The relevant Maven project. + * @return The Java version string of the configured build target version or {@code null} if no explicit configuration was detected. + */ + private static String findJavaVersionString(MavenProject project) { + while (project != null) { + String target = project.getProperties().getProperty("maven.compiler.target"); + if (target != null) { + return target; + } + for (org.apache.maven.model.Plugin plugin : CompoundList.of(project.getBuildPlugins(), project.getPluginManagement().getPlugins())) { + if ("maven-compiler-plugin".equals(plugin.getArtifactId())) { + if (plugin.getConfiguration() instanceof Xpp3Dom) { + Xpp3Dom node = ((Xpp3Dom) plugin.getConfiguration()).getChild("target"); + if (node != null) { + return node.getValue(); + } + } + } + } + project = project.getParent(); + } + return null; + } + + /** * A Byte Buddy plugin that transforms a project's production class files. */ @Mojo(name = "transform", diff -Nru byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/build/maven/ByteBuddyMojoTest.java byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/build/maven/ByteBuddyMojoTest.java --- byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/build/maven/ByteBuddyMojoTest.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/build/maven/ByteBuddyMojoTest.java 2018-03-02 17:30:55.000000000 +0000 @@ -21,8 +21,7 @@ import org.mockito.Mock; import org.mockito.Mockito; -import java.io.File; -import java.io.IOException; +import java.io.*; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; @@ -256,22 +255,41 @@ } private void execute(String goal, String target) throws Exception { - Mojo mojo = mojoRule.lookupMojo(goal, new File("src/test/resources/net/bytebuddy/test/" + target + ".pom.xml")); - if (goal.equals("transform")) { - mojoRule.setVariableValueToObject(mojo, "outputDirectory", project.getAbsolutePath()); - mojoRule.setVariableValueToObject(mojo, "compileClasspathElements", Collections.emptyList()); - } else if (goal.equals("transform-test")) { - mojoRule.setVariableValueToObject(mojo, "testOutputDirectory", project.getAbsolutePath()); - mojoRule.setVariableValueToObject(mojo, "testClasspathElements", Collections.emptyList()); - } else { - throw new AssertionError("Unknown goal: " + goal); - } - mojoRule.setVariableValueToObject(mojo, "repositorySystem", repositorySystem); - mojoRule.setVariableValueToObject(mojo, "groupId", FOO); - mojoRule.setVariableValueToObject(mojo, "artifactId", BAR); - mojoRule.setVariableValueToObject(mojo, "version", QUX); - mojo.setLog(new SilentLog()); - mojo.execute(); + InputStream in = ByteBuddyMojoTest.class.getResourceAsStream("/net/bytebuddy/test/" + target + ".pom.xml"); + if (in == null) { + throw new AssertionError("Cannot find resource for: " + target); + } + try { + File pom = File.createTempFile("maven", ".pom"); + OutputStream out = new FileOutputStream(pom); + try { + byte[] buffer = new byte[1024]; + int length; + while ((length = in.read(buffer)) != -1) { + out.write(buffer, 0, length); + } + } finally { + out.close(); + } + Mojo mojo = mojoRule.lookupMojo(goal, pom); + if (goal.equals("transform")) { + mojoRule.setVariableValueToObject(mojo, "outputDirectory", project.getAbsolutePath()); + mojoRule.setVariableValueToObject(mojo, "compileClasspathElements", Collections.emptyList()); + } else if (goal.equals("transform-test")) { + mojoRule.setVariableValueToObject(mojo, "testOutputDirectory", project.getAbsolutePath()); + mojoRule.setVariableValueToObject(mojo, "testClasspathElements", Collections.emptyList()); + } else { + throw new AssertionError("Unknown goal: " + goal); + } + mojoRule.setVariableValueToObject(mojo, "repositorySystem", repositorySystem); + mojoRule.setVariableValueToObject(mojo, "groupId", FOO); + mojoRule.setVariableValueToObject(mojo, "artifactId", BAR); + mojoRule.setVariableValueToObject(mojo, "version", QUX); + mojo.setLog(new SilentLog()); + mojo.execute(); + } finally { + in.close(); + } } private Collection addClass(String name) throws IOException { diff -Nru byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/build/maven/InitializationTest.java byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/build/maven/InitializationTest.java --- byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/build/maven/InitializationTest.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/build/maven/InitializationTest.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.build.maven; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; @@ -119,7 +120,7 @@ public static class Foo implements EntryPoint { @Override - public ByteBuddy getByteBuddy() { + public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) { throw new AssertionError(); } diff -Nru byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/IllegalEntryPoint.java byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/IllegalEntryPoint.java --- byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/IllegalEntryPoint.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/IllegalEntryPoint.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.test; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; @@ -10,7 +11,7 @@ public class IllegalEntryPoint implements EntryPoint { @Override - public ByteBuddy getByteBuddy() { + public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) { throw new RuntimeException(); } diff -Nru byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/IllegalTransformEntryPoint.java byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/IllegalTransformEntryPoint.java --- byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/IllegalTransformEntryPoint.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/IllegalTransformEntryPoint.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.test; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; @@ -10,8 +11,8 @@ public class IllegalTransformEntryPoint implements EntryPoint { @Override - public ByteBuddy getByteBuddy() { - return new ByteBuddy(); + public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) { + return new ByteBuddy(classFileVersion); } @Override diff -Nru byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/SimpleEntryPoint.java byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/SimpleEntryPoint.java --- byte-buddy-1.7.10/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/SimpleEntryPoint.java 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/byte-buddy-maven-plugin/src/test/java/net/bytebuddy/test/SimpleEntryPoint.java 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,7 @@ package net.bytebuddy.test; import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; import net.bytebuddy.build.EntryPoint; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; @@ -10,8 +11,8 @@ public class SimpleEntryPoint implements EntryPoint { @Override - public ByteBuddy getByteBuddy() { - return new ByteBuddy(); + public ByteBuddy byteBuddy(ClassFileVersion classFileVersion) { + return new ByteBuddy(classFileVersion); } @Override diff -Nru byte-buddy-1.7.10/.circleci/config.yml byte-buddy-1.7.11/.circleci/config.yml --- byte-buddy-1.7.10/.circleci/config.yml 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/.circleci/config.yml 2018-03-02 17:30:55.000000000 +0000 @@ -3,28 +3,24 @@ jdk6: docker: - image: openjdk:6-jdk - working_directory: ~/jdk6 steps: - checkout - run: ./mvnw verify -Pintegration -Dnet.bytebuddy.test.ci=true -pl '!byte-buddy-gradle-plugin' jdk7: docker: - image: openjdk:7-jdk - working_directory: ~/jdk7 steps: - checkout - run: ./mvnw verify -Pintegration -Pjava7 -Dnet.bytebuddy.test.ci=true -pl '!byte-buddy-gradle-plugin' jdk8: docker: - image: openjdk:8-jdk - working_directory: ~/jdk8 steps: - checkout - run: ./mvnw verify -Pintegration -Pjava8 -Dnet.bytebuddy.test.ci=true -pl '!byte-buddy-gradle-plugin' coverage: docker: - image: openjdk:8-jdk - working_directory: ~/coverage steps: - checkout - run: ./mvnw jacoco:prepare-agent test jacoco:report coveralls:report -Pintegration -Pjava8 -Dnet.bytebuddy.test.ci=true -DrepoToken=$COVERALLS_REPO_TOKEN -pl '!byte-buddy-gradle-plugin' diff -Nru byte-buddy-1.7.10/debian/changelog byte-buddy-1.7.11/debian/changelog --- byte-buddy-1.7.10/debian/changelog 2018-02-12 22:16:31.000000000 +0000 +++ byte-buddy-1.7.11/debian/changelog 2018-03-12 07:58:59.000000000 +0000 @@ -1,3 +1,11 @@ +byte-buddy (1.7.11-1) unstable; urgency=medium + + * Team upload. + * New upstream release + * Updated the files excluded from the upstream tarball + + -- Emmanuel Bourg Mon, 12 Mar 2018 08:58:59 +0100 + byte-buddy (1.7.10-1) unstable; urgency=medium * Team upload. diff -Nru byte-buddy-1.7.10/debian/copyright byte-buddy-1.7.11/debian/copyright --- byte-buddy-1.7.10/debian/copyright 2018-02-12 21:46:31.000000000 +0000 +++ byte-buddy-1.7.11/debian/copyright 2018-03-11 23:27:50.000000000 +0000 @@ -2,7 +2,9 @@ Upstream-Name: Byte Buddy Source: http://bytebuddy.net Files-Excluded: .mvn/* - byte-buddy-gradle-plugin/gradle/wrapper/* + byte-buddy-gradle-plugin/gradlew* + byte-buddy-gradle-plugin/gradle/*/gradle-wrapper.* + byte-buddy-gradle-plugin/gradle/*/gradle-*.zip byte-buddy-dep/src/test/resources/net/bytebuddy/test/precompiled/*.class Files: * diff -Nru byte-buddy-1.7.10/mvnw byte-buddy-1.7.11/mvnw --- byte-buddy-1.7.10/mvnw 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/mvnw 2018-03-02 17:30:55.000000000 +0000 @@ -209,6 +209,6 @@ # avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in $@ exec "$JAVACMD" \ $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/3.2.5/maven-wrapper.jar" \ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff -Nru byte-buddy-1.7.10/mvnw.cmd byte-buddy-1.7.11/mvnw.cmd --- byte-buddy-1.7.10/mvnw.cmd 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/mvnw.cmd 2018-03-02 17:30:55.000000000 +0000 @@ -118,7 +118,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\3.2.5\maven-wrapper.jar"" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain @REM avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %* diff -Nru byte-buddy-1.7.10/pom.xml byte-buddy-1.7.11/pom.xml --- byte-buddy-1.7.10/pom.xml 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/pom.xml 2018-03-02 17:30:55.000000000 +0000 @@ -4,7 +4,7 @@ net.bytebuddy byte-buddy-parent - 1.7.10 + 1.7.11 pom 2014 @@ -117,7 +117,7 @@ scm:git:git@github.com:raphw/byte-buddy.git scm:git:git@github.com:raphw/byte-buddy.git git@github.com:raphw/byte-buddy.git - byte-buddy-1.7.10 + byte-buddy-1.7.11 @@ -340,6 +340,17 @@ false + + 9 + true + + + + + java11 + + false + 9 true diff -Nru byte-buddy-1.7.10/release-notes.md byte-buddy-1.7.11/release-notes.md --- byte-buddy-1.7.10/release-notes.md 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/release-notes.md 2018-03-02 17:30:55.000000000 +0000 @@ -1,6 +1,17 @@ Byte Buddy release notes ------------------------ +### 2. February 2018: version 1.7.10 + +- Fixes self-attachment on Java 9+ on Windows. +- Check for non-accessability on `MethodCall`. +- Change static proxy fields to be `volatile`. +- Do not copy security-related meta-data on jar file copying. +- Guard resolution of annotations for methods with syntetic parameters. +- Forbid skipping code in constructors for `Advice`. +- Added constructor strategy for defining a default constructor that invokes a non-default constructor. +- Improve performance of accessor methods and cache fields by reducing use of `String::format`. + ### 6. November 2017: version 1.7.9 - Fixes `RAW_TYPES` mode for loaded types where properties were resolved incorrectly. diff -Nru byte-buddy-1.7.10/.travis/install-jdk-10.sh byte-buddy-1.7.11/.travis/install-jdk-10.sh --- byte-buddy-1.7.10/.travis/install-jdk-10.sh 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/.travis/install-jdk-10.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -#!/bin/bash -set -e - -JDK_FEATURE=10 -TMP=$(curl -L jdk.java.net/${JDK_FEATURE}) -TMP="${TMP#*Most recent build: jdk-${JDK_FEATURE}-ea+}" # remove everything before the number -TMP="${TMP%%<*}" # remove everything after the number -JDK_BUILD="$(echo -e "${TMP}" | tr -d '[:space:]')" # remove all whitespace -JDK_ARCHIVE=jdk-${JDK_FEATURE}-ea+${JDK_BUILD}_linux-x64_bin.tar.gz - -cd ~ -wget http://download.java.net/java/jdk${JDK_FEATURE}/archive/${JDK_BUILD}/BCL/${JDK_ARCHIVE} -tar -xzf ${JDK_ARCHIVE} -export JAVA_HOME=~/jdk-${JDK_FEATURE} -export PATH=${JAVA_HOME}/bin:$PATH -cd - -java --version diff -Nru byte-buddy-1.7.10/.travis/install-jdk.sh byte-buddy-1.7.11/.travis/install-jdk.sh --- byte-buddy-1.7.10/.travis/install-jdk.sh 1970-01-01 00:00:00.000000000 +0000 +++ byte-buddy-1.7.11/.travis/install-jdk.sh 2018-03-02 17:30:55.000000000 +0000 @@ -0,0 +1,125 @@ +#!/usr/bin/env bash + +# +# Install JDK for Linux +# +# This script determines the most recent early-access build number, +# downloads the JDK archive to the user home directory and extracts +# it there. +# +# Example usage +# +# install-jdk.sh | install most recent (early-access) JDK +# install-jdk.sh -W /usr/opt | install most recent (early-access) JDK to /usr/opt +# install-jdk.sh -F 9 | install most recent OpenJDK 9 +# install-jdk.sh -F 10 | install most recent OpenJDK 10 +# install-jdk.sh -F 10 -L BCL | install most recent OracleJDK 10 +# install-jdk.sh -F 11 | install most recent OpenJDK 10 +# install-jdk.sh -F 11 -L BCL | install most recent OracleJDK 10 +# +# Options +# +# -F f | Feature number of the JDK release [9|10|...] +# -B b | Build number of the JDK release [?|1|2...] +# -L l | License of the JDK [GPL|BCL] +# -W w | Working directory and install path [${HOME}] +# +# Exported environment variables +# +# JAVA_HOME is set to the extracted JDK directory +# PATH is prepended with ${JAVA_HOME}/bin +# +# (C) 2018 Christian Stein +# +# https://github.com/sormuras/bach/blob/master/install-jdk.sh +# +set -e + +JDK_FEATURE='11' +JDK_BUILD='?' +JDK_LICENSE='GPL' +JDK_WORKSPACE=${HOME} + +while getopts F:B:L:W: option +do + case "${option}" in + F) JDK_FEATURE=${OPTARG};; + B) JDK_BUILD=${OPTARG};; + L) JDK_LICENSE=${OPTARG};; + W) JDK_WORKSPACE=${OPTARG};; + esac +done + +# +# Other constants +# +JDK_DOWNLOAD='https://download.java.net/java' +JDK_BASENAME='openjdk' +if [ "${JDK_LICENSE}" != 'GPL' ]; then + JDK_BASENAME='jdk' +fi + +# +# 9 +# +if [ "${JDK_FEATURE}" == '9' ]; then + if [ "${JDK_BUILD}" == '?' ]; then + TMP=$(curl -L jdk.java.net/${JDK_FEATURE}) + TMP="${TMP#*

    JDK}" # remove everything before the number + TMP="${TMP%%General-Availability Release*}" # remove everything after the number + JDK_BUILD="$(echo -e "${TMP}" | tr -d '[:space:]')" # remove all whitespace + fi + + JDK_ARCHIVE=${JDK_BASENAME}-${JDK_BUILD}_linux-x64_bin.tar.gz + JDK_URL=${JDK_DOWNLOAD}/GA/jdk${JDK_FEATURE}/${JDK_BUILD}/binaries/${JDK_ARCHIVE} + JDK_HOME=jdk-${JDK_BUILD} +fi + +# +# 10 +# +if [ "${JDK_FEATURE}" == '10' ]; then + if [ "${JDK_BUILD}" == '?' ]; then + TMP=$(curl -L jdk.java.net/${JDK_FEATURE}) + TMP="${TMP#*Most recent build: jdk-${JDK_FEATURE}+}" # remove everything before the number + TMP="${TMP%%<*}" # remove everything after the number + JDK_BUILD="$(echo -e "${TMP}" | tr -d '[:space:]')" # remove all whitespace + fi + + JDK_ARCHIVE=${JDK_BASENAME}-${JDK_FEATURE}+${JDK_BUILD}_linux-x64_bin.tar.gz + JDK_URL=${JDK_DOWNLOAD}/jdk${JDK_FEATURE}/archive/${JDK_BUILD}/${JDK_LICENSE}/${JDK_ARCHIVE} + JDK_HOME=jdk-${JDK_FEATURE} +fi + +# +# 11 +# +if [ "${JDK_FEATURE}" == '11' ]; then + if [ "${JDK_BUILD}" == '?' ]; then + TMP=$(curl -L jdk.java.net/${JDK_FEATURE}) + TMP="${TMP#*Most recent build: jdk-${JDK_FEATURE}-ea+}" # remove everything before the number + TMP="${TMP%%<*}" # remove everything after the number + JDK_BUILD="$(echo -e "${TMP}" | tr -d '[:space:]')" # remove all whitespace + fi + + JDK_ARCHIVE=${JDK_BASENAME}-${JDK_FEATURE}-ea+${JDK_BUILD}_linux-x64_bin.tar.gz + JDK_URL=${JDK_DOWNLOAD}/early_access/jdk${JDK_FEATURE}/${JDK_BUILD}/${JDK_LICENSE}/${JDK_ARCHIVE} + JDK_HOME=jdk-${JDK_FEATURE} +fi + +# +# Create any missing intermediate paths, switch to workspace, download, unpack, switch back. +# +mkdir -p ${JDK_WORKSPACE} +cd ${JDK_WORKSPACE} +wget ${JDK_URL} +tar -xzf ${JDK_ARCHIVE} +cd - + +# +# Update environment and test-drive. +# +export JAVA_HOME=${JDK_WORKSPACE}/${JDK_HOME} +export PATH=${JAVA_HOME}/bin:$PATH + +java --version diff -Nru byte-buddy-1.7.10/.travis.yml byte-buddy-1.7.11/.travis.yml --- byte-buddy-1.7.10/.travis.yml 2018-02-01 20:13:47.000000000 +0000 +++ byte-buddy-1.7.11/.travis.yml 2018-03-02 17:30:55.000000000 +0000 @@ -10,9 +10,12 @@ env: JDK_RELEASE='JDK 9' TARGET='-Pjava9' install: echo "The default Travis install script is being skipped!" # Java 10 - - env: JDK_RELEASE='JDK 10 Early-Access' TARGET='-Pjava10' - install: . ./.travis/install-jdk-10.sh + - env: JDK_RELEASE='JDK 10' TARGET='-Pjava10' + install: . ./.travis/install-jdk.sh -F 10 -L BCL +# Java 11 + - env: JDK_RELEASE='JDK 11-ea' TARGET='-Pjava11' + install: . ./.travis/install-jdk.sh -F 11 -L BCL script: - - ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -pl "!byte-buddy-gradle-plugin" -Dnet.bytebuddy.test.ci=true - - ./mvnw jacoco:prepare-agent verify jacoco:report ${TARGET} -Pintegration -Dfindbugs.skip=true -Dnet.bytebuddy.test.ci=true -pl "!byte-buddy-gradle-plugin" -Dnet.bytebuddy.test.ci=true + - ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -Dnet.bytebuddy.test.ci=true + - ./mvnw jacoco:prepare-agent verify jacoco:report ${TARGET} -Pintegration -Dfindbugs.skip=true -Dnet.bytebuddy.test.ci=true