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 75957 Details for
Bug 169970
[model] code assist favorites must honour build path of project in context
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
169970.txt (text/plain), 3.19 KB, created by
Jerome Lanneluc
on 2007-08-13 10:32:44 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-08-13 10:32:44 EDT
Size:
3.19 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/NameLookup.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java,v >retrieving revision 1.116 >diff -u -r1.116 NameLookup.java >--- model/org/eclipse/jdt/internal/core/NameLookup.java 26 Jun 2007 11:05:36 -0000 1.116 >+++ model/org/eclipse/jdt/internal/core/NameLookup.java 13 Aug 2007 14:34:04 -0000 >@@ -164,9 +164,15 @@ > // ignore (implementation of HashtableOfArrayToObject supports cloning) > } > this.typesInWorkingCopies = new HashMap(); >+ HashSet rootsSet = new HashSet(); >+ for (int i = 0, length = packageFragmentRoots.length; i < length; i++) { >+ rootsSet.add(packageFragmentRoots[i]); >+ } > for (int i = 0, length = workingCopies.length; i < length; i++) { > ICompilationUnit workingCopy = workingCopies[i]; > PackageFragment pkg = (PackageFragment) workingCopy.getParent(); >+ if (!rootsSet.contains(pkg.getParent())) >+ continue; // working copy is not visible from this project (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=169970) > HashMap typeMap = (HashMap) this.typesInWorkingCopies.get(pkg); > if (typeMap == null) { > typeMap = new HashMap(); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java,v >retrieving revision 1.24 >diff -u -r1.24 NameLookupTests2.java >--- src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java 27 Apr 2007 16:02:33 -0000 1.24 >+++ src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java 13 Aug 2007 14:34:05 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.*; >+import org.eclipse.jdt.internal.core.DefaultWorkingCopyOwner; > import org.eclipse.jdt.internal.core.JavaProject; > import org.eclipse.jdt.internal.core.NameLookup; > >@@ -295,5 +296,33 @@ > deleteProject("P"); > } > } >+/* >+ * Ensures that a type in working copy opened in an unrelated project is not found >+ * (regression test for bug 169970 [model] code assist favorites must honour build path of project in context) >+ */ >+public void testFindTypeWithUnrelatedWorkingCopy() throws Exception { >+ ICompilationUnit workingCopy = null; >+ try { >+ createJavaProject("P1"); >+ createFolder("/P1/p"); >+ createFile( >+ "/P1/p/X.java", >+ "package p;\n" + >+ "public class X {\n" + >+ "}" >+ ); >+ workingCopy = getCompilationUnit("/P1/p/X.java"); >+ workingCopy.becomeWorkingCopy(null); >+ IJavaProject p2 = createJavaProject("P2"); >+ NameLookup nameLookup = ((JavaProject) p2).newNameLookup(DefaultWorkingCopyOwner.PRIMARY); >+ IType type = nameLookup.findType("p.X", false, NameLookup.ACCEPT_ALL); >+ assertNull("Should not find p.X in P2", type); >+ } finally { >+ if (workingCopy != null) >+ workingCopy.discardWorkingCopy(); >+ deleteProject("P1"); >+ deleteProject("P2"); >+ } >+} > } >
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 169970
: 75957