gui: add a script to process ButterKnife annotations#9
Open
zhuowei wants to merge 2 commits intomiwong:masterfrom
Open
gui: add a script to process ButterKnife annotations#9zhuowei wants to merge 2 commits intomiwong:masterfrom
zhuowei wants to merge 2 commits intomiwong:masterfrom
Conversation
ButterKnife, a popular UI library used by 4.38% of all apps tracked by AppBrain, specifies UI listeners via method annotations. In particular, the Kickstarter app (popular open-source test case) uses it for all listeners. Since Dare doesn't preserve annotations, make an external utility that uses dexlib2 to extract annotations into a .json. Currently only ButterKnife.OnClick annotations are extracted. Note that this is a temporary approach: ButterKnife doesn't use the annotations at runtime, so some apps such as Microsoft Outlook strips the view IDs during build, making the annotations useless. The proper way is to parse the ViewBinder/ViewBinding classes generated by ButterKnife, but that is more difficult. Another issue: the annotation extractor uses a dexlib2 build from Java 8, but the rest of IntelliDroid needs Java 7. Will rebuild dexlib2 later. Tested with Kickstarter as the test application and startActivity as the target method: this successfully finds additional paths.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ButterKnife, a popular UI library used by 4.38% of all apps tracked by AppBrain, specifies UI listeners via method annotations. In particular, the Kickstarter app (popular open-source test case) uses it for all listeners.
Since Dare doesn't preserve annotations, make an external utility that uses dexlib2 to extract annotations into a .json. Currently only ButterKnife.OnClick annotations are extracted.
Note that this is a temporary approach: ButterKnife doesn't use the annotations at runtime, so some apps such as Microsoft Outlook strips the view IDs during build, making the annotations useless. The proper way is to parse the ViewBinder/ViewBinding classes generated by ButterKnife, but that is more difficult.
Another issue: the annotation extractor uses a dexlib2 build from Java 8, but the rest of IntelliDroid needs Java 7. Will rebuild dexlib2 later.
Tested with Kickstarter as the test application and Context.startActivity as the target method: this successfully finds three additional paths.
This depends on #1.