Recaf
Recaf copied to clipboard
Improvements to missing class generation
Problem: JPhantom works for basic cases, consistently fails on large inputs & obfuscated code
Alternatives: Reconstruct - though not yet feature complete
Requirements for viable alternatives:
- Generate missing
@annotationwhen a@annotation(foo="bar")and such are seen annotating classes/fields/methods - Generate missing classes when
getfieldreferences are seen- Interfaces can only have constants, so if you see a
getfieldorputfieldyou know it must be aclass/enum/record
- Interfaces can only have constants, so if you see a
- Ensure type hierarchies must be regenerated to the best of their ability
- The accuracy is limited to what is available in the known code being analyzed
- Should prefer creating
classoverinterfacetypes when possible- If some type does not have enough known about it to be sure one way or another, default to
classinstead ofinterface - Must consider use in type hierarchies, due to single inheritance of classes you will need interfaces at times
- If some type does not have enough known about it to be sure one way or another, default to
Bonus points:
- Allow a lazy model which can be updated over time
- Rather than run analysis on the entire input at launch, only analyze one class at a time (such as what is open in the Recaf UI) and then update the generated model over time.
- Saves a lot of CPU on startup, reduces over-all workload assuming a user will not be opening every single class in an input workspace
- Allow manual tweaking of the model
- It may be useful to allow users to provide the ability to "correct" the model. If there is some missing data that prevents the generation of some fields/methods in a phantom class, the user could tell the model these items exist, allowing the recompile feature to utilize their changes
- The model changes sent by users must be validated such that they cannot "break" the model into making invalid classes.