-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONARJAVA-4186 Fix S2134 to handle correctly unknown types
- Loading branch information
1 parent
258bd1d
commit 01352b0
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
java-checks-test-sources/src/main/files/non-compiling/checks/ThreadOverridesRunCheck.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,16 @@ | ||
package checks; | ||
|
||
class ThreadOverridesRunCheck { | ||
void foo(Runnable r) { | ||
Thread t1 = new Thread(r) { // Compliant | ||
void doSomething() { /* do nothing */ } | ||
}; | ||
|
||
Thread t2 = new Thread(unknown) { | ||
void doSomething() { /* do nothing */ } | ||
}; | ||
|
||
Thread t3 = new Thread() { }; // Noncompliant | ||
} | ||
|
||
} |
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