Is there any maximum size for code in Java? I wrote a function with more than 10,000 lines. Actually, each line assigns a value to an array variable.
arts_b
According to the Java Virtual Machine specification, the code of a method must not be bigger than 65536 bytes:
The value of the
code_length
item gives the number of bytes in thecode
array for this method.The value of code_length must be greater than zero (as the code array must not be empty) and less than 65536.
code_length
defines the size of the code[]
attribute which contains the actual bytecode of a method:
The
code
array gives the actual bytes of Java Virtual Machine code that implement the method.