[BEAM-1009] Upgrade byte-buddy version to 1.5.5.
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/fcd09915 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/fcd09915 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/fcd09915 Branch: refs/heads/master Commit: fcd09915fac49f66f6a65f234b34dc34f16fef18 Parents: 0609282 Author: Pei He <pe...@google.com> Authored: Mon Nov 28 12:52:14 2016 -0800 Committer: Kenneth Knowles <k...@google.com> Committed: Mon Nov 28 15:33:15 2016 -0800 ---------------------------------------------------------------------- pom.xml | 2 +- .../reflect/ByteBuddyDoFnInvokerFactory.java | 23 +++++++++++--------- .../reflect/ByteBuddyOnTimerInvokerFactory.java | 10 ++++----- 3 files changed, 19 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/fcd09915/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index e0ef47c..4e60fab 100644 --- a/pom.xml +++ b/pom.xml @@ -754,7 +754,7 @@ <dependency> <groupId>net.bytebuddy</groupId> <artifactId>byte-buddy</artifactId> - <version>1.4.3</version> + <version>1.5.5</version> </dependency> <!-- Testing --> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/fcd09915/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java index 408ea98..8750d64 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java @@ -44,11 +44,11 @@ import net.bytebuddy.implementation.FixedValue; import net.bytebuddy.implementation.Implementation; import net.bytebuddy.implementation.Implementation.Context; import net.bytebuddy.implementation.MethodDelegation; -import net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder; import net.bytebuddy.implementation.bytecode.ByteCodeAppender; import net.bytebuddy.implementation.bytecode.StackManipulation; import net.bytebuddy.implementation.bytecode.Throw; import net.bytebuddy.implementation.bytecode.assign.Assigner; +import net.bytebuddy.implementation.bytecode.assign.Assigner.Typing; import net.bytebuddy.implementation.bytecode.assign.TypeCasting; import net.bytebuddy.implementation.bytecode.constant.TextConstant; import net.bytebuddy.implementation.bytecode.member.FieldAccess; @@ -425,7 +425,7 @@ public class ByteBuddyDoFnInvokerFactory implements DoFnInvokerFactory { StackManipulation manipulation = new StackManipulation.Compound( // Push "this" (DoFnInvoker on top of the stack) - MethodVariableAccess.REFERENCE.loadOffset(0), + MethodVariableAccess.REFERENCE.loadFrom(0), // Access this.delegate (DoFn on top of the stack) FieldAccess.forField(delegateField).getter(), // Cast it to the more precise type @@ -471,8 +471,11 @@ public class ByteBuddyDoFnInvokerFactory implements DoFnInvokerFactory { * returns void) or contain the value for the instrumented method to return). */ protected StackManipulation afterDelegation(MethodDescription instrumentedMethod) { - return TargetMethodAnnotationDrivenBinder.TerminationHandler.Returning.INSTANCE.resolve( - Assigner.DEFAULT, instrumentedMethod, targetMethod); + return new StackManipulation.Compound( + Assigner.DEFAULT.assign( + targetMethod.getReturnType(), + instrumentedMethod.getReturnType(), Typing.STATIC), + MethodReturn.of(instrumentedMethod.getReturnType())); } } @@ -491,7 +494,7 @@ public class ByteBuddyDoFnInvokerFactory implements DoFnInvokerFactory { TypeList.Generic paramTypes = targetMethod.getParameters().asTypeList(); for (int i = 0; i < paramTypes.size(); i++) { TypeDescription.Generic paramT = paramTypes.get(i); - pushParameters.add(MethodVariableAccess.of(paramT).loadOffset(i + 1)); + pushParameters.add(MethodVariableAccess.of(paramT).loadFrom(i + 1)); if (!paramT.isPrimitive()) { pushParameters.add(TypeCasting.to(paramT)); } @@ -634,10 +637,10 @@ public class ByteBuddyDoFnInvokerFactory implements DoFnInvokerFactory { // To load the delegate, push `this` and then access the field StackManipulation pushDelegate = new StackManipulation.Compound( - MethodVariableAccess.REFERENCE.loadOffset(0), + MethodVariableAccess.REFERENCE.loadFrom(0), FieldAccess.forField(delegateField).getter()); - StackManipulation pushExtraContextFactory = MethodVariableAccess.REFERENCE.loadOffset(1); + StackManipulation pushExtraContextFactory = MethodVariableAccess.REFERENCE.loadFrom(1); // Push the arguments in their actual order. for (DoFnSignature.Parameter param : signature.extraParameters()) { @@ -654,7 +657,7 @@ public class ByteBuddyDoFnInvokerFactory implements DoFnInvokerFactory { return new StackManipulation.Compound( MethodInvocation.invoke(PROCESS_CONTINUATION_STOP_METHOD), MethodReturn.REFERENCE); } else { - return MethodReturn.returning(targetMethod.getReturnType().asErasure()); + return MethodReturn.of(targetMethod.getReturnType().asErasure()); } } } @@ -820,9 +823,9 @@ public class ByteBuddyDoFnInvokerFactory implements DoFnInvokerFactory { StackManipulation.Size size = new StackManipulation.Compound( // Load the this reference - MethodVariableAccess.REFERENCE.loadOffset(0), + MethodVariableAccess.REFERENCE.loadFrom(0), // Load the delegate argument - MethodVariableAccess.REFERENCE.loadOffset(1), + MethodVariableAccess.REFERENCE.loadFrom(1), // Invoke the super constructor (default constructor of Object) MethodInvocation.invoke( new TypeDescription.ForLoadedType(DoFnInvokerBase.class) http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/fcd09915/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyOnTimerInvokerFactory.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyOnTimerInvokerFactory.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyOnTimerInvokerFactory.java index 7a39ed1..786857a 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyOnTimerInvokerFactory.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyOnTimerInvokerFactory.java @@ -238,10 +238,10 @@ class ByteBuddyOnTimerInvokerFactory implements OnTimerInvokerFactory { // To load the delegate, push `this` and then access the field StackManipulation pushDelegate = new StackManipulation.Compound( - MethodVariableAccess.REFERENCE.loadOffset(0), + MethodVariableAccess.REFERENCE.loadFrom(0), FieldAccess.forField(delegateField).getter()); - StackManipulation pushExtraContextFactory = MethodVariableAccess.REFERENCE.loadOffset(1); + StackManipulation pushExtraContextFactory = MethodVariableAccess.REFERENCE.loadFrom(1); // Push the extra arguments in their actual order. for (DoFnSignature.Parameter param : signature.extraParameters()) { @@ -275,7 +275,7 @@ class ByteBuddyOnTimerInvokerFactory implements OnTimerInvokerFactory { StackManipulation.Size size = new StackManipulation.Compound( // Load the this reference - MethodVariableAccess.REFERENCE.loadOffset(0), + MethodVariableAccess.REFERENCE.loadFrom(0), // Invoke the super constructor (default constructor of Object) MethodInvocation.invoke( new TypeDescription.ForLoadedType(Object.class) @@ -285,9 +285,9 @@ class ByteBuddyOnTimerInvokerFactory implements OnTimerInvokerFactory { .and(ElementMatchers.takesArguments(0))) .getOnly()), // Load the this reference - MethodVariableAccess.REFERENCE.loadOffset(0), + MethodVariableAccess.REFERENCE.loadFrom(0), // Load the delegate argument - MethodVariableAccess.REFERENCE.loadOffset(1), + MethodVariableAccess.REFERENCE.loadFrom(1), // Assign the delegate argument to the delegate field FieldAccess.forField( implementationTarget