summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-11 10:25:34 -0700
committerPaul Phillips <paulp@improving.org>2012-05-11 10:26:29 -0700
commit807567230852bcadb98a91322bd348aae764801f (patch)
treee7efba8909d8c50b76a343192e6a0eb277c61527 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent2422b064e7a52c04dfb2239fc8e7b9ffbab24251 (diff)
downloadscala-807567230852bcadb98a91322bd348aae764801f.tar.gz
scala-807567230852bcadb98a91322bd348aae764801f.tar.bz2
scala-807567230852bcadb98a91322bd348aae764801f.zip
Recognize java enums as constants from source.
Fixed up one of the mismatches between how java source is modeled and how java bytecode is modeled. We should get the rest of them too. Closes SI-2764.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index ca4b1d3de8..e4b744dffc 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -567,7 +567,15 @@ trait Namers extends MethodSynthesis {
assignAndEnterFinishedSymbol(tree)
else
enterGetterSetter(tree)
+
+ // When java enums are read from bytecode, they are known to have
+ // constant types by the jvm flag and assigned accordingly. When
+ // they are read from source, the java parser marks them with the
+ // STABLE flag, and now we receive that signal.
+ if (tree.symbol hasAllFlags STABLE | JAVA)
+ tree.symbol setInfo ConstantType(Constant(tree.symbol))
}
+
def enterLazyVal(tree: ValDef, lazyAccessor: Symbol): TermSymbol = {
// If the owner is not a class, this is a lazy val from a method,
// with no associated field. It has an accessor with $lzy appended to its name and