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

No compilation error when trying to compile nested inner classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u45
    • tools
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [versão 6.3.9600]
      Windows 8.1 64bits pt-br

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Hardware: Intel Core i5-2410M 2.3 GHz

      A DESCRIPTION OF THE PROBLEM :
      The following program presents no compilation error when compiling in Oracle JDK but it must not be compilable.

      Program

      public class A {
      public class B extends A {
      public class C extends B {}
      }
      }


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Save above program into a file called A.java and try to execute javac compiler.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compilation error: No enclosing instance of type A is available due to some intermediate constructor invocation
      ACTUAL -
      No compilation errors.

      REPRODUCIBILITY :
      This bug can be reproduced always.

            dlsmith Dan Smith
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: