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

Any block: while/for/do-while/if-else/etc. can have "catch" and "finally"

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Withdrawn
    • Affects Version/s: 9, 10, 11, 12, 13, 14
    • Fix Version/s: None
    • Component/s: specification
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      while, for, do-while, if-else, static/instance initializer any block can have 
      "catch" and "finally" 

      Java will become less verbose and more powerful. "try" does not have to be explicit everywhere. It will save extra lines for "try{" and extra nested 
      sections. 

      Examples: 

      1. static { 
      } catch (<exception(s)>) { 
      } finally { 


      2. { 
      } catch (<exception(s)>) { 
      } finally { 


      3. method(<parameters>) { 
      } catch (<exception(s)>) { 
      } finally { 


      4. for|while() { 
      } catch (<exception(s)>) { 
      } finally { 


      5.do() { 
      } while () { 
      } catch (<exception(s)>) { 
      } finally { 


      6. if-else 
      if () { 
      } catch (<exception(s)>) { 
      } finally { 
      } else{ 
      } catch (<exception(s)>) { 
      } finally { 


      7. etc.

      Java will become less verbose and more powerful. 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abuckley Alex Buckley
                Reporter:
                aermykin Alexey Ermykin (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: