Issue #1627: Make 'processJavadoc' property 'true' by default

This commit is contained in:
Vladislav Lisetskiy 2015-11-03 18:14:30 +03:00
parent 8f5317d134
commit afbb944fe2
5 changed files with 12 additions and 10 deletions

View File

@ -196,9 +196,9 @@
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<module name="TypeName"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
<module name="UnusedImports"/>
<module name="UpperEll"/>
<module name="VisibilityModifier"/>
<module name="WhitespaceAfter"/>

View File

@ -74,7 +74,7 @@ public class UnusedImportsCheck extends Check {
/** Flag to indicate when time to start collecting references. */
private boolean collect;
/** Flag whether to process Javadoc comments. */
private boolean processJavadoc;
private boolean processJavadoc = true;
/** Set of the imports. */
private final Set<FullIdent> imports = Sets.newHashSet();

View File

@ -103,7 +103,9 @@
<module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="UnusedImports">
<property name="processJavadoc" value="false"/>
</module>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->

View File

@ -46,8 +46,9 @@ public class UnusedImportsCheckTest extends BaseCheckTestSupport {
}
@Test
public void testDefault() throws Exception {
public void testWithoutProcessJavadoc() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);
checkConfig.addAttribute("processJavadoc", "false");
final String[] expected = {
"8:45: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug"),
@ -86,7 +87,6 @@ public class UnusedImportsCheckTest extends BaseCheckTestSupport {
@Test
public void testProcessJavadoc() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);
checkConfig.addAttribute("processJavadoc", "true");
final String[] expected = {
"8:45: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug"),

View File

@ -1031,7 +1031,7 @@ public class SomeClass { ... }
</li>
<li>
<b>Optionally:</b> it is referenced in Javadoc comments. This check
is off by default, as it is considered bad practice to introduce
is on by default, but it is considered bad practice to introduce
a compile time dependency for documentation purposes only.
As an example, the import <code>java.util.Date</code> would be
considered referenced with the Javadoc comment
@ -1070,7 +1070,7 @@ class FooBar {
<td>processJavadoc</td>
<td>whether to process Javadoc</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
<td><code>true</code></td>
</tr>
</table>
</subsection>
@ -1087,7 +1087,7 @@ class FooBar {
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/sun_checks.xml#L106">
<a href="https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/sun_checks.xml#L106-L108">
Sun Style</a>
</li>
<li>