Bug 104664 - [compiler] repeat mode is broken in the batch compiler
Summary: [compiler] repeat mode is broken in the batch compiler
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-21 10:28 EDT by Olivier Thomann CLA
Modified: 2005-09-26 12:38 EDT (History)
0 users

See Also:


Attachments
Proposed fix (4.68 KB, patch)
2005-07-21 10:32 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix (7.65 KB, patch)
2005-07-21 11:16 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2005-07-21 10:28:13 EDT
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.
Comment 1 Olivier Thomann CLA 2005-07-21 10:32:03 EDT
Created attachment 25132 [details]
Proposed fix

I simply use the zipFile internally. The zipFile is created again using the
file in the second iteration.
Comment 2 Olivier Thomann CLA 2005-07-21 11:04:50 EDT
I am working on a better patch.
Comment 3 Olivier Thomann CLA 2005-07-21 11:16:13 EDT
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(...).
Comment 4 Olivier Thomann CLA 2005-07-25 10:26:08 EDT
Fixed and released in HEAD.
Regression test in
org.eclipse.jdt.core.tests.compiler.regression.BatchCompilerTest.test033
Comment 5 Olivier Thomann CLA 2005-07-25 11:16:44 EDT
Backported to 3.1 maintenance stream.
Comment 6 Jerome Lanneluc CLA 2005-08-11 10:33:31 EDT
Verified with 3.2 M1
Comment 7 Maxime Daniel CLA 2005-09-21 09:16:07 EDT
Verified for 3.2 M2 with build I20050920-0010.
Comment 8 David Audel CLA 2005-09-26 12:38:33 EDT
Verified using M20050923-1430 for 3.1.1