JDK-4495283 : Javac ignores the ClassPath attribute in jar file manifests
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-08-22
  • Updated: 2001-08-22
  • Resolved: 2001-08-22
Related Reports
Duplicate :  
Description

Name: bsC130419			Date: 08/22/2001


java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


The compiler ignores the Class-Path attribute in jar files resulting in the
following error:

An exception has occurred in the compiler (1.3.1). Please file a bug at the Java
 Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi).  Include your
 program and the following diagnostic in your report.  Thank you.
com.sun.tools.javac.v8.code.Symbol$CompletionFailure: file package1\Class1.class
 not found
        at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:997)
        at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:952
)
        at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:366)
        at com.sun.tools.javac.v8.code.Type$ClassType.supertype(Type.java:812)
        at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1406)
        at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1408)
        at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1408)
        at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:378)
        at com.sun.tools.javac.v8.Main.compile(Main.java:247)

The nature of this bug means that you need several source files to produce it.
The setup I have is:

  Root directory contains file compileAll.bat
and directories package1, package2, package3, meta-inf and jars
package1 contains the file Class1.java
package2 contains the file Class2.java
package3 contains the file Class3.java
meta-inf contains the file Manifest.mf

The contents of the files are as follows:
Class1.java ----

package package1;

public class Class1 {

    public static void main(String[] args) {
        System.out.println("Class1 can be found");
    }

}

----------------
Class2.java ----

package package2;

import package1.Class1;

public class Class2 extends Class1 {
}

----------------
Class3.java ----

package package3;

import package2.Class2;

public class Class3 extends Class2 {
}

----------------
Manifest.mf-----

Manifest-Version: 1.0
Class-Path: package1.jar
Main-Class: package2.Class2

----------------
compileAll.bat--

javac package1\Class1.java
jar -cvf jars\package1.jar package1\Class1.class
javac -classpath jars\package1.jar package2\Class2.java
jar -cvfm jars\package2.jar META-INF\MANIFEST.MF package2\Class2.class
java -jar jars\package2.jar
javac -classpath jars\package2.jar package3\Class3.java

-----------------

The idea of the setup is that package3 depends on package2 depends on package1.

First package1 is compiled and the resulting class is packaged in a jar file.

Then package2 is compiled using the package1 jar as the only member of the
classpath. Package2 is packaged in a jar file and the manifest indicates the
dependency on package1.

  To prove that package2 has been correctly bundled into a jar file, the class
package2.Class2 is run using the package2 jar file as the only member of the
class path. This test runs successfully.

Finally we attempt to compile package3 and an error occurs.

This entire process can be executed by running compileAll.bat
(Review ID: 130386) 
======================================================================

Comments
EVALUATION The compiler should not crash on a completion failure, but I don't believe it should use the classpath manifest entries either. Those specify URLs, which the compiler does not support. ###@###.### 2001-08-22
22-08-2001