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

Bogus error on superclass of nested class with imported member

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_18"
      OpenJDK Runtime Environment (IcedTea6 1.8) (fedora-41.b18.fc13-x86_64)
      OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux mattlaptop2.local 2.6.33.6-147.2.4.fc13.x86_64 #1 SMP Fri Jul 23 17:14:44 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Consider a nested class whose superclass is in another package and is referenced via an import statement. If a member of the nested class is imported before the superclass is imported, javac issues a bogus compile error that the superclass cannot be found. Eclipse compiles the code successfully.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the test case.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Successful compilation.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      ImportNotRecognized.java:7: cannot find symbol
      symbol : class BitSet
      location: class test.ImportNotRecognized
        static class Nested extends BitSet {
                                    ^

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import static test.ImportNotRecognized.Nested.answer;
      import java.util.BitSet;

      class ImportNotRecognized {
        static class Nested extends BitSet {
          static final int answer = 42;
        }
        static final int answer2 = answer + 1;
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use the fully qualified name of the superclass.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: