-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix several edge cases in constructor instrumentation
In Robolectric there was an assumption that all constructors begin with the ALOAD_0 instruction and end with RETURN. This generally true for classes compiled by javac. However, there are many situations where this doesn't hold true, such as Kotlin-compiled classes, desugard classes, or classes instrumented by tools like Jacoco or Proguard. Update the constructor instrumentation to start at the beginning of the constructor instead of ALOAD_0. Also, check for any additional instructions after RETURN and check if those should be added to the call-to-super or to the shadowable part of the constructor. Temporarily disable re-instrumenting constructors that have been instrumened using Jacoco. This is not supported at the moment, though it will be supported in a forthcoming change. It will not be necessary to regenerate preinstrumented framework jars due to this change. Fixes #7269 PiperOrigin-RevId: 477628673
- Loading branch information
Showing
2 changed files
with
73 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters