GulajavaMinistudio / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

StackOverflowError on Android L #597

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

09-15 10:32:35.738    8954-9424/com.xxx.yyy.staging D/Retrofit-Log﹕ ---- 
ERROR http://www.xxx.com:3001/api/user?action=login
09-15 10:32:36.317    8954-9424/com.xxx.yyy.staging D/Retrofit-Log﹕ 
java.lang.StackOverflowError: stack size 1056KB
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:549)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:542)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:549)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:542)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:549)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:542)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:549)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:542)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:549)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:108)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:542)
What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
1.6, 1.7.1, 2.2.4, 2.3, Android L preview

Please provide any additional information below.
I built my app with Gson and Retrofit, it worked on every other Android 
versions except L preview. I tried some Gson versions (1.6, 1.7.1, 2.2.4, 2.3), 
none of them worked.

Original issue reported on code.google.com by regcolle...@gmail.com on 15 Sep 2014 at 3:17

Attachments:

GoogleCodeExporter commented 9 years ago
Can you provide a test case to reproduce this?

Original comment by inder123 on 12 Nov 2014 at 11:23

GoogleCodeExporter commented 9 years ago
The final version of Android 5.0 (L) was released today to Nexus devices. I'll 
flash tomorrow and try. If I had to guess it was a bug in ART's handling of 
generics through reflection. Hopefully it was fixed in the final version.

It would be really helpful if you were able to show the Java classes which you 
are serializing so I don't have to guess at the generics you are using.

Original comment by j...@squareup.com on 12 Nov 2014 at 11:27

GoogleCodeExporter commented 9 years ago
I've run into the exact same problem on Android 5.0.1 and on one of the final 
preview builds for L on the Nexus 5

     Caused by: java.lang.StackOverflowError: stack size 1036KB
            at com.google.gson.internal.$Gson$Types.access$000($Gson$Types.java:43)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:549)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:109)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:544)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:109)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:551)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:109)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:544)
            at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:109)
            at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:551)

Here are the classes involved:
https://gist.github.com/konk3r/bd4be27d35826325e9ad

And the calling method:
https://gist.github.com/konk3r/a54526b2f0c0bcac7cd7

Response JSON:
https://gist.github.com/konk3r/19ca049194c594b6ce02

Hopefully that's enough for you to be able to look into it.

Original comment by kon...@gmail.com on 16 Dec 2014 at 9:48