diff options
author | Paul Phillips <paulp@improving.org> | 2011-11-04 21:09:17 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-11-04 21:09:17 +0000 |
commit | 1d4f2d4aa3066d2b3c8b7ecb1ad29d1610026b00 (patch) | |
tree | beaaf74ff79d39c36bb38dae6d7126f553dbd349 | |
parent | 508101158c87446410606100819b977b379a6620 (diff) | |
download | scala-1d4f2d4aa3066d2b3c8b7ecb1ad29d1610026b00.tar.gz scala-1d4f2d4aa3066d2b3c8b7ecb1ad29d1610026b00.tar.bz2 scala-1d4f2d4aa3066d2b3c8b7ecb1ad29d1610026b00.zip |
Fix for Enumeration.
Closes SI-5147.
-rw-r--r-- | src/library/scala/Enumeration.scala | 2 | ||||
-rw-r--r-- | test/files/run/t5147.check | 1 | ||||
-rw-r--r-- | test/files/run/t5147.scala | 9 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala index 65a5cfb55a..9d21822309 100644 --- a/src/library/scala/Enumeration.scala +++ b/src/library/scala/Enumeration.scala @@ -161,7 +161,7 @@ abstract class Enumeration(initial: Int, names: String*) extends Serializable { protected final def Value(i: Int, name: String): Value = new Val(i, name) private def populateNameMap() { - val fields = getClass.getDeclaredFields + val fields = getClass.getFields def isValDef(m: JMethod) = fields exists (fd => fd.getName == m.getName && fd.getType == m.getReturnType) // The list of possible Value methods: 0-args which return a conforming type diff --git a/test/files/run/t5147.check b/test/files/run/t5147.check new file mode 100644 index 0000000000..f70f10e4db --- /dev/null +++ b/test/files/run/t5147.check @@ -0,0 +1 @@ +A diff --git a/test/files/run/t5147.scala b/test/files/run/t5147.scala new file mode 100644 index 0000000000..6261336f74 --- /dev/null +++ b/test/files/run/t5147.scala @@ -0,0 +1,9 @@ +class Test extends Enumeration { + val A = Value +} +object Test extends Test +object Test5147 { + def main(args: Array[String]): Unit = { + println(Test.A) + } +} |