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

Allow Expressions in resource specification of try-with-resources

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 7
    • specification
    • generic
    • generic

      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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: