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

Hiding of methods from parent classes when nested anonymous classes are compiled

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8u20
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      1.8.0_20

      ADDITIONAL OS VERSION INFORMATION :
      Windws 7

      A DESCRIPTION OF THE PROBLEM :
      public class Java8Bug {

          public Java8Bug() {
              new JPanel() {
                  {
                      new Runnable() {
                          @Override
                          public void run() {
                              show("test");
                          }
                      }.run();
                  }
              };
          }

          public void show(String string) {

          }
      }

      This compiled in java 7, in java 8 show(String) gets hidden, with the compiler error

      error: incompatible types: String cannot be converted to boolean

      REGRESSION. Last worked in version 7u10

      ADDITIONAL REGRESSION INFORMATION:
      1.7_09

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile the code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      code compiles
      ACTUAL -
      compile gives error error: incompatible types: String cannot be converted to boolean

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      error: incompatible types: String cannot be converted to boolean

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Java8Bug {

          public Java8Bug() {
              new JPanel() {
                  {
                      new Runnable() {
                          @Override
                          public void run() {
                              show("test");
                          }
                      }.run();
                  }
              };
          }

          public void show(String string) {

          }
      }

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

        Attachments

          Activity

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: