Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8193860

14.21: try-finally statement completes normally when it should complete abruptly

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      A DESCRIPTION OF THE PROBLEM :
      compiler don't warn about unreachable code, when try/cacth/finally block exist.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      none warning/error
      ACTUAL -
      run without error/warning

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      public class Test {
      public static void main(String[] args) {
      try {
      return;

      } catch (Exception e) {
      System.out.println("catch");

      } finally {
      System.out.println("finally");
      }

      System.out.println("unreachable??!!!");
      }
      }

      ---------- END SOURCE ----------

      Attachments

        Issue Links

          Activity

            People

              dlsmith Dan Smith
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: