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

Syntactically meaningless code accepted by javac

XMLWordPrintable

    • b76
    • x86
    • windows_8
    • Verified

        FULL PRODUCT VERSION :
        java version "1.8.0_51"
        Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
        Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows

        A DESCRIPTION OF THE PROBLEM :
        The following code has a syntax error, but is nonetheless accepted by javac:

        class A {
            static Runnable r = (__GAR BAGE__.this) -> { };
        }


        REGRESSION. Last worked in version 7u85

        ADDITIONAL REGRESSION INFORMATION:
        This was a syntax error in previous versions.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        javac A.java

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Syntax error
        ACTUAL -
        No error and class file produced

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        class A {
            static Runnable r = (__GAR BAGE__.this) -> { };
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        If it hurts, don't do that.

              mcimadamore Maurizio Cimadamore
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: