forked from checkstyle/checkstyle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#4141: Split and Organize Checkstyle inputs by Test f…
…or ConstantName
- Loading branch information
Showing
7 changed files
with
407 additions
and
18 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
11 changes: 0 additions & 11 deletions
11
...sources/com/puppycrawl/tools/checkstyle/checks/naming/InputStaticModifierInInterface.java
This file was deleted.
Oops, something went wrong.
79 changes: 79 additions & 0 deletions
79
...es/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameInner.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,79 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// Test case file for checkstyle. | ||
// Created: 2001 | ||
//////////////////////////////////////////////////////////////////////////////// | ||
package com.puppycrawl.tools.checkstyle.checks.naming.constantname; | ||
|
||
/** | ||
* Tests having inner types | ||
* @author Oliver Burn | ||
**/ | ||
class InputConstantNameInner | ||
{ | ||
// Ignore - two errors | ||
class InnerInner2 | ||
{ | ||
// Ignore | ||
public int fData; | ||
} | ||
|
||
// Ignore - 2 errors | ||
interface InnerInterface2 | ||
{ | ||
// Ignore - should be all upper case | ||
String data = "zxzc"; | ||
|
||
// Ignore | ||
class InnerInterfaceInnerClass | ||
{ | ||
// Ignore - need Javadoc and made private | ||
public int rData; | ||
|
||
/** needs to be made private unless allowProtected. */ | ||
protected int protectedVariable; | ||
|
||
/** needs to be made private unless allowPackage. */ | ||
int packageVariable; | ||
} | ||
} | ||
|
||
/** demonstrate bug in handling static final **/ | ||
protected static Object sWeird = new Object(); | ||
/** demonstrate bug in handling static final **/ | ||
static Object sWeird2 = new Object(); | ||
|
||
/** demonstrate bug in local final variable */ | ||
public interface Inter | ||
{ | ||
} | ||
|
||
public static void main() | ||
{ | ||
Inter m = new Inter() | ||
{ | ||
private static final int CDS = 1; | ||
|
||
private int ABC; | ||
}; | ||
} | ||
|
||
/** annotation field incorrectly named. */ | ||
@interface InnerAnnotation | ||
{ | ||
/** Ignore - should be all upper case. */ | ||
String data = "zxzc"; | ||
} | ||
|
||
/** enum with public member variable */ | ||
enum InnerEnum | ||
{ | ||
/** First constant */ | ||
A, | ||
|
||
/** Second constant */ | ||
B; | ||
|
||
/** Should be private */ | ||
public int someValue; | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
...ppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameMemberExtended.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,83 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.naming.constantname; | ||
|
||
|
||
|
||
|
||
public class InputConstantNameMemberExtended | ||
{ | ||
public int mPublic; | ||
protected int mProtected; | ||
int mPackage; | ||
private int mPrivate; | ||
|
||
public int _public; | ||
protected int _protected; | ||
int _package; | ||
private int _private; | ||
|
||
class Inner { | ||
public int mPublic; | ||
protected int mProtected; | ||
int mPackage; | ||
private int mPrivate; | ||
|
||
public int _public; | ||
protected int _protected; | ||
int _package; | ||
private int _private; | ||
} | ||
|
||
Inner anon = new Inner() { | ||
public int mPublic; | ||
protected int mProtected; | ||
int mPackage; | ||
private int mPrivate; | ||
|
||
public int _public; | ||
protected int _protected; | ||
int _package; | ||
private int _private; | ||
}; | ||
} | ||
|
||
interface In | ||
{ | ||
public int mPublic = 0; | ||
int mProtected = 0; | ||
int mPackage = 0; | ||
int mPrivate = 0; | ||
|
||
public int _public = 0; | ||
int _protected = 0; | ||
int _package = 0; | ||
int _private = 0; | ||
} | ||
|
||
enum Direction { | ||
|
||
NORTH(1), | ||
SOUTH(-1), | ||
EAST(-2), | ||
WEST(2); | ||
|
||
public int mPublic = 0; | ||
int mProtected = 0; | ||
int mPackage = 0; | ||
int mPrivate = 0; | ||
|
||
public int _public = 0; | ||
int _protected = 0; | ||
int _package = 0; | ||
int _private = 0; | ||
|
||
Direction(int code){ | ||
this.code=code; | ||
} | ||
protected int code; | ||
public int getCode() { | ||
return this.code; | ||
} | ||
static Direction getOppositeDirection(Direction d){ | ||
return null; | ||
} | ||
} |
Oops, something went wrong.