What is the depth (or limitation if any) for nesting BiFunction

前端 未结 2 1780
梦毁少年i
梦毁少年i 2020-12-19 15:54

I have been playing with BiFunction (java.util.function). I ran some examples and and I have one question.

Is there a limita

2条回答
  •  醉酒成梦
    2020-12-19 16:28

    I don't know of an inherent expression-level limit to this, but it will in practice be contrained by the JVM method size limit of 65534 bytes:

    The fact that end_pc is exclusive is a historical mistake in the design of the Java Virtual Machine: if the Java Virtual Machine code for a method is exactly 65535 bytes long and ends with an instruction that is 1 byte long, then that instruction cannot be protected by an exception handler. A compiler writer can work around this bug by limiting the maximum size of the generated Java Virtual Machine code for any method, instance initialization method, or static initializer (the size of any code array) to 65534 bytes.

    Source: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3

提交回复
热议问题