Skip to content

Commit

Permalink
Issue #1627: Make 'processJavadoc' property 'true' by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladlis committed Nov 3, 2015
1 parent 8f5317d commit afbb944
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions config/checkstyle_checks.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/> <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module> </module>
<module name="TypeName"/> <module name="TypeName"/>
<module name="UnusedImports"> <module name="UnusedImports"/>
<property name="processJavadoc" value="true"/>
</module>
<module name="UpperEll"/> <module name="UpperEll"/>
<module name="VisibilityModifier"/> <module name="VisibilityModifier"/>
<module name="WhitespaceAfter"/> <module name="WhitespaceAfter"/>
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class UnusedImportsCheck extends Check {
/** Flag to indicate when time to start collecting references. */ /** Flag to indicate when time to start collecting references. */
private boolean collect; private boolean collect;
/** Flag whether to process Javadoc comments. */ /** Flag whether to process Javadoc comments. */
private boolean processJavadoc; private boolean processJavadoc = true;


/** Set of the imports. */ /** Set of the imports. */
private final Set<FullIdent> imports = Sets.newHashSet(); private final Set<FullIdent> imports = Sets.newHashSet();
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/sun_checks.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@
<module name="AvoidStarImport"/> <module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages --> <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/> <module name="RedundantImport"/>
<module name="UnusedImports"/> <module name="UnusedImports">
<property name="processJavadoc" value="false"/>
</module>


<!-- Checks for Size Violations. --> <!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html --> <!-- See http://checkstyle.sf.net/config_sizes.html -->
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ protected String getNonCompilablePath(String filename) throws IOException {
} }


@Test @Test
public void testDefault() throws Exception { public void testWithoutProcessJavadoc() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class); final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);
checkConfig.addAttribute("processJavadoc", "false");
final String[] expected = { final String[] expected = {
"8:45: " + getCheckMessage(MSG_KEY, "8:45: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug"), "com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug"),
Expand Down Expand Up @@ -86,7 +87,6 @@ public void testDefault() throws Exception {
@Test @Test
public void testProcessJavadoc() throws Exception { public void testProcessJavadoc() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class); final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);
checkConfig.addAttribute("processJavadoc", "true");
final String[] expected = { final String[] expected = {
"8:45: " + getCheckMessage(MSG_KEY, "8:45: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug"), "com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug"),
Expand Down
6 changes: 3 additions & 3 deletions src/xdocs/config_imports.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ public class SomeClass { ... }
</li> </li>
<li> <li>
<b>Optionally:</b> it is referenced in Javadoc comments. This check <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. a compile time dependency for documentation purposes only.
As an example, the import <code>java.util.Date</code> would be As an example, the import <code>java.util.Date</code> would be
considered referenced with the Javadoc comment considered referenced with the Javadoc comment
Expand Down Expand Up @@ -1070,7 +1070,7 @@ class FooBar {
<td>processJavadoc</td> <td>processJavadoc</td>
<td>whether to process Javadoc</td> <td>whether to process Javadoc</td>
<td><a href="property_types.html#boolean">boolean</a></td> <td><a href="property_types.html#boolean">boolean</a></td>
<td><code>false</code></td> <td><code>true</code></td>
</tr> </tr>
</table> </table>
</subsection> </subsection>
Expand All @@ -1087,7 +1087,7 @@ class FooBar {
<subsection name="Example of Usage"> <subsection name="Example of Usage">
<ul> <ul>
<li> <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> Sun Style</a>
</li> </li>
<li> <li>
Expand Down

0 comments on commit afbb944

Please sign in to comment.