JDK-4973040 : Only in 1.4.2, javac output warning by default when "return' in finally block
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.4.2_02
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2003-12-29
  • Updated: 2004-01-06
  • Resolved: 2004-01-06
Related Reports
Duplicate :  
Relates :  
Description
Only in 1.4.2(_0X), javac outputs the warning message when "return" is
in finally block.

The output message is as follows.

--->
goedel% javac FinallyTest.java
FinallyTest.java:9: warning: finally clause cannot complete normally
        }
        ^
1 warning
goedel%
<---

REPRODUCE:
 To compile the java code.

-->
public class FinallyTest {
    public static void main(String[] args) {
        try {
            System.out.println("FinnalyTest");
            return;
        } finally {
            System.out.println("FinnalyTest finally");
            return;
        }
    }
}
<--

======================================================================

Comments
PUBLIC COMMENTS ...
10-06-2004

EVALUATION I believe this is already fixed in Tiger with the new -Xlint option. ###@###.### 2003-12-31 This issue has been fixed in Tiger (1.5-b26) as part of fix for bug #4821353 - new warning "finally cannot complete normally" should not be enabled by default. We may need to close this bug as duplicate of bug #4821353 and backport the fix of #4821353 into 1.4.2_xx (by associating esc #550178 with bug 4821353) for better tracking of this issue with one bugid. ###@###.### 2004-01-06
06-01-2004