Issue #49. Added comments to existing test inputs.
This commit is contained in:
parent
59014fa753
commit
59aa66c3cc
|
|
@ -1,12 +1,12 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
|
||||
// suppress
|
||||
@SuppressWarnings({})
|
||||
public class AnnotationUseNoTrailingComma
|
||||
{
|
||||
@SuppressWarnings({"common"})
|
||||
public void foo() {
|
||||
|
||||
|
||||
|
||||
/** Suppress warnings */
|
||||
@SuppressWarnings({"common","foo"})
|
||||
Object o = new Object() {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class AnnotationUseNoTrailingComma
|
|||
enum P {
|
||||
|
||||
@Pooches2(tokens={Pooches2.class},other={1})
|
||||
L,
|
||||
L, // annotation in enum
|
||||
|
||||
@Test2(value={}, more={(false) ? "" : "unchecked"})
|
||||
Y;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.puppycrawl.tools.checkstyle.coding;
|
||||
public class InputClone
|
||||
{
|
||||
{/* class body */
|
||||
public InputClone() throws CloneNotSupportedException
|
||||
{
|
||||
{ //constructor body
|
||||
super.equals(new String());
|
||||
super.clone();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class InputDefaultComesLast
|
|||
switch (i) {
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
default: /**default is not last*/
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ public class InputEqualsAvoidNull {
|
|||
public boolean equals(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// antoher comment
|
||||
/**
|
||||
* methods that should get flagged
|
||||
* @return
|
||||
|
|
@ -15,7 +15,7 @@ public class InputEqualsAvoidNull {
|
|||
Object o = new Object();
|
||||
String s = "pizza";
|
||||
|
||||
o.equals("hot pizza");
|
||||
o.equals("hot pizza")/*comment test*/;
|
||||
|
||||
o.equals(s = "cold pizza");
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.puppycrawl.tools.checkstyle.coding;
|
|||
|
||||
public class InputExplicitInit {
|
||||
private int x = 0;
|
||||
private Object bar = null;
|
||||
private Object bar = /* comment test */null;
|
||||
private int y = 1;
|
||||
private long y1 = 1 - 1;
|
||||
private long y3;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.puppycrawl.tools.checkstyle.coding;
|
|||
public class InputFinalLocalVariable
|
||||
{
|
||||
private int m_ClassVariable = 0;
|
||||
|
||||
//static block
|
||||
static
|
||||
{
|
||||
int i, j = 0;
|
||||
|
|
@ -14,11 +14,11 @@ public class InputFinalLocalVariable
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** constructor */
|
||||
public InputFinalLocalVariable()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
// final variable
|
||||
final int j = 2;
|
||||
|
||||
int z;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public class InputFinalize
|
|||
super.finalize();
|
||||
}
|
||||
|
||||
public void finalize() throws Throwable
|
||||
public void finalize() /**comment test*/throws Throwable
|
||||
{
|
||||
super.finalize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding;
|
|||
|
||||
public class InputIllegalCatchCheck {
|
||||
public void foo() {
|
||||
try {
|
||||
try { //class names
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
|
|
@ -10,7 +10,7 @@ public class InputIllegalCatchCheck {
|
|||
}
|
||||
|
||||
public void bar() {
|
||||
try {
|
||||
try { /* fully qualified class names */
|
||||
} catch (java.lang.RuntimeException e) {
|
||||
} catch (java.lang.Exception e) {
|
||||
} catch (java.lang.Throwable e) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
package com.puppycrawl.tools.checkstyle.coding;
|
||||
|
||||
/** Input file */
|
||||
public class InputIllegalThrowsCheck {
|
||||
|
||||
public void method() throws NullPointerException
|
||||
{
|
||||
{ // no code
|
||||
}
|
||||
|
||||
public java.lang.Throwable methodOne() throws RuntimeException
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ package com.puppycrawl.tools.checkstyle.coding;
|
|||
import java.util.Hashtable;
|
||||
|
||||
public class InputIllegalType {
|
||||
private AbstractClass a = null;
|
||||
private NotAnAbstractClass b = null;
|
||||
private AbstractClass a = null; // comment
|
||||
private NotAnAbstractClass b = null; /*another comment*/
|
||||
|
||||
private com.puppycrawl.tools.checkstyle.coding.InputIllegalType.AbstractClass c = null;
|
||||
private com.puppycrawl.tools.checkstyle.coding.InputIllegalType.NotAnAbstractClass d = null;
|
||||
|
||||
private abstract class AbstractClass {}
|
||||
private abstract class AbstractClass {/*one more comment*/}
|
||||
|
||||
private class NotAnAbstractClass {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.coding;
|
||||
|
||||
public class InputMultipleStringLiterals
|
||||
{
|
||||
{ /*string literals*/
|
||||
String m = "StringContents";
|
||||
String m1 = "SingleString";
|
||||
String m2 = "DoubleString" + "DoubleString";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.coding;
|
||||
|
||||
/**Input*/
|
||||
public class InputParameterAssignment {
|
||||
int field;
|
||||
void foo1(int field) {
|
||||
|
|
@ -11,7 +11,7 @@ public class InputParameterAssignment {
|
|||
this.field++;
|
||||
field--;
|
||||
}
|
||||
|
||||
// without parameters
|
||||
void foo2() {
|
||||
field = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class InputRequireThis {
|
|||
int I = 0;
|
||||
private class I {}
|
||||
}
|
||||
|
||||
// enum
|
||||
enum MyEnum
|
||||
{
|
||||
A,
|
||||
|
|
@ -67,7 +67,7 @@ class Bug2123003 {
|
|||
@Rock(band = {(true) ? "GnR" : "Tool"})
|
||||
private String band;
|
||||
}
|
||||
|
||||
/* \m/(>.<)\m/ */
|
||||
@interface Rock {
|
||||
String[] band() default "Metallica";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.coding;
|
||||
|
||||
/* комментарий на русском */
|
||||
public class InputReturnCount
|
||||
{
|
||||
public boolean equals(Object obj) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class InputReturnFromCatchCheck {
|
|||
System.currentTimeMillis();
|
||||
} catch (Exception e) {
|
||||
if (System.currentTimeMillis() == 0) {
|
||||
return;
|
||||
return; // return from if statement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class InputReturnFromFinallyCheck {
|
|||
System.currentTimeMillis();
|
||||
} finally {
|
||||
if (System.currentTimeMillis() == 0) {
|
||||
return;
|
||||
return; // return from if statement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ public class InputUnnecessaryParentheses {
|
|||
int x = 0;
|
||||
for (int i = (0+1); ((i) < (6+6)); i += (1+0)) {
|
||||
x += (i + 100);
|
||||
(x) += (i + 100);
|
||||
(x) += (i + 100/**comment test*/);
|
||||
x = (x + i + 100);
|
||||
(x) = (x + i + 100);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.design;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/*input file*/
|
||||
public abstract class HideUtilityClassContructor3041574_1 implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.design;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/*input file*/
|
||||
public class HideUtilityClassContructor3041574_2 implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class InputMutableException {
|
|||
public class FooExceptionThisIsNot {
|
||||
private final int _finalErrorCode;
|
||||
private int _errorCode = 1;
|
||||
|
||||
/** constructor */
|
||||
public FooExceptionThisIsNot() {
|
||||
_finalErrorCode = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedList;
|
||||
|
||||
public class A
|
||||
{
|
||||
{ /*constants*/
|
||||
public static final int X = 0;
|
||||
public static final int Y = 1;
|
||||
public static final int Z = 2;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedList;
|
||||
|
||||
public class B
|
||||
{
|
||||
{ /*constants*/
|
||||
public static final int Y = 1;
|
||||
public static final int X = 0;
|
||||
public static final int Z = 2;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.puppycrawl.tools.checkstyle.imports;
|
|||
import java.net.URL;
|
||||
|
||||
public class InputImportBug {
|
||||
|
||||
//same as a class name
|
||||
private static String URL = "This is a String object";
|
||||
|
||||
public InputImportBug() throws Exception {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import java.awt.Button;
|
|||
import java.awt.Dialog;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/***comment test***/
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package com.puppycrawl.tools.checkstyle.imports;
|
|||
|
||||
import com.puppycrawl.tools.checkstyle.imports.InputImportOrder_Above;
|
||||
import javax.crypto.BadPaddingException;
|
||||
import java.util.List;
|
||||
import java.util.List; //comment test
|
||||
import javax.crypto.Cipher;
|
||||
|
||||
public class InputImportOrder_Wildcard {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.puppycrawl.tools.checkstyle.javadoc;
|
||||
|
||||
public class InputNoJavadoc
|
||||
public class InputNoJavadoc //comment test
|
||||
{
|
||||
public int i1;
|
||||
protected int i2;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package com.puppycrawl.tools.checkstyle.metrics;
|
||||
|
||||
public class BooleanExpressionComplexityCheckTestInput {
|
||||
private boolean _a = false;
|
||||
private boolean _a = false; //boolean field
|
||||
private boolean _b = false;
|
||||
private boolean _c = false;
|
||||
private boolean _d = false;
|
||||
|
||||
/*public method*/
|
||||
public void foo() {
|
||||
if (_a && _b || _c ^ _d) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import javax.naming.*;
|
|||
import java.util.*;
|
||||
|
||||
public class ClassCouplingCheckTestInput {
|
||||
private class InnerClass {
|
||||
private class InnerClass { //singleline comment
|
||||
public List _list = new ArrayList();
|
||||
}
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ public class ClassCouplingCheckTestInput {
|
|||
public String _string = "";
|
||||
}
|
||||
|
||||
public Set _set = new HashSet();
|
||||
public Set _set = /*block comment*/new HashSet();
|
||||
public Map _map = new HashMap();
|
||||
public String _string = "";
|
||||
public int[] _intArray = new int[0];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ public class InputMemberName
|
|||
{
|
||||
public int mPublic;
|
||||
protected int mProtected;
|
||||
int mPackage;
|
||||
int mPackage;//comment
|
||||
private int mPrivate;
|
||||
|
||||
public int _public;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class InputMethodNameExtra
|
|||
new More.ViewChangeHistoryBaseAction.ChangeHistoryDisplayName(agencyName)
|
||||
{
|
||||
String getDisplayName()
|
||||
{
|
||||
{//comment
|
||||
return getPreviousName(TypeOfName.AGENCY_NAME);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.puppycrawl.tools.checkstyle.naming;
|
|||
class inputHeaderClass {
|
||||
|
||||
public interface inputHeaderInterface {};
|
||||
|
||||
//comment
|
||||
public enum inputHeaderEnum { one, two };
|
||||
|
||||
public @interface inputHeaderAnnotation {};
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ public class InputTypeParameterName <t>
|
|||
class Other <foo extends Serializable & Cloneable> {
|
||||
|
||||
foo getOne() {
|
||||
return null;
|
||||
return null;//comment
|
||||
}
|
||||
|
||||
<Tfo$o2T extends foo> Tfo$o2T getTwo(Tfo$o2T a) {
|
||||
<Tfo$o2T extends foo> /*comment*/Tfo$o2T getTwo(Tfo$o2T a) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class InputGenericWhitespaceCheck implements Comparable<InputGenericWhitespaceCh
|
|||
List < Integer > a = new ArrayList < Integer > ();
|
||||
List < List < Integer > > b = new ArrayList < List < Integer > > ();
|
||||
}
|
||||
|
||||
//always 0
|
||||
public int compareTo(InputGenericWhitespaceCheck aObject)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -51,7 +51,7 @@ class InputGenericWhitespaceCheck implements Comparable<InputGenericWhitespaceCh
|
|||
{
|
||||
}
|
||||
|
||||
public interface IntEnum {
|
||||
public interface IntEnum { /*inner enum*/
|
||||
}
|
||||
|
||||
public static class IntEnumValueType<E extends Enum<E> & IntEnum> {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ public class InputWhitespaceAround
|
|||
{
|
||||
protected InputWhitespaceAround ( int i )
|
||||
{
|
||||
this ();
|
||||
this (); //whitespace
|
||||
toString ();
|
||||
}
|
||||
protected InputWhitespaceAround ()
|
||||
|
|
|
|||
Loading…
Reference in New Issue