* @exception IllegalArgumentException when there is no value s in
* the enum etype.
*/
- @SuppressWarnings("unchecked")
public static <S extends Enum<S>> S valueOf(Class<S> etype, String s)
{
if (etype == null || s == null)
if (! f.isEnumConstant())
throw new IllegalArgumentException(s);
Class.setAccessible(f);
- return (S) f.get(null);
+ @SuppressWarnings("unchecked")
+ S val = (S) f.get(null);
+ return val;
}
catch (NoSuchFieldException exception)
{