You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importscala.reflect._classParam[T](valx:String) extendsAnyValvalx= classTag[Param[_]].newArray(10)
x(0) =newParam[Int]("foo")
// java.lang.ClassCastException: Param cannot be cast to java.lang.String
This shouldn't throw a ClassCastException. The issue is caused by the fact that classTag[Param\[_]] gives a ClassTag of String.
Strangely, the test run/valueclasses-classtag-existential does specifically check for this behavior.
Note that classTag[Param[X]] where X is some class, gives a ClassTag of Param (tested in run/valueclasses-classtag-generic). So this happens only with existential types.
The text was updated successfully, but these errors were encountered:
Consider the following:
This shouldn't throw a
ClassCastException
. The issue is caused by the fact thatclassTag[Param\[_]]
gives aClassTag
ofString
.Strangely, the test
run/valueclasses-classtag-existential
does specifically check for this behavior.Note that
classTag[Param[X]]
whereX
is some class, gives aClassTag
ofParam
(tested inrun/valueclasses-classtag-generic
). So this happens only with existential types.The text was updated successfully, but these errors were encountered: