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 62072 Details for
Bug 179258
simple reconcile starts problem finder - main thread waiting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
New proposed fix and regression test
179258b.txt (text/plain), 13.43 KB, created by
Jerome Lanneluc
on 2007-03-27 07:14:14 EDT
(
hide
)
Description:
New proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-03-27 07:14:14 EDT
Size:
13.43 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.116 >diff -u -r1.116 ReconcilerTests.java >--- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 26 Mar 2007 10:43:15 -0000 1.116 >+++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 27 Mar 2007 10:38:53 -0000 >@@ -592,19 +592,14 @@ > this.deltaListener.getCompilationUnitAST(this.workingCopy)); > } > /* >- * Ensures that the AST broadcasted during a reconcile operation is correct. >- * (case of a working copy being reconciled with NO changes, creating AST and no problem detection) >+ * Ensures that no AST is broadcasted during a reconcile operation if the working copy being reconciled >+ * has NO changes and NO problem detection is requested) > */ > public void testBroadcastAST3() throws JavaModelException { > this.workingCopy.reconcile(AST.JLS3, false/*don't force problem detection*/, null/*primary owner*/, null/*no progress*/); > assertASTNodeEquals( > "Unexpected ast", >- "package p1;\n" + >- "import p2.*;\n" + >- "public class X {\n" + >- " public void foo(){\n" + >- " }\n" + >- "}\n", >+ "null", > this.deltaListener.getCompilationUnitAST(this.workingCopy)); > } > /* >@@ -2260,6 +2255,19 @@ > ); > } > /* >+ * Ensures that the problem requestor is not called when the source >+ * to reconcile is the same as the current contents, >+ * no ast is requested, no problem is requested and problem requestor is not active. >+ * (regression test for bug 179258 simple reconcile starts problem finder - main thread waiting) >+ * >+ */ >+public void testNoChanges3() throws JavaModelException { >+ setWorkingCopyContents(this.workingCopy.getSource()); >+ this.problemRequestor.isActive = false; >+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, null, null); >+ assertProblems("Unexpected problems", ""); >+} >+/* > * Ensures that using a non-generic method with no parameter and with a raw receiver type doesn't create a type safety warning > * (regression test for bug 105756 [1.5][model] Incorrect warning on using raw types) > */ >Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java,v >retrieving revision 1.183 >diff -u -r1.183 AbstractJavaModelTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 26 Mar 2007 10:43:15 -0000 1.183 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 27 Mar 2007 10:38:52 -0000 >@@ -70,6 +70,7 @@ > public StringBuffer problems; > public int problemCount; > protected char[] unitSource; >+ public boolean isActive = true; > public ProblemRequestor() { > initialize(null); > } >@@ -85,7 +86,7 @@ > this.problems.append("----------\n"); > } > public boolean isActive() { >- return true; >+ return this.isActive; > } > public void initialize(char[] source) { > this.problems = new StringBuffer(); >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/core/compiler/ReconcileContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java,v >retrieving revision 1.9 >diff -u -r1.9 ReconcileContext.java >--- model/org/eclipse/jdt/core/compiler/ReconcileContext.java 16 Mar 2007 18:28:59 -0000 1.9 >+++ model/org/eclipse/jdt/core/compiler/ReconcileContext.java 27 Mar 2007 10:38:54 -0000 >@@ -98,7 +98,7 @@ > parser.setSource(workingCopy); > return (org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(this.operation.progressMonitor); > } >- return this.operation.makeConsistent(this.workingCopy, null/*don't report problems to the working copy's problem requestor*/); >+ return this.operation.makeConsistent(this.workingCopy); > } > > /** >Index: model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java,v >retrieving revision 1.45 >diff -u -r1.45 ReconcileWorkingCopyOperation.java >--- model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java 15 Mar 2007 16:06:40 -0000 1.45 >+++ model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java 27 Mar 2007 10:38:54 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.jdt.core.compiler.CompilationParticipant; > import org.eclipse.jdt.core.compiler.ReconcileContext; > import org.eclipse.jdt.core.dom.AST; >+import org.eclipse.jdt.core.dom.ASTParser; > import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; > import org.eclipse.jdt.internal.core.util.Messages; > import org.eclipse.jdt.internal.core.util.Util; >@@ -52,6 +53,7 @@ > WorkingCopyOwner workingCopyOwner; > public org.eclipse.jdt.core.dom.CompilationUnit ast; > public JavaElementDeltaBuilder deltaBuilder; >+ public boolean requestorIsActive; > > public ReconcileWorkingCopyOperation(IJavaElement workingCopy, int astLevel, int reconcileFlags, WorkingCopyOwner workingCopyOwner) { > super(new IJavaElement[] {workingCopy}); >@@ -71,34 +73,38 @@ > > CompilationUnit workingCopy = getWorkingCopy(); > boolean wasConsistent = workingCopy.isConsistent(); >+ >+ // check is problem requestor is active > IProblemRequestor problemRequestor = workingCopy.getPerWorkingCopyInfo(); >- if (problemRequestor != null) { >+ if (problemRequestor != null) > problemRequestor = ((JavaModelManager.PerWorkingCopyInfo)problemRequestor).getProblemRequestor(); >- } >+ boolean defaultRequestorIsActive = problemRequestor != null && problemRequestor.isActive(); > IProblemRequestor ownerProblemRequestor = this.workingCopyOwner.getProblemRequestor(workingCopy); >- this.resolveBindings |= problemRequestor != null && problemRequestor.isActive(); >+ boolean ownerRequestorIsActive = ownerProblemRequestor != null && ownerProblemRequestor != problemRequestor && ownerProblemRequestor.isActive(); >+ this.requestorIsActive = defaultRequestorIsActive || ownerRequestorIsActive; > > // create the delta builder (this remembers the current content of the cu) > this.deltaBuilder = new JavaElementDeltaBuilder(workingCopy); > > // make working copy consistent if needed and compute AST if needed >- makeConsistent(workingCopy, problemRequestor); >+ makeConsistent(workingCopy); > > // notify reconcile participants only if working copy was not consistent or if forcing problem detection > // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=177319) >- if (!wasConsistent || ((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0)) >- notifyParticipants(workingCopy); >+ if (!wasConsistent || ((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0)) { >+ notifyParticipants(workingCopy); > >- // recreate ast if needed >- if (this.ast == null && (this.astLevel > ICompilationUnit.NO_AST || this.resolveBindings)) >- makeConsistent(workingCopy, problemRequestor); >+ // recreate ast if one participant reset it >+ if (this.ast == null) >+ makeConsistent(workingCopy); >+ } > > // report problems > if (this.problems != null && (((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0) || !wasConsistent)) { >- if (problemRequestor != null) { >+ if (defaultRequestorIsActive) { > reportProblems(workingCopy, problemRequestor); > } >- if (ownerProblemRequestor != null && ownerProblemRequestor != problemRequestor) { >+ if (ownerRequestorIsActive) { > reportProblems(workingCopy, ownerProblemRequestor); > } > } >@@ -157,75 +163,76 @@ > * Makes the given working copy consistent, computes the delta and computes an AST if needed. > * Returns the AST. > */ >- public org.eclipse.jdt.core.dom.CompilationUnit makeConsistent(CompilationUnit workingCopy, IProblemRequestor problemRequestor) throws JavaModelException { >+ public org.eclipse.jdt.core.dom.CompilationUnit makeConsistent(CompilationUnit workingCopy) throws JavaModelException { > if (!workingCopy.isConsistent()) { > // make working copy consistent > if (this.problems == null) this.problems = new HashMap(); >+ this.resolveBindings = this.requestorIsActive; > this.ast = workingCopy.makeConsistent(this.astLevel, this.resolveBindings, reconcileFlags, this.problems, this.progressMonitor); > this.deltaBuilder.buildDeltas(); > if (this.ast != null && this.deltaBuilder.delta != null) > this.deltaBuilder.delta.changedAST(this.ast); > return this.ast; > } >- if (this.ast != null) return this.ast; // no need to recompute AST if known already >- if (((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0) || this.resolveBindings) { >- if (JavaProject.hasJavaNature(workingCopy.getJavaProject().getProject())) { >- HashMap problemMap; >- if (this.problems == null) { >- problemMap = new HashMap(); >- if ((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0) >- this.problems = problemMap; >- } else >- problemMap = this.problems; >- CompilationUnitDeclaration unit = null; >- try { >- // find problems >- char[] contents = workingCopy.getContents(); >- unit = >- CompilationUnitProblemFinder.process( >- workingCopy, >- contents, >- this.workingCopyOwner, >- problemMap, >- this.astLevel != ICompilationUnit.NO_AST/*creating AST if level is not NO_AST */, >- reconcileFlags, >- this.progressMonitor); >- if (this.progressMonitor != null) this.progressMonitor.worked(1); >- >- // create AST if needed >- if (this.astLevel != ICompilationUnit.NO_AST && unit != null) { >- Map options = workingCopy.getJavaProject().getOptions(true); >- this.ast = >- AST.convertCompilationUnit( >- this.astLevel, >- unit, >- contents, >- options, >- true/*isResolved*/, >- workingCopy, >- reconcileFlags, >- this.progressMonitor); >- if (this.ast != null) { >- this.deltaBuilder.delta = new JavaElementDelta(workingCopy); >- this.deltaBuilder.delta.changedAST(this.ast); >- } >- if (this.progressMonitor != null) this.progressMonitor.worked(1); >- } >- } catch (JavaModelException e) { >- if (JavaProject.hasJavaNature(workingCopy.getJavaProject().getProject())) >- throw e; >- // else JavaProject has lost its nature (or most likely was closed/deleted) while reconciling -> ignore >- // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=100919) >- } finally { >- if (unit != null) { >- unit.cleanUp(); >- } >- } >- } // else working copy not in a Java project >- return this.ast; >- } >- return null; >+ if (this.ast != null) >+ return this.ast; // no need to recompute AST if known already >+ >+ CompilationUnitDeclaration unit = null; >+ char[] contents = null; >+ try { >+ // find problems if needed >+ if (JavaProject.hasJavaNature(workingCopy.getJavaProject().getProject()) >+ && (this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0) { >+ this.resolveBindings = this.requestorIsActive; >+ if (this.problems == null) >+ this.problems = new HashMap(); >+ contents = workingCopy.getContents(); >+ unit = >+ CompilationUnitProblemFinder.process( >+ workingCopy, >+ contents, >+ this.workingCopyOwner, >+ this.problems, >+ this.astLevel != ICompilationUnit.NO_AST/*creating AST if level is not NO_AST */, >+ reconcileFlags, >+ this.progressMonitor); >+ if (this.progressMonitor != null) this.progressMonitor.worked(1); >+ } >+ >+ // create AST if needed >+ if (this.astLevel != ICompilationUnit.NO_AST >+ && unit !=null/*unit is null if working copy is consistent && (problem detection not forced || non-Java project) -> don't create AST as per API*/) { >+ Map options = workingCopy.getJavaProject().getOptions(true); >+ // convert AST >+ this.ast = >+ AST.convertCompilationUnit( >+ this.astLevel, >+ unit, >+ contents, >+ options, >+ this.resolveBindings, >+ workingCopy, >+ reconcileFlags, >+ this.progressMonitor); >+ if (this.ast != null) { >+ this.deltaBuilder.delta = new JavaElementDelta(workingCopy); >+ this.deltaBuilder.delta.changedAST(this.ast); >+ } >+ if (this.progressMonitor != null) this.progressMonitor.worked(1); >+ } >+ } catch (JavaModelException e) { >+ if (JavaProject.hasJavaNature(workingCopy.getJavaProject().getProject())) >+ throw e; >+ // else JavaProject has lost its nature (or most likely was closed/deleted) while reconciling -> ignore >+ // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=100919) >+ } finally { >+ if (unit != null) { >+ unit.cleanUp(); >+ } >+ } >+ return this.ast; > } >+ > private void notifyParticipants(final CompilationUnit workingCopy) { > IJavaProject javaProject = getWorkingCopy().getJavaProject(); > CompilationParticipant[] participants = JavaModelManager.getJavaModelManager().compilationParticipants.getCompilationParticipants(javaProject);
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 179258
:
62064
| 62072