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#10385: Update inputs for MutableExceptionCheckTest
- Loading branch information
1 parent
08d8769
commit 175c5ed
Showing
7 changed files
with
170 additions
and
33 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
64 changes: 64 additions & 0 deletions
64
...om/puppycrawl/tools/checkstyle/checks/design/mutableexception/InputMutableException2.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,64 @@ | ||
/* | ||
MutableException | ||
format = (default)^.*Exception$|^.*Error$|^.*Throwable$ | ||
extendedClassNameFormat = (default)^.*Exception$|^.*Error$|^.*Throwable$ | ||
*/ | ||
|
||
package com.puppycrawl.tools.checkstyle.checks.design.mutableexception; | ||
|
||
public class InputMutableException2 { | ||
public class FooException extends Exception { | ||
private final int finalErrorCode; | ||
private int errorCode = 1; // violation | ||
|
||
public FooException() { | ||
finalErrorCode = 1; | ||
} | ||
|
||
public class FooExceptionThisIsNot extends RuntimeException { | ||
private final int finalErrorCode; | ||
private int errorCode = 1; | ||
/** constructor */ | ||
public FooExceptionThisIsNot() { | ||
finalErrorCode = 1; | ||
} | ||
} | ||
} | ||
|
||
public class BarError extends Throwable { | ||
private int errorCode; // violation | ||
} | ||
|
||
public class BazDoesNotExtendError { | ||
private int errorCode; | ||
} | ||
|
||
public class CustomProblem extends ThreadDeath { | ||
private int errorCode; | ||
|
||
public class CustomFailure extends ThreadDeath { | ||
private int errorCode; | ||
public void someMethod() { | ||
if(true) { | ||
final int i = 0; | ||
} | ||
} | ||
} | ||
} | ||
|
||
class CustomException extends Exception {} | ||
|
||
class CustomMutableException extends Exception { | ||
int errorCode; // violation | ||
} | ||
|
||
class ExampleException extends Exception { | ||
public void test() { | ||
Throwable cause = super.getCause(); | ||
if (!(cause instanceof java.io.IOException)) | ||
throw new IllegalStateException("Test"); | ||
} | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...om/puppycrawl/tools/checkstyle/checks/design/mutableexception/InputMutableException3.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,64 @@ | ||
/* | ||
MutableException | ||
format = ^.*Failure$ | ||
extendedClassNameFormat = ^.*ThreadDeath$ | ||
*/ | ||
|
||
package com.puppycrawl.tools.checkstyle.checks.design.mutableexception; | ||
|
||
public class InputMutableException3 { | ||
public class FooException extends Exception { | ||
private final int finalErrorCode; | ||
private int errorCode = 1; | ||
|
||
public FooException() { | ||
finalErrorCode = 1; | ||
} | ||
|
||
public class FooExceptionThisIsNot extends RuntimeException { | ||
private final int finalErrorCode; | ||
private int errorCode = 1; | ||
/** constructor */ | ||
public FooExceptionThisIsNot() { | ||
finalErrorCode = 1; | ||
} | ||
} | ||
} | ||
|
||
public class BarError extends Throwable { | ||
private int errorCode; | ||
} | ||
|
||
public class BazDoesNotExtendError { | ||
private int errorCode; | ||
} | ||
|
||
public class CustomProblem extends ThreadDeath { | ||
private int errorCode; | ||
|
||
public class CustomFailure extends ThreadDeath { | ||
private int errorCode; // violation | ||
public void someMethod() { | ||
if(true) { | ||
final int i = 0; | ||
} | ||
} | ||
} | ||
} | ||
|
||
class CustomException extends Exception {} | ||
|
||
class CustomMutableException extends Exception { | ||
int errorCode; | ||
} | ||
|
||
class ExampleException extends Exception { | ||
public void test() { | ||
Throwable cause = super.getCause(); | ||
if (!(cause instanceof java.io.IOException)) | ||
throw new IllegalStateException("Test"); | ||
} | ||
} | ||
} |
11 changes: 10 additions & 1 deletion
11
...ckstyle/checks/design/mutableexception/InputMutableExceptionClassExtendsGenericClass.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
12 changes: 10 additions & 2 deletions
12
.../tools/checkstyle/checks/design/mutableexception/InputMutableExceptionMultipleInputs.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