Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/bugpattern/WithSignatureDiscouraged.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
`withSignature` replies on the string representation of internal classes in the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/replies/relies/? :)

javac implementation. Those string representations are not necessarily stable
across versions of javac, and they can change when a method is annotated with
type-use annotations.

Additionally, `withSignature` currently has at least one undocumented behavioral
quirk.

The most reasonable use case for `withSignature` is for methods that declare or
use type variables, which are difficult or impossible to express with the rest
of the `MethodMatchers` API. Still, where practical, prefer to write your own
matching code instead of using `withSignature`.