RE : Checking a method call

"Arnaud Roques" <[email protected]> Thu, 11 Sep 2008 10:45:39 +0200
Newsgroups gmane.comp.java.audit.checkstyle.user
Message-ID <006b01c913ea$c4e27420$3d380237@CLERMONTP147>
Hi,

 

I am thinking about writing a specific Checker for this.

You can still use regular expression to test this, even if it is quite
limited and not 100% perfect:

 

Example:

 

            <!-- printStackTrace() == -->

            <module name="GenericIllegalRegexp">

                  <property name="format" value="\.printStackTrace\s*\(" />

                  <property name="message" value="Don't use printStackTrace"
/>

                  <property name="ignoreComments" value="true" />

            </module>

 

 

Or :

 

            <!-- compareTo() == -->

            <module name="GenericIllegalRegexp">

                  <property name="format"

                        value="\.\s*compareTo\s*\([^=]*\)\s*==" />

                  <property name="message"

                        value="Use equals instead of compareTo()==0" />

                  <property name="ignoreComments" value="true" />

            </module>

 

            <!-- System.err.println -->

            <module name="GenericIllegalRegexp">

                  <property name="format" value="System\.(err|out)\.print"
/>

                  <property name="message" value="Do not use System.println"
/>

                  <property name="ignoreComments" value="true" />

            </module>

 

 

-----Message d'origine-----
De : [email protected]
[mailto:[email protected]] De la part de
jp.vandara
Envoyé : jeudi 11 septembre 2008 10:06
À : [email protected]
Objet : [Checkstyle-user] Checking a method call

 

 

Hi,

I would like to avoid the calls to some methods.

How can I check if a method is called?

Thanks,
Jean-Philippe.



Créez votre adresse <http://www.laposte.net>  électronique
[email protected]
1 Go d'espace de stockage, anti-spam et anti-virus intégrés.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user