Skip to content
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

Make it possible to ban annotations? #8

Closed
GoogleCodeExporter opened this issue Mar 14, 2015 · 7 comments
Closed

Make it possible to ban annotations? #8

GoogleCodeExporter opened this issue Mar 14, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

I am not sure if this is really necessary, its more of a curiousity/joke

What steps will reproduce the problem?
1. add this to signatures file:

org.junit.Test @ useless

What is the expected output? 

BUILD FAILED

What do you see instead?

[forbidden-apis] Scanned 29 (and 86 related) class file(s) for forbidden API 
invocations (in 0.07s), 0 error(s).


Original issue reported on code.google.com by [email protected] on 16 May 2013 at 5:47

@GoogleCodeExporter
Copy link
Author

Hi Robert,
this would of course only work with annotation that are still visible in the 
class files. If the compiler nukes them, they can no longer be detected. Your 
example would work, as it is a runtime annotation, and should be easy to 
implement (just add the visitAnnotation method to the class and method visitors 
and other places). I don't think that it is possible to detect annotations 
inside methods next to code blocks (but those cannot be runtime visible at all 
- not sure).
Java 8 also adds crazy new annotations to places in the class files where it 
was not possible to add them before (@NotNull,...).

Original comment by uwe.h.schindler on 16 May 2013 at 6:26

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

Here is a patch, unfortunately it is hard to test. The antunit stuff is really 
a nightmare!

Original comment by [email protected] on 15 Apr 2014 at 12:33

Attachments:

@GoogleCodeExporter
Copy link
Author

Hi Robert,
I will write a test. If you are not so familar with Antunit, it is indeed hard 
:(

Original comment by uwe.h.schindler on 15 Apr 2014 at 6:19

@GoogleCodeExporter
Copy link
Author

Yes, i tried for several hours to figure it out. no success...

Original comment by [email protected] on 15 Apr 2014 at 7:59

@GoogleCodeExporter
Copy link
Author

Patch, which also fixes issue #25 and refactors error reporting (because we 
only have line numbers inside method bodies, we report the signatures to lookup 
problems faster)

Original comment by uwe.h.schindler on 15 Apr 2014 at 11:05

Attachments:

@GoogleCodeExporter
Copy link
Author

Fixed.

Original comment by uwe.h.schindler on 15 Apr 2014 at 11:23

  • Changed state: Committed

@GoogleCodeExporter
Copy link
Author

Close after release of version 1.5.

Original comment by uwe.h.schindler on 16 Apr 2014 at 9:53

  • Changed state: Fixed

uschindler added a commit that referenced this issue Mar 14, 2015
…idden class use in field/method declarations, refactor error reporting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant