revanced-patcher icon indicating copy to clipboard operation
revanced-patcher copied to clipboard

proposal: generating type descriptors programmatically

Open Sculas opened this issue 2 years ago • 0 comments

Current idea is that you can do:

this.addInstruction(
    index,
-    "invoke-static { v$register }, Lapp/revanced/integrations/patches/HideHomeAdsPatch;->HideHomeAds(Landroid/view/View;)V".toInstruction()
+    "invoke-static { v$register }, ${TypeDescriptor.of(HideHomeAdsPatch::HideHomeAds)}".toInstruction()
)

A side effect of this is that now the type descriptors are checked at compile time. I think this helps a lot when refactoring code, since integrations may change quite a lot.

This would require including the integrations (as compileOnly to not include them), which you would get from GitHub Packages. I have to figure out the best way to get a JAR from the integrations, will require some research.

This whole thing is just an idea, for now, I have to find out what is possible and what are the limitations of this. Please let me know if you have any objections or additions to this idea.

Sculas avatar Jun 23 '22 22:06 Sculas