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 84504 Details for
Bug 210094
Creating type hierarchy does not report progress
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Same fix and improved test
210094.txt (text/plain), 9.89 KB, created by
Jerome Lanneluc
on 2007-12-05 04:45:54 EST
(
hide
)
Description:
Same fix and improved test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-12-05 04:45:54 EST
Size:
9.89 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java,v >retrieving revision 1.104 >diff -u -r1.104 IndexBasedHierarchyBuilder.java >--- model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java 28 Aug 2007 10:03:39 -0000 1.104 >+++ model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java 5 Dec 2007 09:43:04 -0000 >@@ -521,14 +521,18 @@ > // search all index references to a given supertype > pattern.superSimpleName = currentTypeName; > indexManager.performConcurrentJob(job, waitingPolicy, progressMonitor == null ? null : new NullProgressMonitor() { >- // don't report progress since this is too costly for deep hierarchies >- // just handle isCanceled() (seehttps://bugs.eclipse.org/bugs/show_bug.cgi?id=179511) >+ // don't report progress since this is too costly for deep hierarchies (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=34078 ) >+ // just handle isCanceled() (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=179511 ) > public void setCanceled(boolean value) { > progressMonitor.setCanceled(value); > } > public boolean isCanceled() { > return progressMonitor.isCanceled(); > } >+ // and handle subTask(...) (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=34078 ) >+ public void subTask(String name) { >+ progressMonitor.subTask(name); >+ } > }); > if (progressMonitor != null && ++ticks <= MAXTICKS) > progressMonitor.worked(1); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java,v >retrieving revision 1.76 >diff -u -r1.76 TypeHierarchyTests.java >--- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 3 Dec 2007 13:57:19 -0000 1.76 >+++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 5 Dec 2007 09:43:05 -0000 >@@ -20,6 +20,8 @@ > import org.eclipse.core.runtime.Path; > > import org.eclipse.jdt.core.*; >+import org.eclipse.jdt.core.tests.model.SearchTests.WaitingJob; >+import org.eclipse.jdt.core.tests.model.Semaphore.TimeOutException; > import org.eclipse.jdt.core.tests.util.Util; > > import junit.framework.Test; >@@ -1526,6 +1528,36 @@ > ); > } > /* >+ * Ensures that progress is reported while waiting for indexing to finish >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=210094 ) >+ */ >+public void testProgressWhileIndexing() throws CoreException, TimeOutException { >+ final WaitingJob job = new WaitingJob(); >+ try { >+ createJavaProject("P"); >+ createFile("/P/X210094.java", "public class X210094 {}"); >+ job.suspend(); >+ createFile("/P/Y210094.java", "public class Y210094 {}"); >+ IType type = getCompilationUnit("/P/X210094.java").getType("X210094"); >+ class ProgressCounter extends TestProgressMonitor { >+ int count = 0; >+ public void subTask(String name) { >+ if (this.count++ == 0) >+ job.resume(); >+ } >+ public boolean isCanceled() { >+ return false; >+ } >+ } >+ ProgressCounter counter = new ProgressCounter(); >+ type.newTypeHierarchy(counter); >+ assertTrue("subTask() should be notified", counter.count > 0); >+ } finally { >+ job.resume(); >+ deleteProject("P"); >+ } >+} >+/* > * Ensures that a type hierarchy on a region contains all subtypes > * (regression test for bug 47743 Open type hiearchy problems [type hierarchy]) > */ >Index: src/org/eclipse/jdt/core/tests/model/SearchTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java,v >retrieving revision 1.47 >diff -u -r1.47 SearchTests.java >--- src/org/eclipse/jdt/core/tests/model/SearchTests.java 3 Dec 2007 12:02:07 -0000 1.47 >+++ src/org/eclipse/jdt/core/tests/model/SearchTests.java 5 Dec 2007 09:43:05 -0000 >@@ -101,10 +101,10 @@ > return this.results.size(); > } > } >- class WaitingJob implements IJob { >- static final int MAX_WAIT = 30000; // wait 30s max >- Semaphore startingSem = new Semaphore(); >- Semaphore runningSem = new Semaphore(); >+ static class WaitingJob implements IJob { >+ private static final int MAX_WAIT = 30000; // wait 30s max >+ private Semaphore startingSem = new Semaphore(); >+ private Semaphore runningSem = new Semaphore(); > public boolean belongsTo(String jobFamily) { > return false; > } >@@ -124,9 +124,27 @@ > public String getJobFamily() { > return "SearchTests.Waiting"; > } >+ public void suspend() throws Semaphore.TimeOutException, CoreException { >+ runAndSuspend(null); >+ } >+ public void runAndSuspend(IWorkspaceRunnable runnable) throws Semaphore.TimeOutException, CoreException { >+ IndexManager indexManager = JavaModelManager.getIndexManager(); >+ indexManager.disable(); >+ if (runnable != null) { >+ runnable.run(null); >+ } >+ indexManager.request(this); >+ indexManager.enable(); >+ this.startingSem.acquire(30000); // wait for job to start (wait 30s max) >+ } >+ >+ public void resume() { >+ this.runningSem.release(); >+ JavaModelManager.getIndexManager().enable(); >+ } > } > static { >- TESTS_PREFIX = "testSearchPatternValidateMatchRule"; >+ //TESTS_PREFIX = "testSearchPatternValidateMatchRule"; > } > public static Test suite() { > return buildModelTestSuite(SearchTests.class); >@@ -235,26 +253,23 @@ > * a project causes another request to reindex. > */ > public void testChangeClasspath() throws CoreException, TimeOutException { >- IndexManager indexManager = JavaModelManager.getIndexManager(); > WaitingJob job = new WaitingJob(); > try { > // setup: suspend indexing and create a project (prj=src) with one cu >- indexManager.disable(); >- JavaCore.run(new IWorkspaceRunnable() { >+ job.runAndSuspend(new IWorkspaceRunnable() { > public void run(IProgressMonitor monitor) throws CoreException { >- createJavaProject("P1"); >- createFile( >- "/P1/X.java", >- "public class X {\n" + >- "}" >- ); >+ JavaCore.run(new IWorkspaceRunnable() { >+ public void run(IProgressMonitor monitor2) throws CoreException { >+ createJavaProject("P1"); >+ createFile( >+ "/P1/X.java", >+ "public class X {\n" + >+ "}" >+ ); >+ } >+ }, monitor); > } >- }, null); >- >- // add waiting job and wait for it to be executed >- indexManager.request(job); >- indexManager.enable(); >- job.startingSem.acquire(30000); // wait for job to start (wait 30s max) >+ }); > > // remove source folder from classpath > IJavaProject project = getJavaProject("P1"); >@@ -263,7 +278,7 @@ > null); > > // resume waiting job >- job.runningSem.release(); >+ job.resume(); > > assertAllTypes( > "Unexpected all types after removing source folder", >@@ -271,9 +286,8 @@ > "" > ); > } finally { >- job.runningSem.release(); >+ job.resume(); > deleteProject("P1"); >- indexManager.enable(); > } > } > /* >@@ -337,22 +351,19 @@ > * (regression test for bug 35306 Index update request can be incorrectly handled) > */ > public void testConcurrentJob() throws CoreException, InterruptedException, IOException, TimeOutException { >- IndexManager indexManager = JavaModelManager.getIndexManager(); > WaitingJob job = new WaitingJob(); > try { > // setup: suspend indexing and create a project with one empty jar on its classpath >- indexManager.disable(); >- JavaCore.run(new IWorkspaceRunnable() { >+ job.runAndSuspend(new IWorkspaceRunnable() { > public void run(IProgressMonitor monitor) throws CoreException { >- createJavaProject("P1", new String[] {}, new String[] {"/P1/jclMin.jar"}, "bin"); >- createFile("/P1/jclMin.jar", EMPTY_JAR); >+ JavaCore.run(new IWorkspaceRunnable() { >+ public void run(IProgressMonitor monitor2) throws CoreException { >+ createJavaProject("P1", new String[] {}, new String[] {"/P1/jclMin.jar"}, "bin"); >+ createFile("/P1/jclMin.jar", EMPTY_JAR); >+ } >+ }, monitor); > } >- }, null); >- >- // add waiting job and wait for it to be executed >- indexManager.request(job); >- indexManager.enable(); >- job.startingSem.acquire(30000); // wait for job to start (wait 30s max) >+ }); > > final IJavaProject project = getJavaProject("P1"); > >@@ -396,7 +407,7 @@ > getFile("/P1/jclMin.jar").setContents(new FileInputStream(getExternalJCLPathString()), IResource.NONE, null); > > // resume waiting job >- job.runningSem.release(); >+ job.resume(); > > // wait for concurrent job to finish > thread.join(10000); // 10s max >@@ -404,9 +415,8 @@ > assertTrue("Failed to get all types", success[0]); > > } finally { >- job.runningSem.release(); >+ job.resume(); > deleteProject("P1"); >- indexManager.enable(); > } > } > /* >@@ -415,14 +425,9 @@ > * (regression test for bug 33571 SearchEngine.searchAllTypeNames: NPE when passing null as progress monitor) > */ > public void testNullProgressMonitor() throws CoreException, TimeOutException { >- IndexManager indexManager = JavaModelManager.getIndexManager(); > WaitingJob job = new WaitingJob(); > try { >- // add waiting job and wait for it to be executed >- indexManager.disable(); >- indexManager.request(job); >- indexManager.enable(); >- job.startingSem.acquire(30000); // wait for job to start (wait 30s max) >+ job.suspend(); > > // query all type names with a null progress monitor > boolean operationCanceled = false; >@@ -437,7 +442,7 @@ > } > assertTrue("Should throw an OperationCanceledException", operationCanceled); > } finally { >- job.runningSem.release(); >+ job.resume(); > } > } > /*
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 210094
:
84493
| 84504