rlalfo / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

Enum class handling not invalid. #249

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-http-java-client (e.g. 1.15.0-rc)?
1.17.0-rc

Java environment (e.g. Java 6, Android 2.3, App Engine)?
java 6

Describe the problem.

com.google.api.client.util.Data.java 439 line 
Original 
      if (primitiveClass.isEnum()) {
        @SuppressWarnings({"unchecked", "rawtypes"})
        Enum result = ClassInfo.of(primitiveClass).getFieldInfo(stringValue).<Enum>enumValue();
        return result;
      }

this code not work.

so  I change to 

      if (primitiveClass.isEnum()) {
        Enum.valueOf((Class<Enum>)primitiveClass, stringValue);
      }

And it works. 

How would you expect it to be fixed?

Original issue reported on code.google.com by naru...@gmail.com on 7 Oct 2013 at 7:40

GoogleCodeExporter commented 9 years ago
mistake.

if (primitiveClass.isEnum()) {
        return Enum.valueOf((Class<Enum>)primitiveClass, stringValue);
      }

Original comment by naru...@gmail.com on 7 Oct 2013 at 7:42