@@ -285,6 +285,8 @@ private void generateConstructorAndFields(
285
285
"<init>" , constructorDescriptor ,
286
286
null , ArrayUtil .EMPTY_STRING_ARRAY );
287
287
288
+ final Label newBodyStartLabel = new Label ();
289
+ constructorVisitor .visitLabel (newBodyStartLabel );
288
290
//initialize captured fields
289
291
List <NewJavaField > newFieldsWithSkipped = TransformationUtilsKt .getNewFieldsToGenerate (allCapturedBuilder .listCaptured ());
290
292
List <FieldInfo > fieldInfoWithSkipped = TransformationUtilsKt .transformToFieldInfo (
@@ -318,7 +320,20 @@ private void generateConstructorAndFields(
318
320
}
319
321
}
320
322
321
- inlineMethodAndUpdateGlobalResult (parentRemapper , capturedFieldInitializer , constructor , constructorInlineBuilder , true );
323
+ MethodNode intermediateMethodNode = new MethodNode (AsmUtil .NO_FLAG_PACKAGE_PRIVATE , "<init>" , constructorDescriptor , null , ArrayUtil .EMPTY_STRING_ARRAY );
324
+ inlineMethodAndUpdateGlobalResult (parentRemapper , intermediateMethodNode , constructor , constructorInlineBuilder , true );
325
+
326
+ AbstractInsnNode first = intermediateMethodNode .instructions .getFirst ();
327
+ final Label oldStartLabel = first instanceof LabelNode ? ((LabelNode ) first ).getLabel () : null ;
328
+ intermediateMethodNode .accept (new MethodBodyVisitor (capturedFieldInitializer ) {
329
+ @ Override
330
+ public void visitLocalVariable (String name , String desc , String signature , Label start , Label end , int index ) {
331
+ if (oldStartLabel == start ) {
332
+ start = newBodyStartLabel ;//patch for jack&jill
333
+ }
334
+ super .visitLocalVariable (name , desc , signature , start , end , index );
335
+ }
336
+ });
322
337
constructorVisitor .visitEnd ();
323
338
AsmUtil .genClosureFields (TransformationUtilsKt .toNameTypePair (TransformationUtilsKt .filterSkipped (newFieldsWithSkipped )), classBuilder );
324
339
}
0 commit comments