maximum depth for inner classes?

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2004
Posts: 786
Reputation: Phaelax is on a distinguished road 
Solved Threads: 39
Phaelax Phaelax is offline Offline
Master Poster

maximum depth for inner classes?

 
0
  #1
Nov 15th, 2006
Is there a limit to how deep you can go with inner classes?
Like having a class within a class, within a class, within a class, etc....
I'm just curious.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: maximum depth for inner classes?

 
0
  #2
Nov 15th, 2006
there shouldn't be... if each class allowed x inner classes you've still got a potential of infinity levels deep.

it might make your addressing a bit long winded though o_O

weird question!

when classes with inner classes or anonymous classes are compiled they tend to occupy a single addressing level with a hash between the "parent" class and the "child" class. so an object of an inner classtype will be of type:

Package/ParentClass#InnerClass rather than type Package/ParentClass/InnerClass

in theory it should be possible to continue that naming convention indefinately, but in practice, the VM or compiler might not be expecting it.. try it out, let me know =P
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: maximum depth for inner classes?

 
0
  #3
Nov 15th, 2006
I think you'll at some point run into limits for the maximum length of classnames (including package names) which are likely Integer.MAX_VALUE.
Before that you'll possibly run into the maximum size of codefiles (though those can be quite large).

The most serious problem of all of course is that it's horrendously bad design to need anything like that
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC