Recaf icon indicating copy to clipboard operation
Recaf copied to clipboard

Metadata tagging

Open Col-E opened this issue 4 years ago • 1 comments

Metadata tagging

Recaf should allow metadata to be attached to both classes (Maybe even specific fields/methods) and files. My current thinking is:

  1. Tags - Things like networking / io / gui / entry-point etc to indicate behavior
  2. Key-value pairs - Useful if the user wants to tag things in groups, they can then look for items with the key and see the different values for all matched items

Automatic tagging

Some degree of tagging should be automated. For this, Recaf should be able to declare rules that when matched, assign metadata to the matched item. For example:

Rules can include:

  • Any reference to X
  • Any reference to a type with tag T
  • Parent in hierarchy contains X
  • Parent in hierarchy contains a type with tag T
  • N count of T tagged references
  • P percent of tagged items match T tag
  • ContainsString S with matchmode M
  • >= file size S
  • <= file size S
  • == file size S
  • likely obfuscated

Design concerns:

  • Tagging the current resources must not interfere with rules, so if java.net.Downloader is tagged T and we tag an incoming class Example as T this should not affect N count of T sorts of rules.

Default rules:

  • Recaf can supply a default set of rules for classes in the JDK

Custom rules:

  • In addition to explicitly declaring types, allow users to tag entire maven-artifacts. For example, tag okhttp as networking so any reference to a class from okhttp will can contribute to rules that rely on references to tagged items

How rules get applied:

  • When Recaf opens a workspace, run the rules on all items of the primary resource
  • When a class is added to the primary resource (or renamed) run it on the class

UI Integration

The workspace navigator should allow something like:

  • meta>networking to list all classes tagged with networking
  • meta<networking to hide all classes tagged with networking
  • meta=networking to list all classes tagged with networking, and only networking

Context menus should provide an option to edit the associated metadata of the selected item.

Persistence

These values can be associated with the relative paths to items and persistently stored in a sub-directory of the Recaf directory.

Col-E avatar Nov 06 '20 12:11 Col-E

May be able to combine some aspects of this into #717 - where comments can be tagged

Col-E avatar Sep 13 '23 02:09 Col-E