Work-in-progress fix for Bug 406170: JDT causes JAR locking on Windows
systems, must exit eclipse to force file handle close, to allow deletion
of files.
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java
index e7b2875..774ea91 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java
@@ -157,7 +157,7 @@
this.basicParser.reportOnlyOneSyntaxError = true;
this.basicParser.scanner.taskTags = null;
this.cud = this.basicParser.parse(this.compilationUnit, new CompilationResult(this.compilationUnit, 0, 0, this.options.maxProblemsPerUnit));
-
+ JavaModelManager.getJavaModelManager().cacheZipFiles(this); // use model only for caching
// Use a non model name environment to avoid locks, monitors and such.
INameEnvironment nameEnvironment = IndexBasedJavaSearchEnvironment.create(Collections.singletonList((IJavaProject)javaProject), JavaModelManager.getJavaModelManager().getWorkingCopies(DefaultWorkingCopyOwner.PRIMARY, true/*add primary WCs*/));
this.lookupEnvironment = new LookupEnvironment(this, this.options, problemReporter, nameEnvironment);
@@ -170,6 +170,8 @@
if (JobManager.VERBOSE) {
e.printStackTrace();
}
+ } finally {
+ JavaModelManager.getJavaModelManager().flushZipFiles(this);
}
}