Menu

#503 Add checks to ban usage of platform default encoding

open
nobody
rules (229)
5
2012-10-07
2008-04-27
No

Please see equal feature request #1952645 over at Checkstyle:
https://sourceforge.net/tracker/index.php?func=detail&aid=1952645&group_id=29721&atid=397081

Ideally, users should be able to ban each method individually to have precise control on what is acceptable and what not. However, I cannot estimate how much overhead this would cause for the rule implementations.

Discussion

  • Ryan Gustafson

    Ryan Gustafson - 2008-04-28

    Logged In: YES
    user_id=342470
    Originator: NO

    This could be implemented generically via the idea I posited on the developer forum a while back:

    http://sourceforge.net/forum/forum.php?thread_id=1812158&forum_id=188194

    Consider a list of non-authorized classes:

    com.utter.crap.TotallyObsoleteClass

    And constructor/method signatures:

    com.caveat.programmer.HardToUseProperlyClass(String)
    com.caveat.programmer.HardToUseProperlyClass.methodFoo(int,boolean,Object)

    Shouldn't be too hard to manage this list of things in an XML file, and make a rule which checks against the list.

    Ultimately, the Type Resolution code and Symbol Table usage will be integrated making it trivial to look for calls to methods/constructors in external code (no set delivery for this, it's just on my list of TODO items, might be a long while before I get to it). Currently that is not the case, so one might have to a bit of temporary fancy footwork to recognize such calls, and it'll won't be 100% perfect, etc.

    You're welcome to work on this, and submit a patch. It's a powerful Rule with many potential applications.

     
  • Benjamin Bentmann

    Logged In: YES
    user_id=2071735
    Originator: YES

    Shouldn't be too hard to manage this list of things in an XML file, and
    make a rule which checks against the list.
    Yes, that's exactly what I need! The XML list would be required to capture ordinary Java APIs that don't have annotations or whatsoever.

    You're welcome to work on this, and submit a patch.
    I'm sorry but I have to disappoint you. The spare free time I get is already lost on contributing to Maven. But I'm fine with waiting on this issue, it's not urgent but will be really nice to have one day since it can avoid quite some bugs right from the beginning.

     

Log in to post a comment.