United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6464451 javac in 5.0ux can not compile try-catch block which has a lot of "return"
JDK-6464451 : javac in 5.0ux can not compile try-catch block which has a lot of "return"

Details
Type:
Enhancement
Submit Date:
2006-08-28
Status:
Closed
Updated Date:
2011-05-17
Project Name:
JDK
Resolved Date:
2011-05-17
Component:
tools
OS:
windows_xp
Sub-Component:
javac
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:

Related Reports
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
javac in 5.0ux can not compile try-catch block having a lot of "return".

REPRODUCE :
 1) Try to compile the attached .java program.
    You will see the following message.

    Note: the messages in () originally appears in Japanese.

K:\javac-ompiler>javac *.java
TEST_FINALLY10B.java:2006: (too big code in try statement)
      } catch(Exception e) { e.printStackTrace();
        ^
TEST_FINALLY10B.java:5: (too big code in try statement)
      try {
          ^
TEST_FINALLY10B.java:4: (too big code in )
   static public int func(int i) {
                     ^
(3 errors)


NOTE: 
  This problem does not occur in 1.4.2_XX javac.

                                    

Comments
EVALUATION

The compiler tries to avoid using the jsr instructions and the
result is that some degenerate cases will fail to compile.

Bug 4640034 describes the motivation for this change in behavior.

Since then, the class file format has been improved with a new
(faster) verification scheme.  This new scheme does not support
the jsr instruction at all and it will not be possible to avoid
the inlining when generated class files of version 50 or above.
                                     
2006-08-29
EVALUATION

We are investigating new ideas that may allow us to work around
the code attribute limits.
                                     
2006-09-28
EVALUATION

We will go back to jsr/ret to compile try-finally when code size is too big for subroutine inlining. This workaround will be implemented in 5.0 and 6.0 updates.

We are also working on a long term solution without using jsr/ret. It is targeted
JDK 7 and 6.0ux. Please see RFE 6491554.
                                     
2006-11-09



Hardware and Software, Engineered to Work Together