Issue #3157: Javadoc value tag can reference import (#3158)

This commit is contained in:
Konstantin Lutovich 2016-05-05 18:15:20 +02:00 committed by Roman Ivanov
parent 26776546fd
commit 7e100714bb
3 changed files with 23 additions and 0 deletions

View File

@ -142,6 +142,7 @@ public class JavadocTag {
public boolean canReferenceImports() {
return tagInfo == JavadocTagInfo.SEE
|| tagInfo == JavadocTagInfo.LINK
|| tagInfo == JavadocTagInfo.VALUE
|| tagInfo == JavadocTagInfo.LINKPLAIN
|| tagInfo == JavadocTagInfo.THROWS
|| tagInfo == JavadocTagInfo.EXCEPTION;

View File

@ -104,6 +104,13 @@ public class UnusedImportsCheckTest extends BaseCheckTestSupport {
verify(checkConfig, getPath("InputUnusedImports.java"), expected);
}
@Test
public void testProcessJavadocWithLinkTag() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputUnusedImportWithValueTag.java"), expected);
}
@Test
public void testAnnotations() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);

View File

@ -0,0 +1,15 @@
package com.puppycrawl.tools.checkstyle.checks.imports;
import java.util.Calendar;
public class InputUnusedImportWithValueTag {
/**
* Method determines current month as for {@value Calendar#MONTH}.
*
* @return index of the current month.
*/
public int currentMonth() {
return 1;
}
}