From 13d642151f0ad834fad3e8868608d5af5b4372bc Mon Sep 17 00:00:00 2001 From: Philipp Haller Date: Tue, 3 Nov 2009 17:00:06 +0000 Subject: Fix and test for #2527 --- src/library/scala/Enumeration.scala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala index 8d38f71f79..d5153bd50d 100644 --- a/src/library/scala/Enumeration.scala +++ b/src/library/scala/Enumeration.scala @@ -121,9 +121,14 @@ abstract class Enumeration(initial: Int, names: String*) { * initialize each Enumeration with Value(String). Otherwise, the * names are determined automatically through reflection. * - * @param s an enumeration name - * @return Some(Value) if an enumeration's name matches s, - * else None + * Note the change here wrt 2.7 is intentional. You should know whether + * a name is in an Enumeration beforehand. If not, just use find on + * values. + * + * @param s an Enumeration name + * @return the Value of this Enumeration if its name matches s + * @throws java.util.NoSuchElementException if no Value with a matching + * name is in this Enumeration */ final def withName(s: String): Value = values.find(_.toString == s).get -- cgit v1.2.3