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

Compiler allows invalid binary literals 0b and oBL

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 7
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b75
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Description

      Compiler accepts the following invalid code:
      public class Test {
          public static void main( String argv[] ) {
              int i = 0b; // should be compile-time error
              long l = 0BL; // should be compile-time error
          }
      }

      according to grammar (http://ccc/6860965) this is invalid:
      BinaryNumeral:
              0 b BinaryDigits
              0 B BinaryDigits
      BinaryDigits:
              BinaryDigit
              BinaryDigit BinaryDigits
      BinaryDigit: one of
              0 1

      This test will be integrated into jck soon.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jjg Jonathan Gibbons
                Reporter:
                vrudomet Victor Rudometov
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: