forked from spotbugs/spotbugs
-
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.
Fix FNs in CT_CONSTRUCTOR_THROW (spotbugs#2747)
* Add test * Fix FN in CT_CONSTRUCTOR_THROW * add back accidentally deleted test --------- Co-authored-by: Jeremy Landis <[email protected]>
- Loading branch information
1 parent
10422e8
commit 44dd360
Showing
5 changed files
with
54 additions
and
1 deletion.
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
15 changes: 15 additions & 0 deletions
15
spotbugsTestCases/src/java/constructorthrow/ConstructorThrowTest21.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,15 @@ | ||
package constructorthrow; | ||
|
||
/** | ||
* Calling a static function with not void or primitive return value from the constructor, | ||
* which throws an unchecked exception. | ||
*/ | ||
public class ConstructorThrowTest21 { | ||
public ConstructorThrowTest21() { | ||
ConstructorThrowTest21.test(); | ||
} | ||
|
||
private static String test() { | ||
throw new IllegalStateException(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
spotbugsTestCases/src/java/constructorthrow/ConstructorThrowTest22.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,17 @@ | ||
package constructorthrow; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Calling a static function with not void or primitive return value from the constructor, | ||
* which throws a checked exception. | ||
*/ | ||
public class ConstructorThrowTest22 { | ||
public ConstructorThrowTest22() throws IOException { | ||
ConstructorThrowTest22.test(); | ||
} | ||
|
||
private static String test() throws IOException { | ||
throw new IOException(); | ||
} | ||
} |