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

complains bad class file when trying ocompile a valid Java file

XMLWordPrintable

    • b35
    • generic, x86
    • linux, solaris_8


      ###@###.### 2003-12-18

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b30)
        Java HotSpot(TM) Client VM (build 1.5.0-beta-b30, mixed mode)

      Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
        No

      Operating System Configuration Information (be specific):
        RedHat Linux 7.3

      Hardware Configuration Information (be specific):
        Single Processor Pentium 1.3Ghz

      Bug Description:
        Got the following error message when trying to compile a valid Java file:

         FailedTest1.java:2: cannot access java.util.Collections.ReverseComparator
         bad class file: /home/spf/private/j2sdk1.5.0/jre/lib/rt.jar(java/util/Collections$ReverseComparator.class)
         undeclared type variable: E
         Please remove or make sure it appears in the correct subdirectory of the classpath.
         import static java.util.Collections.*;
      ^
      1 error


      Steps to Reproduce (be specific):

      Compile the attached file with "javac -source 1.5 FailedTest1.java":

      ----
      //import static java.util.Collections.sort;
      import static java.util.Collections.*;

      public class FailedTest1 {
          public static void main(String [] args) {
              sort(new java.util.LinkedList<String>());
          }
      }

      ----

      If the commented out import is uncommented and the other import is commented, the program compiles.

            gafter Neal Gafter (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: