consider the following class:
public class JFBugTest
{
/**
* Constructor to reproduce bug where JRefactory inserts param/throws-tags even with the
* following pretty.settings:<p>
*
* #author.descr=<br>
* #created.descr=<br>
* #param.descr=<br>
* #return.descr=<br>
* #exception.descr=<br>
* class.tags=<br>
* method.tags=<br>
* field.tags=
*/
public JFBugTest(int foo, String bar)
throws IllegalStateException {
throw new IllegalStateException("just a test");
}
/**
* Method for which no param-tags will be added.
*/
public void doSomething(byte foo, Integer bar)
throws IllegalStateException {
throw new IllegalStateException("just a test");
}
}
next, create a pretty.settings contaning the following lines (or use the one attached; all other settings should not matter to reproduce this bug):
#author.descr=
#created.descr=
#param.descr=
#return.descr=
#exception.descr=
class.tags=
method.tags=
field.tags=
this intends to prevent the pretty prettiner from adding any comments whatsoever. nevertheless, after running the pretty printer (using the ant task) with the above settings, it nevertheless becomes:
public class JFBugTest
{
/**
* Constructor to reproduce bug where JRefactory inserts param/throws-tags even with the
* following pretty.settings:<p>
*
* #author.descr=<br>
* #created.descr=<br>
* #param.descr=<br>
* #return.descr=<br>
* #exception.descr=<br>
* class.tags=<br>
* method.tags=<br>
* field.tags=
*
* @throws IllegalStateException Description of the exception
* @param foo Description of the parameter
* @param bar Description of the parameter
*/
public JFBugTest(int foo, String bar)
throws IllegalStateException {
throw new IllegalStateException("just a test");
}
/**
* Method for which no param-tags will be added.
*/
public void doSomething(byte foo, Integer bar)
throws IllegalStateException {
throw new IllegalStateException("just a test");
}
}
apparently, @param/@throws have been added to the constructor that weren't there before. however, the method doSomething() (correctly) did not get any @param/throws.
i noticed this bug in my own sourceforege project "jomic", so you browse the original code in case you want:
- for the settings, take a look at the attachment, or see http://cvs.sourceforge.net/viewcvs.py/jomic/jomic/.Refactory/pretty.settings
- for some real world code that gets screwed up with @params, see the constructor of net.sf.jomic.comic.ComicImage at http://cvs.sourceforge.net/viewcvs.py/jomic/jomic/source/net/sf/jomic/comic/ComicImage.java
complete pretty.settings used in my project.
Logged In: YES
user_id=421066
oops, forgot to mention that i was using JavaStyle 2.9.19.