diff options
author | rnveach <rveach02@gmail.com> | 2015-10-14 15:19:11 -0400 |
---|---|---|
committer | rnveach <rveach02@gmail.com> | 2015-10-15 18:48:24 -0400 |
commit | bf94ea4127b17c5ab6987ee2e294d2d4b6a1c20f (patch) | |
tree | d25294651ac0be2be5efa0be6a8cfb042fb86aa8 /src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc | |
parent | 1f0b9653e13faeae357ba84e7a7702eecd208fe9 (diff) | |
download | checkstyle-bf94ea4127b17c5ab6987ee2e294d2d4b6a1c20f.tar.gz |
Issue #2161: unify test input locations for javadoc package
Diffstat (limited to 'src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc')
32 files changed, 2353 insertions, 0 deletions
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputBadTag.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputBadTag.java new file mode 100644 index 000000000..7dbdf065e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputBadTag.java @@ -0,0 +1,9 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * The following is a bad tag. + * @mytag Hello + */ +public class InputBadTag +{ +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectAtClauseOrderCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectAtClauseOrderCheck.java new file mode 100644 index 000000000..487458003 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectAtClauseOrderCheck.java @@ -0,0 +1,291 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +import java.io.Serializable; + +/** + * Some javadoc. + * + * @author max + * @version 1.0 + * @see Some javadoc. + * @since Some javadoc. + * @deprecated Some javadoc. + */ +class WithAnnotations implements Serializable +{ + + /** + * The client's first name. + * @serial + */ + private String fFirstName; + + /** + * The client's first name. + * @serial + */ + private String sSecondName; + + /** + * The client's first name. + * @serialField + */ + private String tThirdName; + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + * @deprecated Some text. + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @throws Exception Some text. + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + void method3() throws Exception {} + + /** + * Some text. + * @return Some text. + * @throws Exception Some text. + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @serialData Some javadoc. + * @deprecated Some text. + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @param aInt Some text. + * @param aBoolean Some text. + * @return Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + + /** + * + * @author max + * @version 1.0 + * @since Some javadoc. + */ + class InnerClassWithAnnotations + { + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @throws Exception Some text. + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + void method3() throws Exception {} + + /** + * Some text. + * @return Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @serialData Some javadoc. + * @deprecated Some text. + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @param aInt Some text. + * @param aBoolean Some text. + * @return Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + } + + InnerClassWithAnnotations anon = new InnerClassWithAnnotations() + { + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @throws Exception Some text. + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + void method3() throws Exception {} + + /** + * Some text. + * @return Some text. + * @throws Exception Some text. + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @deprecated Some text. + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @param aInt Some text. + * @param aBoolean Some text. + * @return Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + }; +} + +/** + * Some javadoc. + * + * @author max + * @version 1.0 + * @see Some javadoc. + * @since Some javadoc. + * @deprecated Some javadoc. + */ +enum Foo3 {} + +/** + * Some javadoc. + * + * @author max + * @version 1.0 + * @see Some javadoc. + * @since Some javadoc. + * @deprecated Some javadoc. + */ +interface FooIn3 {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectJavaDocParagraphCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectJavaDocParagraphCheck.java new file mode 100644 index 000000000..3d47e044d --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectJavaDocParagraphCheck.java @@ -0,0 +1,99 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * Some Javadoc. + * + * <p>Some Javadoc. + * + */ +class InputCorrectJavaDocParagraphCheck { + + /** + * Some Javadoc. + * + * <p>{@code function} will never be invoked with a null value. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + * + * <p>Some Javadoc. + * + * <pre> + * class Foo { + * + * void foo() {} + * } + * </pre> + * + * @see <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules"> + * Documentation about GWT emulated source</a> + */ + boolean emulated() {return false;} + + /** + * Some Javadoc. + * + * <p>Some Javadoc. + * + */ + class InnerInputCorrectJavaDocParagraphCheck { + + /** + * Some Javadoc. + * + * <p>Some Javadoc. + * + * <p>Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + * + * <p>Some Javadoc. + * + * @see <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules"> + * Documentation about GWT emulated source</a> + */ + boolean emulated() {return false;} + } + + InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { + + /** + * Some Javadoc. + * + * <p>Some Javadoc. + * + * <p>Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc with space at the end of first line. + * + * <p>Some Javadoc. + * + * <p>Some Javadoc. + * + * @see <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules"> + * Documentation about GWT emulated source</a> + */ + boolean emulated() {return false;} + }; +} + +/* + * This comment has paragraph without '<p>' tag. + * + * It's fine, because this is plain comment. + */ +class ClassWithPlainComment {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectSummaryJavaDocCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectSummaryJavaDocCheck.java new file mode 100644 index 000000000..b5c1fcfd1 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCorrectSummaryJavaDocCheck.java @@ -0,0 +1,140 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * Some Javadoc A {@code Foo} is a simple Javadoc. + */ +class InputCorrectSummaryJavaDocCheck { + + /** + * Some Javadoc This method returns. + */ + public static final byte NUL = 0; + + /** + * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. + */ + void foo3() {} + + /** + * @throws Exception if an error occurs. + */ + void foo4() throws Exception {} + + /** An especially This method returns short bit of Javadoc. */ + void foo5() {} + + /** + * An especially short + * bit of Javadoc. This method returns. + */ + void foo6() {} + + /** + * <a href="mailto:vlad@htmlbook.ru"/> + */ + class InnerInputCorrectJavaDocParagraphCheck { + + /** + * foooo@foooo. + */ + public static final byte NUL = 0; + + /** + * Some java@doc. + * This method returns. + */ + public static final byte NUL_2 = 0; + + /** + * Returns the customer ID. This method returns + */ + int getId() {return 666;} + + /** + * <a href="mailto:vlad@htmlbook.ru"/>. + */ + void foo2() {} + + /** + * As of JDK 1.1, + * replaced by {@link #setBounds(int,int,int,int)}. This method returns. + */ + void foo3() {} + + /** + * @throws Exception if an error occurs. + */ + void foo4() throws Exception {} + + /** + * JAXB Provider Use Only: Provides partial default + * implementations for some of the javax.xml.bind interfaces. + */ + void foo5() {} + + /** + * An especially short (int... A) bit of Javadoc. This + * method returns + */ + void foo6() {} + } + + /** + * Some + * javadoc. A {@code Foo} is a simple Javadoc. + * + * Some Javadoc. A {@code Foo} + * is a simple Javadoc. + */ + InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { + + /** + * JAXB 1.0 only default validation event handler. + */ + public static final byte NUL = 0; + + /** + * Returns the current state. + * This method returns. + */ + boolean emulated(String s) {return false;} + + /** + * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. + */ + void foo3() {} + + /** + * @throws Exception if an error occurs. + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** + * An especially short bit of Javadoc. + */ + void foo6() {} + + /** + * Some Javadoc. This method returns some javadoc. + */ + boolean emulated() {return false;} + + /** + * Some Javadoc. This method returns some javadoc. Some Javadoc. + */ + boolean emulated1() {return false;} + + /** + * @return Some Javadoc the customer ID. + */ + int geId() {return 666;} + + /** + * @return Sentence one. Sentence two. + */ + String twoSentences() {return "Sentence one. Sentence two.";} + }; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCustomTag.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCustomTag.java new file mode 100644 index 000000000..d13bd82ab --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputCustomTag.java @@ -0,0 +1,8 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +public class InputCustomTag { + /** + * {@customTag} + */ + void customTag() {} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputGuavaFalsePositive.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputGuavaFalsePositive.java new file mode 100644 index 000000000..8b5c42794 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputGuavaFalsePositive.java @@ -0,0 +1,17 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +import com.google.common.base.Function; + +class Foo5 { + + /** + * This class implements the GWT serialization of {@link HashMultimap}. + * + * @author Jord Sonneveld + * + */ + public static <T extends Enum<T>> Function<String, T> valueOfFunction( + Class<T> enumClass) { + return null; + } +}
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectAtClauseOrderCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectAtClauseOrderCheck.java new file mode 100644 index 000000000..33b87b51a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectAtClauseOrderCheck.java @@ -0,0 +1,295 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; +/** Javadoc for import */ +import java.io.Serializable; + +/** + * Some javadoc. + * + * @since Some javadoc. + * @version 1.0 //warn //warn + * @deprecated Some javadoc. + * @see Some javadoc. //warn + * @author max //warn + */ +class WithAnnotations1 implements Serializable +{ + /** + * The client's first name. + * @serial + */ + private String fFirstName; + + /** + * The client's first name. + * @serial + */ + private String sSecondName; + + /** + * The client's first name. + * @serialField + */ + private String tThirdName; + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @serialData Some javadoc. + * @deprecated Some text. + * @throws Exception Some text. //warn + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @serialData Some javadoc. + * @return Some text. //warn + * @param aString Some text. //warn + * @throws Exception Some text. + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @throws Exception Some text. + * @param aString Some text. //warn + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @deprecated Some text. + * @throws Exception Some text. //warn + */ + void method3() throws Exception {} + + /** + * Some text. + * @return Some text. + * @throws Exception Some text. + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @deprecated Some text. + * @return Some text. //warn + * @param aString Some text. //warn + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @serialData Some javadoc. + * @param aInt Some text. //warn + * @throws Exception Some text. + * @param aBoolean Some text. //warn + * @deprecated Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + + /** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * @serialData Some javadoc. + * @author max //warn + */ + class InnerClassWithAnnotations + { + /** + * Some text. + * @return Some text. + * @deprecated Some text. + * @param aString Some text. //warn + * @throws Exception Some text. + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @throws Exception Some text. + * @return Some text. //warn + * @param aString Some text. //warn + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @serialData Some javadoc. + * @param aString Some text. //warn + * @throws Exception Some text. + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @deprecated Some text. + * @throws Exception Some text. //warn + */ + void method3() throws Exception {} + + /** + * Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + * @return Some text. //warn + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @deprecated Some text. + * @return Some text. //warn + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @param aInt Some text. //warn + * @throws Exception Some text. + * @param aBoolean Some text. //warn + * @deprecated Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + } + + InnerClassWithAnnotations anon = new InnerClassWithAnnotations() + { + /** + * Some text. + * @throws Exception Some text. + * @param aString Some text. //warn + * @serialData Some javadoc. + * @deprecated Some text. + * @return Some text. //warn + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @throws Exception Some text. + * @return Some text. //warn + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @throws Exception Some text. + * @param aString Some text. //warn + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @deprecated Some text. + * @throws Exception Some text. //warn + */ + void method3() throws Exception {} + + /** + * Some text. + * @throws Exception Some text. + * @return Some text. //warn + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @deprecated Some text. + * @return Some text. //warn + * @param aString Some text. //warn + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @param aInt Some text. //warn + * @throws Exception Some text. + * @param aBoolean Some text. //warn + * @deprecated Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + }; +} + +/** + * Some javadoc. + * + * @since Some javadoc. + * @version 1.0 //warn //warn + * @deprecated Some javadoc. + * @see Some javadoc. //warn + * @author max //warn + */ +enum Foo4 {} + +/** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * @serialData Some javadoc. + * @author max //warn + */ +interface FooIn { + /** + * @value tag without specified order by default + */ + int CONSTANT = 0; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectJavaDocParagraphCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectJavaDocParagraphCheck.java new file mode 100644 index 000000000..f6ddde257 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectJavaDocParagraphCheck.java @@ -0,0 +1,87 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + + + +/** + * Some Javadoc. + * <p> + * /^ WARN/ Some Javadoc.<p> //WARN + * + */ +class InputInCorrectJavaDocParagraphCheck { + + /** + * Some Javadoc.<P> //WARN + * + * <p> Some Javadoc. //WARN + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some <p>Javadoc.//WARN + * + * <p> Some Javadoc.//WARN + * + * @see <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules"> + * Documentation about GWT emulated source</a> + */ + boolean emulated() {return false;} + + /**<p>Some Javadoc.<p> //WARN + * <p> //WARN + * <p><p> //WARN + * <p>/^WARN/ Some Javadoc.<p>*/ //WARN + class InnerInputCorrectJavaDocParagraphCheck { + + /** + * Some Javadoc./WARN/<p> //WARN + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /**<p> //WARN + * /^WARN/ Some Javadoc. + * + * <P> //WARN + * /^WARN/ + * <p> //WARN + * /^WARN/ Some Javadoc.<p> //WARN + * @see <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules"> + * Documentation about GWT emulated source</a> + */ + boolean emulated() {return false;} + } + + InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { + + /** + * <p>Some Javadoc. //WARN + * + * Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * /WARN/ Some Javadoc.<p> //WARN + * + * <p> Some Javadoc. //WARN + * + * @see <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules"> + * Documentation about <p> GWT emulated source</a> //WARN + */ + boolean emulated() {return false;} + + /** + * Double newline. + * + * + * Some Javadoc. //DOUBLE WARN AT TWO PREVIOUS LINES + */ + void doubleNewline() {} + }; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectSummaryJavaDocCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectSummaryJavaDocCheck.java new file mode 100644 index 000000000..13129353c --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputIncorrectSummaryJavaDocCheck.java @@ -0,0 +1,116 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * A {@code Foo. Foo} + * is a simple Javadoc. Some javadoc. + */ +class InputInCorrectSummaryJavaDocCheck { + + /** + * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} + */ + void foo3() {} + + /** + * @throws Exception if an error occurs + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** + * An especially short bit of Javadoc. + */ + void foo6() {} + + /** + * Some Javadoc. + */ + public static final byte NUL = 0; + + /** + * <a href="mailto:vlad@htmlbook.ru"/> + */ + class InnerInputCorrectJavaDocParagraphCheck { + + /** + * foooo@foooo + */ + public static final byte NUL = 0; + + /** + * Some java@doc. + */ + public static final byte NUL_2 = 0; + + /** + * This method + * returns some javadoc. Some javadoc. + */ + boolean emulated() {return false;} + + /** + * <a href="mailto:vlad@htmlbook.ru"/> + */ + void foo2() {} + + /** + * @return the + * customer ID some javadoc. + */ + int geId() {return 666;} + + /** + * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} + */ + void foo3() {} + + /** + * @throws Exception if an error occurs + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** + * An especially short bit of Javadoc. + */ + void foo6() {} + } + + /** + * A {@code InnerInputCorrectJavaDocParagraphCheck} is a simple code. + */ + InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { + + /** + * Some Javadoc. + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + */ + void emulated(String s) {} + + /** + * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} + */ + void foo3() {} + + /** + * @throws Exception if an error occurs + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** + * An especially short bit of Javadoc. + */ + void foo6() {} + }; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavaDocTagContinuationIndentation.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavaDocTagContinuationIndentation.java new file mode 100644 index 000000000..0d15d2f73 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavaDocTagContinuationIndentation.java @@ -0,0 +1,328 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +import java.io.Serializable; + +/** + * Some javadoc. + * + * @since Some javadoc. + * Some javadoc. + * @version 1.0 + * @see Some javadoc. + * Some javadoc. + * @see Some javadoc. + * @author max + * Some javadoc. + */ +class InputJavaDocTagContinuationIndentation implements Serializable +{ + /** + * The client's first name. + * @serial Some javadoc. + * Some javadoc. + */ + private String fFirstName; + + /** + * The client's first name. + * @serial + * Some javadoc. + */ + private String sSecondName; + + /** + * The client's first name. + * @serialField + * Some javadoc. + */ + private String tThirdName; + + /** + * Some text. + * @param aString Some javadoc. + * Some javadoc. + * @return Some text. + * @serialData Some javadoc. + * @see Some text. + * Some javadoc. // warn + * @throws Exception Some text. + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @serialData Some javadoc. + * @return Some text. + * Some javadoc. + * @param aString Some text. + * @throws Exception Some text. + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @throws Exception Some text. + * Some javadoc. + * @param aString Some text. + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @see Some text. + * @throws Exception Some text. + * Some javadoc. + */ + void method3() throws Exception {} + + /** + * Some text. + * @return Some text. + * @throws Exception Some text. + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @see Some text. + * @return Some text. + * @param aString Some text. + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * Some javadoc. // warn + * @serialData Some javadoc. + * @param aInt Some text. + * Some javadoc. // warn + * @throws Exception Some text. + * @param aBoolean Some text. + * @see Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + + /** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * @serialData Some javadoc. + * @author max + */ + class InnerClassWithAnnotations + { + /** + * Some text. + * @return Some text. + * @see Some text. + * Some javadoc. + * @param aString Some text. + * @throws Exception Some text. + * Some javadoc. + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @throws Exception Some text. + * Some javadoc. + * @return Some text. + * @param aString Some text. + * Some javadoc. + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @serialData Some javadoc. + * Some javadoc. + * @param aString Some text. + * Some javadoc. + * @throws Exception Some text. + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @see Some text. + * @throws Exception Some text. + */ + void method3() throws Exception {} + + /** + * Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + * @return Some text. + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @see Some text. + * @return Some text. + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * @return Some text. + * @param aInt Some text. + * Some javadoc. // warn + * @throws Exception Some text. + * @param aBoolean Some text. + * Some javadoc. // warn + * @see Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + } + + InnerClassWithAnnotations anon = new InnerClassWithAnnotations() + { + /** + * Some text. + * @throws Exception Some text. + * @param aString Some text. + * Some javadoc. // warn + * @serialData Some javadoc. + * Some javadoc. // warn + * @see Some text. + * @return Some text. + */ + String method(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @param aString Some text. + * Some javadoc. + * @throws Exception Some text. + * @return Some text. + */ + String method1(String aString) throws Exception + { + return "null"; + } + + /** + * Some text. + * @throws Exception Some text. + * Some javadoc. + * @param aString Some text. + */ + void method2(String aString) throws Exception {} + + /** + * Some text. + * @see Some text. + * Some javadoc. + * @throws Exception Some text. + */ + void method3() throws Exception {} + + /** + * Some text. + * @throws Exception Some text. + * @return Some text. + */ + String method4() throws Exception + { + return "null"; + } + + /** + * Some text. + * @see Some text. + * @return Some text. + * @param aString Some text. + */ + String method5(String aString) + { + return "null"; + } + + /** + * Some text. + * Some javadoc. // warn + * @param aString Some text. + * Some javadoc. // warn + * @return Some text. + * @param aInt Some text. + * Some javadoc. // warn + * @throws Exception Some text. + * Some javadoc. // warn + * @param aBoolean Some text. + * @see Some text. + */ + String method6(String aString, int aInt, boolean aBoolean) throws Exception + { + return "null"; + } + }; +} + +/** + * Some javadoc. + * + * @since Some javadoc. + * @version 1.0 + * @see Some javadoc. + * Some javadoc. + * Some javadoc. + * @see Some javadoc. + * Some javadoc. // warn + * @author max + */ +enum Foo1 {} + +/** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * Some javadoc. + * @serialData Some javadoc. + * Line below is empty on purpose. // warn + * + * @author max + * @see {@link com.puppycrawl.tools.checkstyle.AllChecksPresentOnAvailableChecksPageTest + * some description} // no warning, as this is just inline tag description + */ +interface FooIn1 {} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavaDocTagContinuationIndentationOffset3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavaDocTagContinuationIndentationOffset3.java new file mode 100644 index 000000000..52267a8b4 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavaDocTagContinuationIndentationOffset3.java @@ -0,0 +1,36 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * Some javadoc. + * + * @since Some javadoc. + * Some javadoc. // warn + * @version 1.0 + * @deprecated Some javadoc. + * Some javadoc. + * @see Some javadoc. + * @author max + * Some javadoc. + */ +class JavaDocTagContinuationIndentationOffset3 { + /** + * The client's first name. + * @serial Some javadoc. + * Some javadoc. // warn + */ + private String fFirstName; + + /** + * The client's first name. + * @serial + * Some javadoc. + */ + private String sSecondName; + + /** + * The client's first name. + * @serialField + * Some javadoc. + */ + private String tThirdName; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavadocStyleCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavadocStyleCheck.java new file mode 100644 index 000000000..6b151256c --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavadocStyleCheck.java @@ -0,0 +1,410 @@ +//////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +// Created: 2003 +//////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * Test input for the JavadocStyleCheck. This check is used to perform + * some additional Javadoc validations. + * + * @author Chris Stillwell + * @version 1.0 + */ +public class InputJavadocStyleCheck +{ + // This is OK. We don't flag missing javadoc. That's left for other checks. + private String first; + + /** This Javadoc is missing an ending period */ + private String second; + + /** + * We don't want {@link com.puppycrawl.tools.checkstyle.checks.JavadocStyleCheck} + * tags to stop the scan for the end of sentence. + * @see Somthing + */ + public InputJavadocStyleCheck() + { + } + + /** + * This is ok! + */ + private void method1() + { + } + + /** + * This is ok? + */ + private void method2() + { + } + + /** + * And This is ok.<br> + */ + private void method3() + { + } + + /** + * This should fail even.though.there are embedded periods + */ + private void method4() + { + } + + /** + * Test HTML in Javadoc comment + * <dl> + * <dt><b>This guy is missing end of bold tag + * <dd>The dt and dd don't require end tags. + * </dl> + * </td>Extra tag shouldn't be here + * + * @param arg1 <code>dummy. + */ + private void method5(int arg1) + { + } + + /** + * Protected check <b>should fail + */ + protected void method6() + { + } + + /** + * Package protected check <b>should fail + */ + void method7() + { + } + + /** + * Public check should fail</code> + * should fail < + */ + public void method8() + { + } + + /** {@inheritDoc} **/ + public void method9() + { + } + + + // Testcases to excercize the Tag parser (bug 843887) + + /** + * Real men don't use XHTML. + * <br /> + * <hr/> + * < br/> + * <img src="schattenparker.jpg"/></img> + */ + private void method10() + { // </img> should be the only error + } + + /** + * Tag content can be really mean. + * <p> + * Sometimes a p tag is closed. + * </p> + * <p> + * Sometimes it's not. + * + * <span style="font-family:'Times New Roman',Times,serif;font-size:200%"> + * Attributes can contain spaces and nested quotes. + * </span> + * <img src="slashesCanOccurWithin/attributes.jpg"/> + * <img src="slashesCanOccurWithin/attributes.jpg"> + * <!-- comments <div> should not be checked. --> + */ + private void method11() + { // JavadocStyle should not report any error for this method + } + + /** + * Tags for two lines. + * <a href="some_link" + * >Link Text</a> + */ + private void method12() + {// JavadocStyle should not report any error for this method + } + + /** + * First sentence. + * <pre> + * +--LITERAL_DO (do) + * | + * +--SLIST ({) + * | + * +--EXPR + * | + * +--ASSIGN (=) + * | + * +--IDENT (x) + * +--METHOD_CALL (() + * | + * +--DOT (.) + * | + * +--IDENT (rand) + * +--IDENT (nextInt) + * +--ELIST + * | + * +--EXPR + * | + * +--NUM_INT (10) + * +--RPAREN ()) + * +--SEMI (;) + * +--RCURLY (}) + * +--LPAREN (() + * +--EXPR + * | + * +--LT (<) + * | + * +--IDENT (x) + * +--NUM_INT (5) + * +--RPAREN ()) + * +--SEMI (;) + * </pre> + */ + private void method13() + {// JavadocStyle should not report any error for this method + } + + /** + * Some problematic javadoc. Sample usage: + * <blockquote> + */ + + private void method14() + { // empty line between javadoc and method is critical (bug 841942) + } + + /** + * Empty line between javadoc and method declaration cause wrong + * line number for reporting error (bug 841942) + */ + + private void method15() + { // should report unended first sentance (check line number of the error) + } + + /** Description of field: {@value}. */ + public static final int dummy = 4911; + + /** + */ + public void method16() + { // should report empty javadoc + } + + /** + * @param a A parameter + */ + protected void method17(String a) + { // should report empty javadoc (no text before parameter) + } + + /** + * @exception RuntimeException shoul be thrown + */ + void method18(String a) + { // should report empty javadoc (no text before exception) + } + + /** + */ + private static int ASDF = 0; + // should report empty javadoc + + /** @see java.lang.Object */ + public void method19() + { // should report empty javadoc (no text before see tag) + } + + public enum Test + //Should complain about no javadoc + { + /** + * Value 1 without a period + */ + value1, + + /** + * Value 2 with a period. + */ + value2, + } + + /** + * A test class. + * @param <T1> this is NOT an unclosed T1 tag + * @param <KEY_T> for bug 1649020. + * @author <a href="mailto:foo@nomail.com">Foo Bar</a> + */ + public class TestClass<T1, KEY_T> + { + /** + * Retrieves X. + * @return a value + */ + public T1 getX() + { + return null; + } + + /** + * Retrieves Y. + * @param <V> this is not an unclosed V tag + * @return a value + */ + public <V> V getY() + { + return null; + } + + /** + * Retrieves Z. + * + * @param <KEY_T1> this is not an unclosed KEY_T tag + * @return a value + */ + public <KEY_T1> KEY_T getZ_1649020_1() + { + return null; + } + + /** + * Retrieves something. + * + * @param <KEY_T_$_1_t> strange type + * @return a value + */ + public <KEY_T_$_1_t> KEY_T_$_1_t getEh_1649020_2() { + return null; + } + + /** + * Retrieves more something. + * + * @param <$_12_xY_z> strange type + * @return a value + */ + public <$_12_xY_z> $_12_xY_z getUmmm_1649020_3() { + return null; + } + } + + /** + * Checks if the specified IClass needs to be + * annotated with the @Type annotation. + */ + public void foo_1291847_1() { + } + + /** + * Returns the string containing the properties of + * <code>@Type</code> annotation. + */ + public void foo_1291847_2() { + } + + /** + * Checks generics javadoc. + * + * @param strings this is a List<String> + * @param test Map<String, List<String>> a map indexed on String of Lists of Strings. + */ + public void method20() { + } + + /** + * Checks HTML tags in javadoc. + * + * HTML no good tag + * <string>Tests</string> + * + */ + public void method21() { + } + + /** + * First sentence. + * < + * /a> + */ + void tagClosedInNextLine() { + + } + + /** + * Link to some page in two lines. + * <a + * href="someLink"/> + */ + void tagInTwoLines() { + + } + + /** + * This Javadoc contains unclosed tag. + * <code>unclosed 'code' tag<code> + */ + private void unclosedTag() {} + + void javadocLikeCommentInMethod() { + /** + * It pretends to be Javadoc without dot, but it's just comment in method + */ + final int i = 0; + } + + /** + * {@inheritDoc} + */ + private void inheritDoc() {} + + /** + * <p><b>Note:<b> it's unterminated tag.</p> + */ + private void unterminatedTag() {} + + /** + * Javadoc without dot + */ + public interface TestInterface { + /** + * Javadoc without dot + */ + void method(); + } + + static class TestStaticClass { + /** + * Javadoc without dot + */ + public int field; + } + + /** + * . + * @throws Exception if an error occurs + */ + void foo() throws Exception {} + + /** + * text / + * @throws Exception if an error occurs + */ + void bar() throws Exception {} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavadocStyleCheckHtmlComment.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavadocStyleCheckHtmlComment.java new file mode 100644 index 000000000..2544b2e69 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputJavadocStyleCheckHtmlComment.java @@ -0,0 +1,82 @@ +//////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +// Created: 2014 +//////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * Test input for the JavadocStyleCheck. This check is used to perform + * some additional Javadoc validations. + * + * @author Tobias Geyer + * @version 1.0 + */ +public class InputJavadocStyleCheckHtmlComment +{ + /** + * sometimes a tag starts + * <pre> + * somewhere and has a comment in the middle + * <!-- ignore this --> + * and ends afterwards + * </pre> + */ + private void method1() + { // JavadocStyle should not report any error for this method + } + + /** + * sometimes a tag starts + * <pre> + * somewhere and has a multiline comment in the middle + * <!-- ignore this + * spanning + * multiple lines --> + * and ends afterwards + * </pre> + */ + private void method2() + { // JavadocStyle should not report any error for this method + } + + /** + * sometimes a tag starts + * <pre> + * somewhere and has a multiline comment in the middle + * <!-- ignore this + * spanning + * multiple lines --></pre> + * and ends on the same line + */ + private void method3() + { // JavadocStyle should not report any error for this method + } + + /** + * sometimes a tag starts + * <pre> + * somewhere and has a comment in the middle + * <!-- ignore this --> with text following + * and ends afterwards + * </pre> + */ + private void method4() + { // JavadocStyle should not report any error for this method + } + + /** + * sometimes a tag starts + * <pre><!-- ignore this --></pre> + * and ends with a comment in the middle + */ + private void method5() + { // JavadocStyle should not report any error for this method + } + + /** + * Parameterized interface. + * @param <I> + */ + interface Interface<I> {} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputLoadErrors.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputLoadErrors.java new file mode 100644 index 000000000..475b9da8a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputLoadErrors.java @@ -0,0 +1,10 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +public class InputLoadErrors +{ + /** + * aasdf + * @throws InvalidExceptionName exception that cannot be loaded + */ + void method() {} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputNoJavadoc.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputNoJavadoc.java new file mode 100644 index 000000000..5f98674bf --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputNoJavadoc.java @@ -0,0 +1,115 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +public class InputNoJavadoc //comment test +{ + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + + protected class ProtectedInner { + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + } + + class PackageInner { + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + } + + private class PrivateInner { + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + } +} + +class PackageClass { + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + + public class PublicInner { + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + } + + protected class ProtectedInner { + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + } + + class PackageInner { + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + } + + private class PrivateInner { + public int i1; + protected int i2; + int i3; + private int i4; + + public void foo1() {} + protected void foo2() {} + void foo3() {} + private void foo4() {} + } + + class IgnoredName { + // ignore by name + private int logger; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputNonEmptyAtclauseDescriptionCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputNonEmptyAtclauseDescriptionCheck.java new file mode 100644 index 000000000..482011f10 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputNonEmptyAtclauseDescriptionCheck.java @@ -0,0 +1,99 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; +class InputNonEmptyAtclauseDescriptionCheck +{ + /** + * Some javadoc. + * @param a Some javadoc. + * @param b Some javadoc. + */ + public InputNonEmptyAtclauseDescriptionCheck(String a, int b) + { + + } + + /** + * Some javadoc. + * @param a Some javadoc. + * @deprecated Some javadoc. + */ + public InputNonEmptyAtclauseDescriptionCheck(String a) + { + + } + + /** + * Some javadoc. + * @param a + * @param b + * @param c + */ + public InputNonEmptyAtclauseDescriptionCheck(String a, int b, double c) + { + + } + + /** + * + * @param a + * @param e + * @deprecated + */ + public InputNonEmptyAtclauseDescriptionCheck(String a, boolean e) + { + + } + + /** + * Some javadoc + * @param a Some javadoc + * @param b Some javadoc + * @param c Some javadoc + * @return Some javadoc + * @throws Exception Some javadoc + * @deprecated Some javadoc + */ + public int foo1(String a, int b, double c) throws Exception + { + return 1; + } + + /** + * + * @param a Some javadoc + * @param b Some javadoc + * @param c Some javadoc + * @return Some javadoc + * @throws Exception Some javadoc + */ + public int foo2(String a, int b, double c) throws Exception + { + return 1; + } + + /** + * + * @param a + * @param b + * @param c + * @return + * @throws Exception + * @deprecated + */ + public int foo3(String a, int b, double c) throws Exception + { + return 1; + } + + /** + * + * @param a + * @param b + * @param c + * @return + * @throws Exception + */ + public int foo4(String a, int b, double c) throws Exception + { + return 1; + } +}
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputParsingErrors.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputParsingErrors.java new file mode 100644 index 000000000..c3b1bce8f --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputParsingErrors.java @@ -0,0 +1,12 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * <unclosedTag> + */ +class InputParsingErrors { + /** + * <img src="singletonTag"/></img> + */ + void singletonTag() { + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSingleLineJavadocCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSingleLineJavadocCheck.java new file mode 100644 index 000000000..c112fe1fc --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSingleLineJavadocCheck.java @@ -0,0 +1,51 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; +class Foo{ + + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} */ + void foo() {} + + /** + * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} + */ + void foo1() {} + + /** @throws CheckstyleException if an error occurs */ + void foo2() {} + + /** + * @throws CheckstyleException if an error occurs + */ + void foo3() {} + + /** An especially short bit of Javadoc. */ + void foo4() {} + + /** + * An especially short bit of Javadoc. + */ + void foo5() {} + + /** @inheritDoc */ + void foo6() {} + + /** {@inheritDoc} */ + void foo7() {} + + /** {@inheritDoc} {@code bar} */ + void foo8() {} + + /** {@inheritDoc} {@link #bar} */ + void foo9() {} + + /** @customTag */ + void bar() {} + + /** @ignoredCustomTag */ + void bar1() {} + + /** <h1> Some header </h1> {@inheritDoc} {@code bar1} text*/ + void bar2() {} + + /** @customTag <a> href="https://github.com/checkstyle/chestyle/"</a> text*/ + void bar3() {} +}
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSummaryJavadocCheckNoPeriod.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSummaryJavadocCheckNoPeriod.java new file mode 100644 index 000000000..ca33f49d6 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSummaryJavadocCheckNoPeriod.java @@ -0,0 +1,17 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +public class InputSummaryJavadocCheckNoPeriod +{ + /** + * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} + */ + void foo3() {} + + /** + * Blabla + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc */ + void foo5() {} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSummaryJavadocCheckPeriod.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSummaryJavadocCheckPeriod.java new file mode 100644 index 000000000..1334c3f5e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputSummaryJavadocCheckPeriod.java @@ -0,0 +1,22 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +public class InputSummaryJavadocCheckPeriod +{ + /** + * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} + */ + void foo3() {} + + /** + * Blabla + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc_ */ + void foo5() {} + + /** + * An especially short bit of Javadoc_ + */ + void foo6() {} +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputTestNumberFormatException.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputTestNumberFormatException.java new file mode 100644 index 000000000..770e06435 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputTestNumberFormatException.java @@ -0,0 +1,4 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** <ul><li>a' {@link EntityEntry} (by way of {@link #;}</li></ul> */ +class InputTestNumberFormatException{}
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputWriteTag.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputWriteTag.java new file mode 100644 index 000000000..c695d6c35 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputWriteTag.java @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +// Created: 2004 +//////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * Testing tag writing + * @author Daniel Grenner + * @incomplete This class needs more code... + * @doubletag first text + * @doubletag second text + * @emptytag + */ +class InputWriteTag +{ + /** + * @todo Add a constructor comment + */ + public InputWriteTag() + { + } + + public void method() + { + } + + /** + * @todo Add a comment + */ + public void anotherMethod() + { + } +}
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputWriteTag2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputWriteTag2.java new file mode 100644 index 000000000..728949017 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/InputWriteTag2.java @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +// Created: 2004 +//////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +/** + * @incomplete This enum needs more code... + */ +enum InputWriteTag2 { + /** + * @incomplete This enum constant needs more code... + */ + FOO; +} + +/** + * @incomplete This annotation needs more code... + */ +@interface InputWriteTag3 { + /** + * @incomplete This annotation field needs more code... + */ + int foo() default 0; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/Ignored.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/Ignored.java new file mode 100644 index 000000000..171af7438 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/Ignored.java @@ -0,0 +1,5 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.bothfiles; + +class Ignored +{ +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/package-info.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/package-info.java new file mode 100644 index 000000000..c8a22909e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/package-info.java @@ -0,0 +1 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.bothfiles; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/package.html b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/package.html new file mode 100644 index 000000000..bf65270fa --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/bothfiles/package.html @@ -0,0 +1 @@ +Ignored
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkghtml/Ignored.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkghtml/Ignored.java new file mode 100644 index 000000000..32995241c --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkghtml/Ignored.java @@ -0,0 +1,5 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.pkghtml; + +class Ignored +{ +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkghtml/package.html b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkghtml/package.html new file mode 100644 index 000000000..bf65270fa --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkghtml/package.html @@ -0,0 +1 @@ +Ignored
\ No newline at end of file diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/annotation/package-info.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/annotation/package-info.java new file mode 100644 index 000000000..b53186a12 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/annotation/package-info.java @@ -0,0 +1,12 @@ +/** + * This is a valid package documentation. <--- See the period after the + * first sentence. + * + * <p> + * hurray for javadocs in html + * <br> + * with a legacy non-closed br element + * </p> + */ +@Deprecated +package com.puppycrawl.tools.checkstyle.checks.javadoc.pkginfo.annotation; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/invalidformat/package-info.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/invalidformat/package-info.java new file mode 100644 index 000000000..e8d8b6d6c --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/invalidformat/package-info.java @@ -0,0 +1,4 @@ +/** + * blah blah + */ +package com.puppycrawl.tools.checkstyle.checks.javadoc.pkginfo.invalidformat; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/invalidinherit/package-info.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/invalidinherit/package-info.java new file mode 100644 index 000000000..9bc4ef5fc --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/invalidinherit/package-info.java @@ -0,0 +1,4 @@ +/** + * {@inheritDoc} Where are we inheriting from + */ +package com.puppycrawl.tools.checkstyle.checks.javadoc.pkginfo.invalidinherit; diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/valid/package-info.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/valid/package-info.java new file mode 100644 index 000000000..10a9f3190 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/pkginfo/valid/package-info.java @@ -0,0 +1,11 @@ +/** + * This is a valid package documentation. <--- See the period after the + * first sentence. + * + * <p> + * hurray for javadocs in html + * <br> + * with a legacy non-closed br element + * </p> + */ +package com.puppycrawl.tools.checkstyle.checks.javadoc.pkginfo.valid; |