Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null.asInstanceOf[T] doesn't follow spec #1245

Closed
scabug opened this issue Aug 19, 2008 · 4 comments
Closed

null.asInstanceOf[T] doesn't follow spec #1245

scabug opened this issue Aug 19, 2008 · 4 comments
Assignees

Comments

@scabug
Copy link

scabug commented Aug 19, 2008

Using version 2.7.1.r15804-b20080816212059.

object T5 extends Application {
  val i : Int = null.asInstanceOf[Int]
  println(i)
}

Expected: a NullPointerException, as specified in section 6.3 of the spec (as of 2008-05-05), since Int doesn't conform to AnyRef.

Got: output "0".

@scabug
Copy link
Author

scabug commented Aug 19, 2008

Imported From: https://issues.scala-lang.org/browse/SI-1245?orig=1
Reporter: Lauri Alanko (lealanko)
See #4437

@scabug
Copy link
Author

scabug commented Oct 25, 2008

@DRMacIver said:
See #602 and the related #668 for details as to why this is there.

@scabug
Copy link
Author

scabug commented Mar 4, 2011

@soc said:
Still exists on 2.9.0.r24324-b20110222020042.

@scabug
Copy link
Author

scabug commented Apr 7, 2011

@soc said:
#4437 seems to be the main focus of activity and handles the whole variety of the problems with asInstanceOf, so I guess this could be closed as a duplicate of #4437 before it is forgotten completely?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants