• Post Reply Bookmark Topic Watch Topic
  • New Topic

Biggest method in java?  RSS feed

 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi just curious to know which is the biggest method (line size) in the java API.Does anyone know?
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there's a theoretical limit of 65 kilobytes of bytecode per method.
How many lines of code that leads to will depend on the code.
A single statement can lead to a lot of bytecode.

If you've ever created complex JSPs and forgot to split them up and use dynamic includes you'll have run up against this limit
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeroen,
Didnt understand by what "there's a theoretical limit of 65 kilobytes of bytecode per method" means
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you write a method, you compile it into bytecode. this is the language that the JVM understands and translates into the machine-specific intructions at runtime.

anyway, there is not a 1-1 correspondence between a line of java and a line of bytecode. one 15 character line of java might translate to 5-6 lines of bytecode of 10 characters each.

the total amount of bytecode for a single method cannot exceed 65k in size.

at least, i think that's what Jeroen means.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's indeed what I meant. Thought I was clear
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess my italicized 'think' was more because i sometimes doubt myself rather than because i didn't understand what you meant.

maybe i should have italicized the "i" instead.

sorry.
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where can I find more info on this ?In the VM spec?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!