|
36 | 36 | import org.jboss.resteasy.reactive.server.core.parameters.converters.DelegatingParameterConverterSupplier;
|
37 | 37 | import org.jboss.resteasy.reactive.server.core.parameters.converters.ParameterConverter;
|
38 | 38 | import org.jboss.resteasy.reactive.server.core.parameters.converters.ParameterConverterSupplier;
|
| 39 | +import org.jboss.resteasy.reactive.server.core.parameters.converters.ParameterConverterSupport; |
39 | 40 | import org.jboss.resteasy.reactive.server.core.parameters.converters.RuntimeResolvedConverter;
|
40 | 41 | import org.jboss.resteasy.reactive.server.injection.ResteasyReactiveInjectionContext;
|
41 | 42 | import org.jboss.resteasy.reactive.server.injection.ResteasyReactiveInjectionTarget;
|
@@ -77,6 +78,9 @@ public class ClassInjectorTransformer implements BiFunction<String, ClassVisitor
|
77 | 78 | private static final String INIT_CONVERTER_FIELD_NAME = "__quarkus_converter__";
|
78 | 79 | private static final String INIT_CONVERTER_METHOD_DESCRIPTOR = "(" + QUARKUS_REST_DEPLOYMENT_DESCRIPTOR + ")V";
|
79 | 80 |
|
| 81 | + private static final String PARAMETER_CONVERTER_SUPPORT_BINARY_NAME = ParameterConverterSupport.class.getName().replace('.', |
| 82 | + '/'); |
| 83 | + |
80 | 84 | private static final String MULTIPART_SUPPORT_BINARY_NAME = MultipartSupport.class.getName().replace('.', '/');
|
81 | 85 |
|
82 | 86 | private static final String OBJECT_BINARY_NAME = Object.class.getName().replace('.', '/');
|
@@ -457,18 +461,14 @@ private void generateConverterInitMethod(FieldInfo fieldInfo, ParameterConverter
|
457 | 461 | initConverterMethod.visitJumpInsn(Opcodes.IFNONNULL, notNull);
|
458 | 462 | // stack: [converter]
|
459 | 463 | initConverterMethod.visitInsn(Opcodes.POP);
|
460 |
| - // stack: [] |
461 |
| - // let's instantiate our delegate |
462 |
| - initConverterMethod.visitTypeInsn(Opcodes.NEW, delegateBinaryName); |
463 |
| - // stack: [converter] |
464 |
| - initConverterMethod.visitInsn(Opcodes.DUP); |
465 |
| - // stack: [converter, converter] |
466 |
| - initConverterMethod.visitMethodInsn(Opcodes.INVOKESPECIAL, delegateBinaryName, "<init>", |
467 |
| - "()V", false); |
468 |
| - // stack: [converter] |
469 |
| - // If we don't cast this to ParameterConverter, ASM in computeFrames will call getCommonSuperType |
470 |
| - // and try to load our generated class before we can load it, so we insert this cast to avoid that |
471 |
| - initConverterMethod.visitTypeInsn(Opcodes.CHECKCAST, PARAMETER_CONVERTER_BINARY_NAME); |
| 464 | + |
| 465 | + // className param |
| 466 | + initConverterMethod.visitLdcInsn(delegateBinaryName.replace('/', '.')); |
| 467 | + initConverterMethod.visitMethodInsn(Opcodes.INVOKESTATIC, PARAMETER_CONVERTER_SUPPORT_BINARY_NAME, |
| 468 | + "create", |
| 469 | + "(" + STRING_DESCRIPTOR + ")" + PARAMETER_CONVERTER_DESCRIPTOR, |
| 470 | + false); |
| 471 | + |
472 | 472 | // end default delegate
|
473 | 473 | initConverterMethod.visitLabel(notNull);
|
474 | 474 | }
|
|
0 commit comments