Permalink
Browse files

HV-595: Reverting improved enum instantiation due to compilation erro…

…r when compiling with JDK 6
  • Loading branch information...
1 parent 627f8d3 commit 5dacd6d3441fd35c10d1c7b2d6178da60c0a4c0c @gunnarmorling committed Aug 21, 2012
Showing with 3 additions and 7 deletions.
  1. +3 −7 engine/src/main/java/org/hibernate/validator/internal/xml/XmlMappingParser.java
@@ -550,7 +550,9 @@ else if ( returnType.getName().equals( Class.class.getName() ) ) {
}
else {
try {
- returnValue = getEnumInstance( returnType, value );
+ @SuppressWarnings("unchecked")
+ Class<Enum> enumClass = (Class<Enum>) returnType;
+ returnValue = Enum.valueOf( enumClass, value );
}
catch ( ClassCastException e ) {
throw log.getInvalidReturnTypeException( returnType, e );
@@ -559,12 +561,6 @@ else if ( returnType.getName().equals( Class.class.getName() ) ) {
return returnValue;
}
- private <E extends Enum<E>> E getEnumInstance(Class<?> enumClazz, String value) {
- @SuppressWarnings("unchecked")
- Class<E> enumClass = (Class<E>) enumClazz;
- return Enum.valueOf( enumClass, value );
- }
-
private void checkNameIsValid(String name) {
if ( MESSAGE_PARAM.equals( name ) || GROUPS_PARAM.equals( name ) ) {
throw log.getReservedParameterNamesException( MESSAGE_PARAM, GROUPS_PARAM, PAYLOAD_PARAM );

0 comments on commit 5dacd6d

Please sign in to comment.