Community
Participate
Working Groups
Using -repeat 5 with the batch compiler is broken when jar files are used on the classpath. java.lang.IllegalStateException: zip file closed at java.util.zip.ZipFile.ensureOpen(ZipFile.java:519) at java.util.zip.ZipFile.entries(ZipFile.java:407) at org.eclipse.jdt.internal.compiler.batch.ClasspathJar.isPackage(ClasspathJar.java:59) at org.eclipse.jdt.internal.compiler.batch.ClasspathJar.findClass(ClasspathJar.java:40) at org.eclipse.jdt.internal.compiler.batch.FileSystem.findClass(FileSystem.java:147) at org.eclipse.jdt.internal.compiler.batch.FileSystem.findType(FileSystem.java:171) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createPackage(LookupEnvironment.java:517) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:83) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:144) at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:292) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:315) at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:2692) at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1151)[repetition 2/5] at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1048) at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1040) at org.eclipse.jdt.core.tools.compiler.Compile.main(Compile.java:19) The first compilation resets the internal zip file of the ClasspathJar object.
Created attachment 25132 [details] Proposed fix I simply use the zipFile internally. The zipFile is created again using the file in the second iteration.
I am working on a better patch.
Created attachment 25135 [details] Proposed fix New patch. The zip file is created in an initialize method. This is called only when the library is retrieved, so this doesn't penalize any subsequent calls to isPackage(...) or findClass(...).
Fixed and released in HEAD. Regression test in org.eclipse.jdt.core.tests.compiler.regression.BatchCompilerTest.test033
Backported to 3.1 maintenance stream.
Verified with 3.2 M1
Verified for 3.2 M2 with build I20050920-0010.
Verified using M20050923-1430 for 3.1.1