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

Binding variable surprisingly goes out of scope

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: repo-amber
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Consider this corner case:

      public class X {

          public static void main(String args[]) {
              Object o = "Hello";
              if (o __matches String x __matches boolean b1 __matches boolean b2 __matches true) {
                  System.out.println(x);
              }
          }
      }

      I would expect x to be in scope inside the if {} - it is not:

      /home/srikanth/tmp/X.java:6: error: cannot find symbol
                  System.out.println(x);
                                     ^
        symbol: variable x
        location: class X
      1 error

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            sadayapalam Srikanth Adayapalam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: