Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 100646 Details for
Bug 216772
IJavaModel#refreshExternalArchives fails to refresh ExternalJavaProject jar cache
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
216772.txt (text/plain), 5.63 KB, created by
Jerome Lanneluc
on 2008-05-16 10:35:42 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-05-16 10:35:42 EDT
Size:
5.63 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.395 >diff -u -r1.395 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 25 Apr 2008 10:09:57 -0000 1.395 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 16 May 2008 14:34:57 -0000 >@@ -1726,6 +1726,27 @@ > return this.cache.getExistingElement(element); > } > >+ public HashSet getExternalWorkingCopyProjects() { >+ synchronized (this.perWorkingCopyInfos) { >+ HashSet result = null; >+ Iterator values = this.perWorkingCopyInfos.values().iterator(); >+ while (values.hasNext()) { >+ Map ownerCopies = (Map) values.next(); >+ Iterator workingCopies = ownerCopies.keySet().iterator(); >+ while (workingCopies.hasNext()) { >+ ICompilationUnit workingCopy = (ICompilationUnit) workingCopies.next(); >+ IJavaProject project = workingCopy.getJavaProject(); >+ if (project.getElementName().equals(ExternalJavaProject.EXTERNAL_PROJECT_NAME)) { >+ if (result == null) >+ result = new HashSet(); >+ result.add(project); >+ } >+ } >+ } >+ return result; >+ } >+ } >+ > /** > * Get workspace eclipse preference for JavaCore plug-in. > */ >Index: model/org/eclipse/jdt/internal/core/DeltaProcessor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java,v >retrieving revision 1.321 >diff -u -r1.321 DeltaProcessor.java >--- model/org/eclipse/jdt/internal/core/DeltaProcessor.java 13 May 2008 13:02:59 -0000 1.321 >+++ model/org/eclipse/jdt/internal/core/DeltaProcessor.java 16 May 2008 14:34:56 -0000 >@@ -705,8 +705,22 @@ > try { > if (monitor != null) monitor.beginTask("", 1); //$NON-NLS-1$ > >+ boolean hasExternalWorkingCopyProject = false; > for (int i = 0, length = elementsScope.length; i < length; i++) { >+ IJavaElement element = elementsScope[i]; > this.state.addForRefresh(elementsScope[i]); >+ if (element.getElementType() == IJavaElement.JAVA_MODEL) { >+ // ensure external working copies' projects' caches are reset >+ HashSet projects = JavaModelManager.getJavaModelManager().getExternalWorkingCopyProjects(); >+ if (projects != null) { >+ hasExternalWorkingCopyProject = true; >+ Iterator iterator = projects.iterator(); >+ while (iterator.hasNext()) { >+ JavaProject project = (JavaProject) iterator.next(); >+ project.resetCaches(); >+ } >+ } >+ } > } > HashSet elementsToRefresh = this.state.removeExternalElementsToRefresh(); > boolean hasDelta = elementsToRefresh != null && createExternalArchiveDelta(elementsToRefresh, monitor); >@@ -744,6 +758,9 @@ > if (this.currentDelta != null) { // if delta has not been fired while creating markers > this.fire(this.currentDelta, DEFAULT_CHANGE_EVENT); > } >+ } else if (hasExternalWorkingCopyProject) { >+ // flush jar type cache >+ JavaModelManager.getJavaModelManager().resetJarTypeCache(); > } > } finally { > this.currentDelta = null; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java,v >retrieving revision 1.130 >diff -u -r1.130 ReconcilerTests.java >--- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 21 Apr 2008 12:54:43 -0000 1.130 >+++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 16 May 2008 14:34:58 -0000 >@@ -1623,6 +1623,54 @@ > } > > /* >+ * Ensures that an error is detected after refreshing external archives used by >+ * an external working copy. >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=216772 ) >+ */ >+public void testExternal3() throws Exception { >+ try { >+ this.workingCopy.discardWorkingCopy(); // don't use the one created in setUp() >+ this.workingCopy = null; >+ this.problemRequestor = new ProblemRequestor(); >+ createJar(new String[] { >+ "p/Lib.java", >+ "package p;\n" + >+ "public class Lib {\n" + >+ "}" >+ }, getExternalResourcePath("lib.jar")); >+ IClasspathEntry[] classpath = new IClasspathEntry[] { >+ JavaCore.newLibraryEntry(getExternalJCLPath(), null, null), >+ JavaCore.newLibraryEntry(new Path(getExternalResourcePath("lib.jar")), null, null) >+ }; >+ this.workingCopy = newExternalWorkingCopy("External.java", classpath, this.problemRequestor, >+ "public class External {\n"+ >+ " p.Lib field;\n"+ >+ "}\n" >+ ); >+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, null/*no owner*/, null); >+ >+ createJar(new String[] { >+ "p/Lib2.java", >+ "package p;\n" + >+ "public class Lib2 {\n" + >+ "}" >+ }, getExternalResourcePath("lib.jar")); >+ getJavaModel().refreshExternalArchives(null, null); >+ this.problemRequestor.reset(); >+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, true/*force problem detection*/, null/*no owner*/, null); >+ assertProblems( >+ "Unexpected problems", >+ "----------\n" + >+ "1. ERROR in / /External.java\n" + >+ "p.Lib cannot be resolved to a type\n" + >+ "----------\n" >+ ); >+ } finally { >+ deleteExternalResource("lib.jar"); >+ } >+} >+ >+/* > * Ensures that included part of prereq project are visible > */ > public void testIncludePartOfAnotherProject1() throws CoreException {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 216772
:
88015
| 100646