Project-ARTist / meta

Meta repository for matters related to more than one repository or even the whole project as such.
2 stars 0 forks source link

Module: method "filter engine" #9

Closed schrnz closed 6 years ago

schrnz commented 6 years ago

While our current showcase modules simply run on all methods of an application, some modules aim at a particular set of methods, e.g., from a single class (package name prefix), with particular parameter or return types, or other method properties.

Currently, modules could achieve this by checking for those properties themselves in the beginning and immediately return/terminate the execution for this method if it does not match the filter. There are 2 problems with this approach:

  1. Most of the time, the "filter functionality" can be implemented by means of a simple whitelist or blacklist. Repeating this over and over for different modules leads to code duplication and increased risk of introducing bugs.
  2. it is very inefficient to construct all the objects just to abort immediately. A superior solution checks for those conditions before the module classes are initialized. Remember that this is done for each single method visible to the compiler.

It would be nice to have built-in functionality so that declaring those filters is straightforward. Ready-made implementations for whitelist and blacklist will cover a lot of cases and modules with special requirements can implement their own filters by, e.g., extending them.

Affected Projects