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

Allow Expressions in resource specification of try-with-resources

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: specification
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Expert group feedback has found a syntatic issue in the JSR 334 / Project Coin try-with-resources feature: the Resource alternatives

          VariableModifiersopt Type VariableDeclaratorId = Expression
          Expression

      cannot be fully distinguished based on the first few tokens because of code like:

         try (i < j ? .... // ?: operator expression
         try (List<String> l ... // declaring a parameterized type

      This issue should be resolved before the next JCP milestone. Remedies include restricting or even eliminating the Expression alternative. One restriction which may preserve most of the expressibility would be to limit the Expression to be an Identifier.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                darcy Joe Darcy
                Reporter:
                darcy Joe Darcy
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: