|
18 | 18 | import net.bytebuddy.description.method.MethodDescription;
|
19 | 19 | import net.bytebuddy.description.type.TypeDescription;
|
20 | 20 | import net.bytebuddy.implementation.bytecode.assign.Assigner;
|
21 |
| -import net.bytebuddy.matcher.ElementMatchers; |
22 | 21 |
|
23 | 22 | /**
|
24 | 23 | * This factory is designed to wrap around {@link Advice.PostProcessor.Factory} and ensures that
|
@@ -53,27 +52,15 @@ public ForceDynamicallyTypedAssignReturnedFactory(Advice.PostProcessor.Factory d
|
53 | 52 | }
|
54 | 53 |
|
55 | 54 | @Override
|
56 |
| - public Advice.PostProcessor make(MethodDescription.InDefinedShape adviceMethod, boolean exit) { |
57 |
| - return delegate.make(forceDynamicTyping(adviceMethod), exit); |
| 55 | + public Advice.PostProcessor make( |
| 56 | + List<? extends AnnotationDescription> methodAnnotations, |
| 57 | + TypeDescription returnType, |
| 58 | + boolean exit) { |
| 59 | + return delegate.make(forceDynamicTyping(methodAnnotations), returnType, exit); |
58 | 60 | }
|
59 | 61 |
|
60 | 62 | // Visible for testing
|
61 |
| - static MethodDescription.InDefinedShape forceDynamicTyping( |
62 |
| - MethodDescription.InDefinedShape adviceMethod) { |
63 |
| - return new MethodDescription.Latent( |
64 |
| - adviceMethod.getDeclaringType(), |
65 |
| - adviceMethod.getInternalName(), |
66 |
| - adviceMethod.getModifiers(), |
67 |
| - adviceMethod.getTypeVariables().asTokenList(ElementMatchers.none()), |
68 |
| - adviceMethod.getReturnType(), |
69 |
| - adviceMethod.getParameters().asTokenList(ElementMatchers.none()), |
70 |
| - adviceMethod.getExceptionTypes(), |
71 |
| - forceDynamicTyping(adviceMethod.getDeclaredAnnotations()), |
72 |
| - adviceMethod.getDefaultValue(), |
73 |
| - adviceMethod.getReceiverType()); |
74 |
| - } |
75 |
| - |
76 |
| - private static List<? extends AnnotationDescription> forceDynamicTyping( |
| 63 | + static List<? extends AnnotationDescription> forceDynamicTyping( |
77 | 64 | List<? extends AnnotationDescription> declaredAnnotations) {
|
78 | 65 | return declaredAnnotations.stream()
|
79 | 66 | .map(ForceDynamicallyTypedAssignReturnedFactory::forceDynamicTyping)
|
|
0 commit comments