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

Exception in manifest[Array[Unit]] #8183

Closed
scabug opened this issue Jan 27, 2014 · 2 comments
Closed

Exception in manifest[Array[Unit]] #8183

scabug opened this issue Jan 27, 2014 · 2 comments
Assignees

Comments

@scabug
Copy link

scabug commented Jan 27, 2014

manifest[Array[Unit]] throws an exception:

scala> manifest[Array[Unit]]
java.lang.IllegalArgumentException
at java.lang.reflect.Array.newArray(Native Method)
at java.lang.reflect.Array.newInstance(Array.java:70)
at scala.reflect.ClassManifestDeprecatedApis$class.arrayClass(ClassManifestDeprecatedApis.scala:89)
at scala.reflect.AnyValManifest.arrayClass(Manifest.scala:66)
at scala.reflect.Manifest$class.arrayManifest(Manifest.scala:48)
at scala.reflect.AnyValManifest.arrayManifest(Manifest.scala:66)
at scala.reflect.ManifestFactory$.arrayType(Manifest.scala:245)
at .(:8)
at .()
at .(:7)
at .()
at $print()

Debugging shows that it tries to call Array.newArray(Void.TYPE), which obviously fails. This may be minor, since manifests are semi-deprecated, but still unpleasant.

@scabug
Copy link
Author

scabug commented Jan 27, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8183?orig=1
Reporter: @alexeyr
Affected Versions: 2.10.3

@scabug
Copy link
Author

scabug commented Jan 27, 2014

@retronym said:
ClassTag gets this right:

scala> reflect.classTag[Array[Unit]].erasure
warning: there were 1 deprecation warning(s); re-run with -deprecation for details
res59: Class[_] = class [Lscala.runtime.BoxedUnit;

ClassTag is already safe to use, unlike TypeTag which invokes the not-yet-thread-safe runtime reflection library.

Marking as wont-fix, as we don't plan to touch manifests any more.

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