-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning for synchronized calls in value classes
Co-Authored-By: Yoonjae Jeon <[email protected]>
- Loading branch information
Showing
3 changed files
with
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- [E181] Potential Issue Warning: tests/warn/i17493.scala:3:11 -------------------------------------------------------- | ||
3 | def g = synchronized { println("hello, world") } // warn | ||
| ^^^^^^^^^^^^ | ||
| Suspicious top-level unqualified call to synchronized | ||
|--------------------------------------------------------------------------------------------------------------------- | ||
| Explanation (enabled by `-explain`) | ||
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
| Top-level unqualified calls to AnyRef or Any methods such as synchronized are | ||
| resolved to calls on Predef or on imported methods. This might not be what | ||
| you intended. | ||
--------------------------------------------------------------------------------------------------------------------- |
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,4 @@ | ||
//> using options -explain | ||
class A(val s: String) extends AnyVal { | ||
def g = synchronized { println("hello, world") } // warn | ||
} |