Details

      Description

      try without catch or finally is probably a programmer error.

        Issue Links

          Activity

          Show
          Jason Zaugg added a comment - https://github.com/scala/scala/pull/2108
          Hide
          James Iry added a comment -

          Apparently the spec says it's illegal.

          Show
          James Iry added a comment - Apparently the spec says it's illegal.
          Show
          Jason Zaugg added a comment - https://github.com/scala/scala/pull/2337
          Hide
          Jason Zaugg added a comment -

          Warning added for 2.11. SI-4249 is a spec bug, we don't mandate braces around the try body.

          Show
          Jason Zaugg added a comment - Warning added for 2.11. SI-4249 is a spec bug, we don't mandate braces around the try body.
          Hide
          Iulian Dragos added a comment -

          Why not an error? (I realize that needs updating the spec). I see no reason to ever write that code, it's always a silent bug.

          Show
          Iulian Dragos added a comment - Why not an error? (I realize that needs updating the spec). I see no reason to ever write that code, it's always a silent bug.
          Hide
          Jason Zaugg added a comment -

          Two reasons:

          • There was some argument that it is convenient to comment out a catch without needing to go back up in the code and comment out the try.
          • It would be a source-incompatible change.

          Personally, I agree with you (I chose to make it an unconditional warnings, rather than hiding it behind -Xlint). But a warning is sufficiently useful, so I didn't fight for anything stronger.

          Show
          Jason Zaugg added a comment - Two reasons: There was some argument that it is convenient to comment out a catch without needing to go back up in the code and comment out the try. It would be a source-incompatible change. Personally, I agree with you (I chose to make it an unconditional warnings, rather than hiding it behind -Xlint ). But a warning is sufficiently useful, so I didn't fight for anything stronger.

            People

            • Assignee:
              Jason Zaugg
              Reporter:
              Jason Zaugg
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development