aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVladislav Lisetskiy <vladlis54@gmail.com>2015-11-03 18:14:30 +0300
committerVladislav Lisetskiy <vladlis54@gmail.com>2015-11-03 18:28:14 +0300
commitafbb944fe23b1be090ed69bfb97641be9dc2842c (patch)
tree41212442f8e8bcfced1b162221e44297f7a4654a /src
parent8f5317d1349ae006bfd26af2279cc2ca986df6e3 (diff)
downloadcheckstyle-afbb944fe23b1be090ed69bfb97641be9dc2842c.tar.gz
Issue #1627: Make 'processJavadoc' property 'true' by default
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java2
-rw-r--r--src/main/resources/sun_checks.xml4
-rw-r--r--src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java4
-rw-r--r--src/xdocs/config_imports.xml6
4 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java
index 48e9a2153..a14c5a146 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java
@@ -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();
diff --git a/src/main/resources/sun_checks.xml b/src/main/resources/sun_checks.xml
index e195890fe..6ecad476f 100644
--- a/src/main/resources/sun_checks.xml
+++ b/src/main/resources/sun_checks.xml
@@ -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 -->
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java
index e042c4f4f..ea764e018 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java
@@ -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"),
diff --git a/src/xdocs/config_imports.xml b/src/xdocs/config_imports.xml
index b9bf32d6e..0801a878f 100644
--- a/src/xdocs/config_imports.xml
+++ b/src/xdocs/config_imports.xml
@@ -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>