DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

@UsedReflectively #1617

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've just started to make use of ClassPath to find and load classes in a 
package. Unfortunately this means that my IDE reports the classes I load via 
reflection as unused symbols. 

What I thought would be a good idea would be a hint annotation 
@UsedViaReflection (similar to @VisibleForTesting) that could be added to the 
classes (and fields, methods, constructors) that get called as part of 
reflection which I can then configure my IDE to ignore uses annotated with that 
class.

I've added this to my project and it's working out well though it would be nice 
if it were part of Guava. 

The alternative is to add a @SuppressWarning("Unused") which has the downside 
of suppressing all inspections below that scope, not just on that scope 
explicitly, resulting in real unused symbols going unnoticed.

Original issue reported on code.google.com by matt.nat...@gmail.com on 18 Dec 2013 at 4:55

GoogleCodeExporter commented 9 years ago
We have exactly this annotation, called @UsedReflectively.  We just haven't 
decided whether we want to keep adding more annotations to Guava or kick off a 
small project focused just on annotations.

Original comment by kevinb@google.com on 18 Dec 2013 at 6:11

GoogleCodeExporter commented 9 years ago
Good name. I think I'll refactor our annototation to be the same. Two words is 
better then one after all :-)

Original comment by matt.nat...@gmail.com on 18 Dec 2013 at 6:21

GoogleCodeExporter commented 9 years ago
Err, two words is better then three **

Original comment by matt.nat...@gmail.com on 18 Dec 2013 at 6:22

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:10

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08