[ checkstyle-Feature Requests-3026467 ] MagicNumber check shouldn't complain about annotations

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ checkstyle-Feature Requests-3026467 ] MagicNumber check shouldn't complain about annotations

SourceForge.net
Feature Requests item #3026467, was opened at 2010-07-07 10:33
Message generated for change (Comment added) made by
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397081&aid=3026467&group_id=29721

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Check
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Jean-Noel Rouvignac ()
Assigned to: Nobody/Anonymous (nobody)
Summary: MagicNumber check shouldn't complain about annotations

Initial Comment:
Hello,

The MagicNumber rule is a bit too aggressive in my case.
I have some code that looks like this, for which the MagicNumber check complains:
@AnnotationUsedToDefineConstants(elementValue = 770)
public class MyClass {
}

Then I have another code that extracts the 770 value at runtime. So in effect, this annotation defines the constants for me an associates them to the class.

IMHO, the MagicNumber check should not raise a violation here.
What are your thoughts about it?

----------------------------------------------------------------------

Comment By: Riggs ()
Date: 2011-11-16 01:01

Message:
I can verify that this now works (Eclipse Plugin with Checkstyle 5.5):
Setting the ignoreAnnotation to true in the MagicNumber-Rule fixes this.

----------------------------------------------------------------------

Comment By: Riggs ()
Date: 2011-07-06 23:35

Message:
I totally agree.
Is there a chance that a fix for this gets into an upcoming release?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397081&aid=3026467&group_id=29721

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Checkstyle-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-devel