JAVA中最大的类_Java类中允许的最大代码行?

为了延续到

Jonas’s response,Java虚拟机规范

Section 4.8 Constraints on Java Virtual Machine Code说:

The Java virtual machine code for a

method, instance initialization method

(§3.9), or class or interface

initialization method (§3.9) is stored

in the code array of the Code

attribute of a method_info structure

of a class file. This section

describes the constraints associated

with the contents of the

Code_attribute structure.

继续执行第4.8.1节静态约束

The static constraints on a class file

are those defining the well-formedness

of the file. With the exception of the

static constraints on the Java virtual

machine code of the class file, these

constraints have been given in the

previous section. The static

constraints on the Java virtual

machine code in a class file specify

how Java virtual machine instructions

must be laid out in the code array and

what the operands of individual

instructions must be.

The static constraints on the

instructions in the code array are as

follows:

The value of the code_length item must be less than 65536.

所以方法的方法确实有每个方法的65535字节的字节码限制。 (见下面的注释)

注意:虽然JVM的设计显然存在问题,如果字节65535的指令是长度为1字节的指令,则不受异常处理程序的保护 – 这在第4.10节的脚注4中列出。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值