Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

allow "suppressed" annotations to supply class name/pattern matcher/something #96

Open
rmuir opened this issue Jan 14, 2016 · 0 comments

Comments

@rmuir
Copy link
Member

rmuir commented Jan 14, 2016

Today, you can use an annotation to suppress part of the code. But it suppresses everything! Unfortunately, sometimes this is too much and hides other problems.

It would be nice if someone could have an annotation like this:

@SuppressForbidden(targetClasses = { "some.banned.Classname" }) 

Basically the idea would be to just match on the offending class (at least as a start, since ultimately that is always available). Maybe it should allow glob patterns. In some cases there may be more than one violation in a piece of code, so either an array or ensuring repeating annotation (java 8+ only) is handled properly might work.

This is somewhat related to #82, in the sense that we find ourselves doing very bad things, like actually restructuring code in an unnatural way, just to workaround the limitations of a static analysis tool. I have seen this happen several times just this week!

On the other hand maybe its simpler and we can easily extend the annotation support we have to do this, since the name can just be a convention or something (accessed via reflection). Can we do it without loading the classes themselves? That would be the best, but I am not sure if its possible.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

1 participant