forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#14937: Migrated section 7.3.1 Exception: self-explan…
…atory methods to chapter wise testing
- Loading branch information
Showing
7 changed files
with
219 additions
and
284 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
50 changes: 0 additions & 50 deletions
50
...ogle/checkstyle/test/chapter7javadoc/rule731selfexplanatory/MissingJavadocMethodTest.java
This file was deleted.
Oops, something went wrong.
206 changes: 206 additions & 0 deletions
206
...est/chapter7javadoc/rule731selfexplanatory/InputJavadocMethodAndMissingJavadocMethod.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,206 @@ | ||
package com.google.checkstyle.test.chapter7javadoc.rule731selfexplanatory; | ||
|
||
/** | ||
* The following is a bad tag. | ||
* @mytag Hello | ||
*/ | ||
public class InputJavadocMethodAndMissingJavadocMethod extends OverrideClasss | ||
{ | ||
//with comments | ||
|
||
/** | ||
* Some javadoc. | ||
* @return Some javadoc. | ||
*/ | ||
int foo1() | ||
{ | ||
return 1; | ||
} | ||
|
||
/** | ||
* Some javadoc. | ||
* | ||
*/ | ||
String foo2() | ||
{ | ||
return "Fooooooooooooooo" | ||
+ "ooooo" | ||
+ "ooo"; | ||
} | ||
|
||
/** | ||
* Some javadoc. | ||
*/ | ||
void foo3() | ||
{ | ||
foo2(); | ||
} | ||
|
||
/** | ||
* Some javadoc. | ||
*/ | ||
void foo4() {} | ||
|
||
//without comments | ||
|
||
int foo5() | ||
{ | ||
return 1; | ||
} | ||
|
||
String foo6() | ||
{ | ||
return "Fooooooooooooooo" | ||
+ "oooooooo"; | ||
} | ||
|
||
// violation below 'Missing a Javadoc comment.' | ||
public String foo7() | ||
{ | ||
return "Fooooooooooooooo" | ||
+ "ooooo" | ||
+ "ooo"; | ||
} | ||
|
||
// ok, private method does not require javadoc | ||
private String correct(String param) { | ||
return "Fooooooooooooooo" | ||
+ "ooooo" | ||
+ "ooo" | ||
+ param; | ||
} | ||
|
||
// ok, default scope method does not require javadoc | ||
String defaultScope(int x) { | ||
return "Fooooooooooooooo" | ||
+ "ooooo" | ||
+ "ooo" | ||
+ x; | ||
} | ||
|
||
// ok, methods smaller than 2 lines does not require javadoc | ||
public void smallMethod1() { | ||
foo2(); | ||
} | ||
|
||
// ok, methods smaller than 2 lines does not require javadoc | ||
protected void smallMethod2() { | ||
foo2(); | ||
} | ||
|
||
/** | ||
* Ok, missing params tags and return tags in javadoc are allowed | ||
*/ | ||
public String testingParams(String param1, String param2) { | ||
return "Fooooooooooooooo" | ||
+ "ooooo" | ||
+ "ooo" | ||
+ param1 | ||
+ param2; | ||
} | ||
|
||
/** | ||
* Ok, missing params tags and return tags in javadoc are allowed | ||
*/ | ||
protected String testingParams(int param1, int param2) { | ||
return "Fooooooooooooooo" | ||
+ "ooooo" | ||
+ "ooo" | ||
+ param1 | ||
+ param2; | ||
} | ||
|
||
|
||
// violation below 'Missing a Javadoc comment.' | ||
public InputJavadocMethodAndMissingJavadocMethod() { | ||
foo2(); | ||
foo91(); | ||
foo4(); | ||
foo3(); | ||
} | ||
|
||
// ok, private constructor does not require javadoc | ||
private InputJavadocMethodAndMissingJavadocMethod(float x) { | ||
foo2(); | ||
foo91(); | ||
foo4(); | ||
foo3(); | ||
} | ||
|
||
// ok, default scope constructor does not require javadoc | ||
InputJavadocMethodAndMissingJavadocMethod(int a) { | ||
foo2(); | ||
foo91(); | ||
foo4(); | ||
foo3(); | ||
} | ||
|
||
// ok, constructors smaller than 2 lines does not require javadoc | ||
public InputJavadocMethodAndMissingJavadocMethod(int a, int b) { | ||
foo2(); | ||
} | ||
|
||
// ok, constructors smaller than 2 lines does not require javadoc | ||
private InputJavadocMethodAndMissingJavadocMethod(float a, float b) { | ||
foo2(); | ||
} | ||
|
||
/** | ||
* Ok, missing params tags in javadoc are allowed | ||
*/ | ||
public InputJavadocMethodAndMissingJavadocMethod(double a, double b) { | ||
foo2(); | ||
foo91(); | ||
foo5(); | ||
foo82(); | ||
} | ||
|
||
void foo81() | ||
{ | ||
foo2(); | ||
} | ||
|
||
void foo82() { | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
void paramviolation(String param) { | ||
foo2(); | ||
} | ||
|
||
@MyAnnotationn | ||
String foo91() | ||
{ | ||
return "Fooooooooooooooo" | ||
+ "ooooo" | ||
+ "ooo"; | ||
} | ||
|
||
@Override | ||
public String foo92() | ||
{ | ||
return "Fooooo" | ||
+ "ooo" | ||
+ "ooooooo" | ||
+ "ooooo" | ||
+ "ooo"; | ||
} | ||
} | ||
|
||
|
||
class OverrideClasss { | ||
|
||
public String foo92() | ||
{ | ||
return "Fooooo" | ||
+ "ooo" | ||
+ "ooooooo" | ||
+ "ooooo" | ||
+ "ooo"; | ||
} | ||
} | ||
@interface MyAnnotationn {} |
Oops, something went wrong.