score:7
At the bytecode level, final doesn't exist for local variables. In fact the concept of local variables itself doesn't really exist either. Marking a local variable as final is purely for compile time checking. Since the information isn't present in the classfile, the decompiler has no way of guessing it.
As for the second two questions, I'm not as familiar with CIL bytecode, but if I had to guess I'd say that there's no reason not to add override, and readonly
might have different semantics.
Edit: After looking through the CIL specification, here's what I've found.
The CIL equivalent of Java's final
flag for fields is initonly
, which appears to have the same semantics. It's not clear why the Scala compiler doesn't emit this. Perhaps they just didn't get around to it? Or perhaps the .net decompiler you used didn't reflect this. If you want to see what the compiler actually generates, you're best off looking at the bytecode directly.
Source: stackoverflow.com
Related Query
- Why does Scala compiler for .NET ignore the meaning of val?
- Why does the Scala compiler fail with missing parameter type for filter with JavaSparkContext?
- Why does the Scala compiler give "value registerKryoClasses is not a member of org.apache.spark.SparkConf" for Spark 1.4?
- Why does the Scala compiler disallow overloaded methods with default arguments?
- What special rules does the scala compiler have for the unit type within the type system
- Why does Scala choose the type 'Product' for 'for' expressions involving Either and value definitions
- Why does Scala evaluate the argument for a call-by-name parameter if the method is infix and right-associative?
- Why does the Scala compiler say that copy is not a member of my case class?
- Why does the compiler not look in the enclosing class for a method?
- Why does the Scala API have two strategies for organizing types?
- Why this simple Scala for comprehension does not execute the futures?
- Why does the Scala compiler error with "Synthetic tree contains nonsynthetic tree"?
- How does the scala compiler locate the positions for variance annotation
- Why does the Scala compiler differently treat these two code blocks?
- Why is the each iteration parameter val and not var in for loop in scala
- Why does the compiler infer incorrectly return type for Future.sequence declaration in function?
- Why does the Scala 2.11 compiler rename my private method?
- In Scala, why does a type annotation must follow for the function parameters ? Why does the compiler not infer the function parameter types?
- Why does the Scala compiler prefer to infer an argument of value null as Array[Char] instead of Object?
- Why does the Scala compiler recognize a generic type twice
- Why does surefire ignore test categories for Scala specs2 test when run with maven surefire?
- Why the type annotation is changing in Scala for one val
- When and why does the collect method fail for filtering Scala Collections by subtype?
- Why does the Scala Macro for case class copy fail?
- Why won't the Scala compiler apply tail call optimization unless a method is final?
- Why does Scala choose to have the types after the variable names?
- Why does Scala not have a return/unit function defined for each monad (in contrast to Haskell)?
- What does the 'optimise' scala compiler flag do?
- Why does Scala require a return type for recursive functions?
- Does SBT use the Fast Scala Compiler (fsc)?
More Query from same tag
- Gatling Check for logical operation like and & Or
- Having trouble converted a scala case class to json JObject when it contains an field of type Enumeration
- Custom akka distributed data type: should I extend ReplicatedDataSerialization?
- Netbeans scala plugin problems with ant
- How to prefer implicit in method scope over class scope?
- Embedding resources in scala.js
- Adding mapping to collections.mutable.Map fails when map is empty
- Low performance reduceByKey() in Spark
- how to disallow pattern matching on certain classes in scala
- How to hide scrollbars in the JavaFX WebView
- Akka: How to read config from within a non-actor object
- Test type of exception encapsulated in Failure() with scalatest
- Pretty print - XML single record in Spark / Scala
- Play Scala Json Missing Property vs Null
- Overriding variance in subtype
- How to debug actor timeout reactivemongo api cursor fails to send request logback hell
- Play framework 2.3 ActionBuilder composition issue
- Scala class lazy val variables strange behaviour with Spark
- Out of Memory Error Using SBT When Executing Lift Project
- error: not found: value sc
- Type mismatch required: Option[Any] => Option[Nothing]
- Idea IntelliJ 14.0.3 setup with play framework
- Scala Strategy Pattern Design Problems
- Why javaBigDecimal2bigDecimal implicit is not applicable?
- how to avoid spark NumberFormatException: null
- Play Framework: How to define a writable object in scala?
- sbt-assembly behaviour with jars and Spark
- Interoperability: Scala Case Classes + Java Pojos
- What is the first of the two type parameters of the function passed to a `collect` method in Scala?
- Two libraries bring in different version of the same dependency. How to import them both?