tortilla icon indicating copy to clipboard operation
tortilla copied to clipboard

Improved filtering of wrapped methods

Open emlyn opened this issue 4 years ago • 0 comments

Add a simple DSL for matching (groups of) members, something like:

foo - any member named "foo" [foo 2] - any member named "foo" taking 2 args [foo String Long] - a member named "foo" taking a String and a Long [_ 1] - any member taking a single argument The name should refer to the Clojure name (foo-bar), not the Java name (fooBar)

Open questions: Maybe allow wildcards (foo*) for names beginning with "foo"? How to specify return types (e.g. methods named "foo" returning a String)? A way to specify varargs - maybe include a & somewhere? but then how to specify only non-varargs?

Then we could add an :only (and maybe an :exclude or :except) option, and do: (defwrapper java.io.File {:only [[file String] get-name get-path]})

It might then even be possible to add a clj-kondo handler (not sure if that's the correct term) that would implicitly lint-as (declare file get-name get-path) so that it doesn't generate undefined var errors when you use the wrapped methods later.

emlyn avatar Jan 08 '21 18:01 emlyn