Stack overflow - 32 deep class hierarchy

by thesquib » Sat, 27 Dec 2008 07:03:29 GMT

Sponsored Links
 I have come across an interesting problem. If I have a class hierarchy
that is 32 deep and attempt to instantiate the 32nd one, the VM breaks
with a stack overflow. I take it this is expected - 32 seems like a
'magic' number. Debugging shows that the VM fails to load the class,
tries to throw and exception and goes into infinite recursion. Can
anyone shed a bit of light on the situation?

Example class hierarchy:
class T1 {}
class T2 extends T1 {}
class T3 extends T2 {}
class T4 extends T3 {}
class T5 extends T4 {}
class T6 extends T5 {}
class T7 extends T6 {}
class T8 extends T7 {}
class T9 extends T8 {}
class T10 extends T9 {}
class T11 extends T10 {}
class T12 extends T11 {}
class T13 extends T12 {}
class T14 extends T13 {}
class T15 extends T14 {}
class T16 extends T15 {}
class T17 extends T16 {}
class T18 extends T17 {}
class T19 extends T17 {}
class T20 extends T19 {}
class T21 extends T20 {}
class T22 extends T21 {}
class T23 extends T22 {}
class T24 extends T23 {}
class T25 extends T24 {}
class T26 extends T25 {}
class T27 extends T26 {}
class T28 extends T27 {}
class T29 extends T28 {}
class T30 extends T29 {}
class T31 extends T30 {}
class T32 extends T31 {}
class T33 extends T32 {}



Stack overflow - 32 deep class hierarchy

by thesquib » Tue, 30 Dec 2008 03:55:59 GMT

 I posted this at the worst time of the year :)
I just wanted to add that I am interested in finding a way around
this, or just to find out if it is a limitation which will not go


Sponsored Links

Stack overflow - 32 deep class hierarchy

by Mark Murphy » Tue, 30 Dec 2008 04:04:07 GMT


I'd focus instead on getting rid of 20+ classes in the hierarchy.

Mark Murphy (a Commons Guy) 

Android Training on the Ranch! -- Mar 16-20, 2009 


Stack overflow - 32 deep class hierarchy

by thesquib » Tue, 30 Dec 2008 05:49:13 GMT

 Thanks for your reply Mark. I realise that the best solution is to
collapse the hierarchy, however I am still interested to know the


Other Threads

1. Focus Hover On App Icon?

Oh Holy Experts:

I'm wondering if there's any way to switch out the application icon the main
category, when the focus scrolls over it.  I'm not sure if I could send a
screenshot through this user group; if I could, you would see that our
design guys in their infinite wisdom chose Droid Hover orange as the logo
color.  When not hovered on, it looks like a series of orange swoops.  But
when hovered, it looks exactly like an orange square!  Crap, crappity crap
crap, help me please!

Nick Owens
VP, ThreeClix
Office: (904) 429-7039
Mobile: (847) 565-9392
After Hours: (904) 540-5830


2. Media Scanner vs Download Manager

Hi all,

Can you please explain me how Media Scanner listens whenever Download
gets completed and scans the corresponding file?

I tried looking into different intents(DOWNLOAD_COMPLETED,
ACTION_MEDIA_MOUNTED ...) but confused about the interaction between
the two components.

Thanks in advance,
Android User.


3. Dont understand contexts.

4. how to set Wifi settings in Android simulator??

5. Custom listview

6. Intent action for network events in android sdk

7. Intent action for network events in android sdk