summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/Enumeration.scala2
-rw-r--r--test/files/run/t5147.check1
-rw-r--r--test/files/run/t5147.scala9
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)
+ }
+}