Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can you detect a method that will be > 65535 bytes?

843811Mar 14 2005 — edited Mar 23 2005
There's a well-known problem with the JVM that a method cannot be greater than 65535 bytes. Obviously, most developers know better than to write such a large method by hand. However, as automatic source code generators become more popular, this method size limit is becoming a major headache.

http://forum.java.sun.com/thread.jspa?forumID=37&threadID=171744
http://forum.java.sun.com/thread.jspa?forumID=52&threadID=94978
http://forum.java.sun.com/thread.jspa?threadID=483376&start=0&tstart=0
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=510932
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4309152

Apparently the only workaround to this problem is to split such a large method into multiple smaller methods that don't exceed the size limit. Well, that sounds great, but how do you actually do this?

For example, in an automatic source code generator, is it possible to detect if generated code would exceed this 65535 limit? Maybe it's impossible to tell ahead-of-time how big the Java compiler will make a method. If one could easily tell that a method would exceed the size limit, it would be easier to write a code generator.

Any thoughts?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 20 2005
Added on Mar 14 2005
22 comments
1,809 views