While working on a Scala (2.12.4) project, I made a typo in my code and received an interesting output:
scala> new Get[Int]().inner() == null <console>:13: warning: comparing values of types Int and Null using `==' will always yield false new Get[Int]().inner() == null ^ res0: Boolean = true
While it was an absolutely useless construction, it still causes such misleading output as seen above:
class Get[T]() { val x: T = inner() def inner(): T = x } new Get[Int]().inner() == null
I would say that this is a minor Scala bug and probably is a side effect of some of value type + null
bugs and other bugs, bugs.
Share this
Previous story
← Creating dynamic tasks using Apache Airflow
Next story
Site reliability engineering - networking →
You May Also Like
These Related Stories
Google NEXT 2018: Google Cloud Platform and the Pythian partnership
Google NEXT 2018: Google Cloud Platform and the Pythian partnership
Jul 26, 2018
3
min read
High "cursor: pin S wait on X" waits?
High "cursor: pin S wait on X" waits?
Nov 17, 2015
1
min read
Microsoft Ignite 2018 special cloudscape podcast
![](https://www.pythian.com/hubfs/Imported_Blog_Media/Cloudscape-Episode-11.jpg)
Microsoft Ignite 2018 special cloudscape podcast
Oct 26, 2018
1
min read
No Comments Yet
Let us know what you think