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
Adding Columns with Default Values and Not Null in Oracle 11g
Adding Columns with Default Values and Not Null in Oracle 11g
Mar 20, 2009
2
min read
Applying Oracle 11.2 April 2010 PSU for Single-Instance ASM and DBMS
Applying Oracle 11.2 April 2010 PSU for Single-Instance ASM and DBMS
May 4, 2010
7
min read
Which Cassandra version should I use (2018)?
Which Cassandra version should I use (2018)?
Apr 5, 2018
2
min read
No Comments Yet
Let us know what you think