Community
Participate
Working Groups
Build 2.1 RC2 1. Start fresh workspace 2. PDE Import org.eclipse.jdt.core from Eclipse 2.0 3. Open Type... "CreateWorkingCopyOperation" Observe: The type should not be present 4. PDE Import org.eclipse.jdt.core from Eclipse. 2.1 RC2 5. Open Type... "CreateWorkingCopyOperation" Observe: The type is not present, but it should
A request to re-index jdtcore.jar is made, the index state is set to REBUILDING, but it looks like getIndex(...) returns the existing index disregarding the index state. (Thread[ModalContext,5,main]) DISCARD background job family - org.eclipse.jdt.core (Thread[ModalContext,5,main]) DISABLING background indexing (Thread[ModalContext,5,main]) ENABLING background indexing (Thread[ModalContext,5,main]) DISCARD DONE with background job family - org.eclipse.jdt.core (Thread[ModalContext,5,main]) -> index state updated to: REBUILDING for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\376686048.index (Thread[ModalContext,5,main]) REQUEST background job - indexing /org.eclipse.jdt.core/jdtcore.jar (Thread[ModalContext,5,main]) -> index state updated to: REBUILDING for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\468491586.index (Thread[ModalContext,5,main]) REQUEST background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.resources_2.1.0/resources.jar (Thread[ModalContext,5,main]) -> index state updated to: REBUILDING for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\1041949545.index (Thread[ModalContext,5,main]) REQUEST background job - indexing D:/eclipse/Add_on/eclipse/plugins/org.eclipse.core.resources.spysupport_1.0.1/sp ysupport.jar (Thread[ModalContext,5,main]) -> index state updated to: REBUILDING for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\1261936400.index (Thread[ModalContext,5,main]) REQUEST background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.ant.core_2.1.0/antsupport.jar (Thread[ModalContext,5,main]) -> index state updated to: REBUILDING for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\3774629530.index (Thread[ModalContext,5,main]) REQUEST background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.team.core_2.1.0/team.jar (Thread[ModalContext,5,main]) -> index state updated to: REBUILDING for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\633443889.index (Thread[ModalContext,5,main]) REQUEST background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.boot_2.1.0/boot.jar (Thread[ModalContext,5,main]) -> index state updated to: REBUILDING for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\2790214621.index (Thread[ModalContext,5,main]) REQUEST background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.runtime_2.1.0/runtime.jar (Thread[ModalContext,5,main]) -> index state updated to: REBUILDING for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\4159451907.index (Thread[ModalContext,5,main]) REQUEST background job - indexing D:/jdk1.3.1/jre/lib/rt.jar (Thread[Java indexing,4,main]) 8 awaiting jobs (Thread[Java indexing,4,main]) STARTING background job - indexing /org.eclipse.jdt.core/jdtcore.jar (Thread[Java indexing,4,main]) -> no indexing required (index already exists) for /org.eclipse.jdt.core/jdtcore.jar (Thread[Java indexing,4,main]) FINISHED background job - indexing /org.eclipse.jdt.core/jdtcore.jar (Thread[Java indexing,4,main]) 7 awaiting jobs (Thread[Java indexing,4,main]) STARTING background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.resources_2.1.0/resources.jar (Thread[Java indexing,4,main]) -> no indexing required (index already exists) for D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.resources_2.1.0/resources.jar (Thread[Java indexing,4,main]) FINISHED background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.resources_2.1.0/resources.jar (Thread[Java indexing,4,main]) 6 awaiting jobs (Thread[Java indexing,4,main]) STARTING background job - indexing D:/eclipse/Add_on/eclipse/plugins/org.eclipse.core.resources.spysupport_1.0.1/sp ysupport.jar (Thread[Java indexing,4,main]) -> no indexing required (index already exists) for D:/eclipse/Add_on/eclipse/plugins/org.eclipse.core.resources.spysupport_1.0.1/sp ysupport.jar (Thread[Java indexing,4,main]) FINISHED background job - indexing D:/eclipse/Add_on/eclipse/plugins/org.eclipse.core.resources.spysupport_1.0.1/sp ysupport.jar (Thread[Java indexing,4,main]) 5 awaiting jobs (Thread[Java indexing,4,main]) STARTING background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.ant.core_2.1.0/antsupport.jar (Thread[Java indexing,4,main]) -> no indexing required (index already exists) for D:/eclipse/sdk/eclipse/plugins/org.eclipse.ant.core_2.1.0/antsupport.jar (Thread[Java indexing,4,main]) FINISHED background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.ant.core_2.1.0/antsupport.jar (Thread[Java indexing,4,main]) 4 awaiting jobs (Thread[Java indexing,4,main]) STARTING background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.team.core_2.1.0/team.jar (Thread[Java indexing,4,main]) -> no indexing required (index already exists) for D:/eclipse/sdk/eclipse/plugins/org.eclipse.team.core_2.1.0/team.jar (Thread[Java indexing,4,main]) FINISHED background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.team.core_2.1.0/team.jar (Thread[Java indexing,4,main]) 3 awaiting jobs (Thread[Java indexing,4,main]) STARTING background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.boot_2.1.0/boot.jar (Thread[Java indexing,4,main]) -> no indexing required (index already exists) for D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.boot_2.1.0/boot.jar (Thread[Java indexing,4,main]) FINISHED background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.boot_2.1.0/boot.jar (Thread[Java indexing,4,main]) 2 awaiting jobs (Thread[Java indexing,4,main]) STARTING background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.runtime_2.1.0/runtime.jar (Thread[Java indexing,4,main]) -> no indexing required (index already exists) for D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.runtime_2.1.0/runtime.jar (Thread[Java indexing,4,main]) FINISHED background job - indexing D:/eclipse/sdk/eclipse/plugins/org.eclipse.core.runtime_2.1.0/runtime.jar (Thread[Java indexing,4,main]) 1 awaiting jobs (Thread[Java indexing,4,main]) STARTING background job - indexing D:/jdk1.3.1/jre/lib/rt.jar (Thread[Java indexing,4,main]) -> no indexing required (index already exists) for D:/jdk1.3.1/jre/lib/rt.jar (Thread[Java indexing,4,main]) FINISHED background job - indexing D:/jdk1.3.1/jre/lib/rt.jar (Thread[Java indexing,4,main]) -> index state updated to: SAVED for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\4159451907.index (Thread[Java indexing,4,main]) -> index state updated to: SAVED for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\633443889.index (Thread[Java indexing,4,main]) -> index state updated to: SAVED for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\2790214621.index (Thread[Java indexing,4,main]) -> index state updated to: SAVED for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\1041949545.index (Thread[Java indexing,4,main]) -> index state updated to: SAVED for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\468491586.index (Thread[Java indexing,4,main]) -> index state updated to: SAVED for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\3774629530.index (Thread[Java indexing,4,main]) -> index state updated to: SAVED for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\376686048.index (Thread[Java indexing,4,main]) -> index state updated to: SAVED for: D:\eclipse\runtime- workspace\.metadata\.plugins\org.eclipse.jdt.core\1261936400.index Moving to Kent to investigate.
It has always worked this way. Since rt.jar is part of every project and would be re-indexed anytime a project changed its classpath, a check is in place to skip jar files if an existing index is found in the cache.
It used to work in 2.0.2 because PDE import was doing the operation in one batch. Thus the classpath didn't appear as changed, only jdtcore.jar was reported to the DeltaProcessor as a CHANGED resource delta. In this case, the DeltaProcessor forces the index to be removed from disk and from the cache (using IndexManager.removeIndex(IPath)), then it requests the jar to be indexed (using IndexManager.indexLibrary(...)). In 2.1, PDE import is doing the operation in 3 steps: it first sets the classpath to an empty one, it replaces the jar, and it resets the classpath to the final one. Because of that empty classpath setting, we don't see that the jar has changed (it is not on the classpath when the DeltaProcessor runs), thus it is not reindexed.
Changing PluginImportOperation to not set the classpath to an empty one fixes the problem. Proposed fix: Change the last part of PluginImportOperation.createJavaProject (...) to comment out the setting of an empty classpath. if (isJavaProject) { // IJavaProject jProject = JavaCore.create(project); // if (jProject.getRawClasspath() != null // && jProject.getRawClasspath().length > 0) // jProject.setRawClasspath(new IClasspathEntry[0], monitor); modelIds.add(model.getPluginBase().getId()); } Moving to PDE to integrate this fix.
Are you sure there are no side-effects to this? The code that checks if there are classpath entries for an IJavaProject seems there for a purpose. Why are we getting into this branch to start with? The check will only set the empty classpath if one is detected and has entries. Why would IJavaProject for a newly created project have entires to begin with?
Sorry I don't know the purpose of this check (I expected that someone on your side would know). It might be to handle the case where autobuild is on and you import source. But this is the wrong way to do it. The whole import operation should be done in one IWorkspaceRunnable (It used to be like that in 2.0.2) A newly created project will have a classpath that has one entry corresponding to the project (it was decided this is the most common case when creating a new project).
The project entry you describe is wrong most of the time for PDE - that is why we are removing it. We did have one workspace runnable in 2.0.2 but had to split because we needed to split import and classpath computation steps. We compute classpaths based on the state of the workspace and external plug-ins, and neither PDE nor JDT models can react to changes in the workspace until resource change notification is fired. Hence we perform import in one operation, let the notification be fired, then compute classpaths using newly updated model information.
But you set the classpath anyway later. So why would you remove it first?
I don't know :-) (I am just scared to remove that code without knowing what it is for). I will pass this to Wassim because he might remember.
Jdt/core issue is being addressed independantly in bug 35132. Still PDE shouldn't cause such a refresh in the model by flushing CP entirely (should only update it).
PDE no longer clears the classpath in the first stage of importing. This was fixed for RC3 for bug 34128.