New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable Modernizer via @SuppressWarnings annotation #3
Comments
If I understand modernizer correctly, this wouldn't work: @SuppressWarnings is only retained in the source, not in the generated class files. |
@ankon I have limited background in annotation processing but I believe one can use the http://docs.oracle.com/javase/7/docs/api/java/lang/annotation/RetentionPolicy.html |
@andrewgaul, that's true when one has control over the annotation. In this case, however, |
I see, so we would need a new |
That would be a solution, yes. (Though not quite as nice as the original suggestion.) Have no better idea at this point. (Other than adding support for source code analysis to the plugin, of course!) |
asm is operating on the bytecode, so I would think RententionPolicy.CLASS should be sufficient. |
Ah, right. That's more appropriate indeed. |
Thinking a bit outside of the box here: One "evil" way could be to add a annotation processing step, which finds the @SuppressWarnings that pertain to modernizer, and dumps those into an exclusion file which is then used by the actual modernizer goal. This would avoid polluting sources with build-system specific things ... except that of course the value in the annotation is also modernizer-specific, and in fact eclipse warns about unrecognized values in it :/ |
The exclusion will be removed once gaul/modernizer-maven-plugin#3 is fixed.
This would be cool, and help with #28 as well... |
Findbugs has its own annotation for suppressing warnings. One interesting thing finbugs did is not caring which package the annotation is in, see : https://stackoverflow.com/a/44947252 . This allows users to declare the annotation and avoid having a dependency on findbugs. |
Just a heads up we're going to be working on this in our fork (https://github.com/HubSpot/modernizer-maven-plugin) and will upstream the changes once they're ready. |
@jhaber Any updates on this? |
We have it working where you can put Once that is merged, we were thinking that it would be a good MVP of this feature and we would send a PR to upstream those changes. Some notes about our approach:
|
Sounds good. I have concerns about the large number of spurious changes in that pull request so please minimize the noise before submitting a pull request. I look forward to this feature! |
@SuppressWarnings allows finer-grained suppression of violations than the existing file-based mechanism.
The text was updated successfully, but these errors were encountered: