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

FieldMirror.set should allow setting vals #7464

Closed
scabug opened this issue May 8, 2013 · 2 comments
Closed

FieldMirror.set should allow setting vals #7464

scabug opened this issue May 8, 2013 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented May 8, 2013

Currently it says something like this:

[info] - main *** FAILED ***
[info]   scala.ScalaReflectionException: cannot set an immutable field x
[info]   at scala.reflect.runtime.JavaMirrors$JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$ErrorSetImmutableField(JavaMirrors.scala:136)
[info]   at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaFieldMirror.set(JavaMirrors.scala:285)
[info]   at scala.pickling.InterpretedUnpicklerRuntime$$anon$2$$anonfun$unpickle$1.apply(Runtime.scala:135)
[info]   at scala.pickling.InterpretedUnpicklerRuntime$$anon$2$$anonfun$unpickle$1.apply(Runtime.scala:132)
[info]   at scala.collection.immutable.List.foreach(List.scala:318)
[info]   at scala.pickling.InterpretedUnpicklerRuntime$$anon$2.unpickle(Runtime.scala:132)
[info]   at scala.pickling.singleton.hierarchy.SingletonHierarchyTest$$anonfun$1.test$1(singleton-hierarchy.scala:17)
[info]   at scala.pickling.singleton.hierarchy.SingletonHierarchyTest$$anonfun$1.apply$mcV$sp(singleton-hierarchy.scala:19)
[info]   at scala.pickling.singleton.hierarchy.SingletonHierarchyTest$$anonfun$1.apply(singleton-hierarchy.scala:12)
[info]   at scala.pickling.singleton.hierarchy.SingletonHierarchyTest$$anonfun$1.apply(singleton-hierarchy.scala:12)

At first setting up that sentinel seemed like a good idea, but on a second thought this only brings annoyance. After all, that's reflection, a tool designed to circumvent all rules.

@scabug
Copy link
Author

scabug commented May 8, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7464?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0, 2.10.1

@scabug
Copy link
Author

scabug commented May 8, 2013

@xeno-by said:
scala/scala#2504

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