Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
293 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...kstyle/checks/design/designforextension/InputDesignForExtensionRequiredJavadocPhrase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.design.designforextension; | ||
|
||
/* Config: | ||
* requiredJavadocPhrase = "This implementation" | ||
* | ||
*/ | ||
public class InputDesignForExtensionRequiredJavadocPhrase { | ||
|
||
/** | ||
* This implementation is for <p> some html code | ||
* </p>. | ||
* | ||
* @param a | ||
* @param b | ||
* @return sum | ||
*/ | ||
public int foo1(int a, int b) {return a + b;} // ok, required comment pattern in javadoc | ||
|
||
/** | ||
* This implementation is required for ... | ||
* | ||
* @param a | ||
* @param b | ||
* @return sum | ||
*/ | ||
public int foo2(int a, int b) {return a + b;} // ok, required comment pattern in javadoc | ||
|
||
/** This implementation is for ... */ | ||
public int foo3(int a, int b) {return a + b;} // ok, required comment pattern in javadoc | ||
|
||
/** | ||
* This implementation ... | ||
*/ | ||
public int foo4(int a, int b) {return a + b;} // ok, required comment pattern in javadoc | ||
|
||
/** This method can safely be overridden. */ | ||
public int foo5(int a, int b) {return a + b;} // violation | ||
|
||
public final int foo6(int a) {return a - 2;} // ok, final | ||
|
||
protected final int foo7(int a) {return a - 2;} // ok, final | ||
|
||
/** */ | ||
public int foo8(int a) {return a - 2;} // violation | ||
|
||
// This implementation | ||
public int foo9(int a, int b) {return a + b;} // violation, not javadoc | ||
|
||
@Deprecated | ||
protected final int foo10(int a) {return a - 2;} // ok, deprecated | ||
|
||
/** | ||
* This implementation is for <p> some html code | ||
* </p>. | ||
* | ||
* @param a | ||
* @param b | ||
* @return sum | ||
*/ | ||
public int foo11(int a, int b) {return a + b;} // ok, required comment pattern in javadoc | ||
|
||
/**This method can safely be overridden. */ | ||
public int foo12(int a, int b) { // violation | ||
return a + b; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ecks/design/designforextension/InputDesignForExtensionRequiredJavadocPhraseMultiLine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.design.designforextension; | ||
|
||
/* Config: | ||
* requiredJavadocPhrase = "This[\s\S]*implementation" | ||
* | ||
*/ | ||
public class InputDesignForExtensionRequiredJavadocPhraseMultiLine { | ||
/** | ||
* This | ||
* implementation .. | ||
*/ | ||
public int foo1(int a, int b) { | ||
return a * b; | ||
} | ||
|
||
/** | ||
* This method can safely be overridden. | ||
*/ | ||
public int foo2(int a, int b) { // violation | ||
return a + b; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters