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 75670 Details for
Bug 199004
[search] Java Search in 'JRE libraries' finds matches in Application Libraries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 27.90 KB, created by
Frederic Fusier
on 2007-08-08 09:55:07 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2007-08-08 09:55:07 EDT
Size:
27.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java,v >retrieving revision 1.58 >diff -u -r1.58 JavaSearchScope.java >--- search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 12 Jul 2007 10:33:09 -0000 1.58 >+++ search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 8 Aug 2007 13:49:08 -0000 >@@ -149,8 +149,9 @@ > case IClasspathEntry.CPE_CONTAINER: > IClasspathContainer container = JavaCore.getClasspathContainer(rawEntry.getPath(), javaProject); > if (container == null) break; >- if ((container.getKind() == IClasspathContainer.K_APPLICATION && (includeMask & APPLICATION_LIBRARIES) != 0) >- || (includeMask & SYSTEM_LIBRARIES) != 0) { >+ int containerKind = container.getKind(); >+ if ((containerKind == IClasspathContainer.K_APPLICATION && (includeMask & APPLICATION_LIBRARIES) != 0) >+ || (containerKind == IClasspathContainer.K_SYSTEM && (includeMask & SYSTEM_LIBRARIES) != 0)) { > IPath path = entry.getPath(); > if (pathToAdd == null || pathToAdd.equals(path)) { > String pathToString = path.getDevice() == null ? path.toString() : path.toOSString(); >#P org.eclipse.jdt.core.tests.model >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.185 >diff -u -r1.185 AbstractJavaModelTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 27 Mar 2007 14:28:56 -0000 1.185 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 8 Aug 2007 13:49:09 -0000 >@@ -255,6 +255,13 @@ > actual > ); > } >+ protected void addClasspathEntry(IJavaProject project, IClasspathEntry entry) throws JavaModelException{ >+ IClasspathEntry[] entries = project.getRawClasspath(); >+ int length = entries.length; >+ System.arraycopy(entries, 0, entries = new IClasspathEntry[length + 1], 0, length); >+ entries[length] = entry; >+ project.setRawClasspath(entries, null); >+ } > protected void addLibrary(String jarName, String sourceZipName, String[] pathAndContents, String compliance) throws CoreException, IOException { > addLibrary(this.currentProject, jarName, sourceZipName, pathAndContents, null, null, compliance); > } >@@ -314,17 +321,14 @@ > ); > } > protected void addLibraryEntry(IJavaProject project, IPath path, IPath srcAttachmentPath, IPath srcAttachmentPathRoot, IPath[] accessibleFiles, IPath[] nonAccessibleFiles, IClasspathAttribute[] extraAttributes, boolean exported) throws JavaModelException{ >- IClasspathEntry[] entries = project.getRawClasspath(); >- int length = entries.length; >- System.arraycopy(entries, 0, entries = new IClasspathEntry[length + 1], 0, length); >- entries[length] = JavaCore.newLibraryEntry( >+ IClasspathEntry entry = JavaCore.newLibraryEntry( > path, > srcAttachmentPath, > srcAttachmentPathRoot, > ClasspathEntry.getAccessRules(accessibleFiles, nonAccessibleFiles), > extraAttributes, > exported); >- project.setRawClasspath(entries, null); >+ addClasspathEntry(project, entry); > } > protected void assertSortedElementsEqual(String message, String expected, IJavaElement[] elements) { > sortElements(elements); >@@ -1763,16 +1767,16 @@ > protected void removeLibrary(IJavaProject javaProject, String jarName, String sourceZipName) throws CoreException, IOException { > IProject project = javaProject.getProject(); > String projectPath = '/' + project.getName() + '/'; >- removeLibraryEntry(javaProject, new Path(projectPath + jarName)); >+ removeClasspathEntry(javaProject, new Path(projectPath + jarName)); > org.eclipse.jdt.core.tests.util.Util.delete(project.getFile(jarName)); > if (sourceZipName != null && sourceZipName.length() != 0) { > org.eclipse.jdt.core.tests.util.Util.delete(project.getFile(sourceZipName)); > } > } >- protected void removeLibraryEntry(IPath path) throws JavaModelException { >- removeLibraryEntry(this.currentProject, path); >+ protected void removeClasspathEntry(IPath path) throws JavaModelException { >+ removeClasspathEntry(this.currentProject, path); > } >- protected void removeLibraryEntry(IJavaProject project, IPath path) throws JavaModelException { >+ protected void removeClasspathEntry(IJavaProject project, IPath path) throws JavaModelException { > IClasspathEntry[] entries = project.getRawClasspath(); > int length = entries.length; > IClasspathEntry[] newEntries = null; >Index: src/org/eclipse/jdt/core/tests/model/ResolveTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java,v >retrieving revision 1.77 >diff -u -r1.77 ResolveTests.java >--- src/org/eclipse/jdt/core/tests/model/ResolveTests.java 28 Jun 2007 10:24:30 -0000 1.77 >+++ src/org/eclipse/jdt/core/tests/model/ResolveTests.java 8 Aug 2007 13:49:12 -0000 >@@ -1944,7 +1944,7 @@ > elements > ); > } finally { >- removeLibraryEntry(this.currentProject, new Path(jarName)); >+ removeClasspathEntry(this.currentProject, new Path(jarName)); > deleteFile(new File(jarName)); > } > } >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v >retrieving revision 1.113 >diff -u -r1.113 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 17 Jul 2007 06:24:16 -0000 1.113 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 8 Aug 2007 13:49:11 -0000 >@@ -6975,7 +6975,7 @@ > ); > } > finally { >- removeLibraryEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/b148215.jar")); >+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/b148215.jar")); > } > } > public void testBug148215_Messages() throws CoreException { >@@ -6990,7 +6990,7 @@ > ); > } > finally { >- removeLibraryEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/b148215.jar")); >+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/b148215.jar")); > } > } > public void testBug148215_Fields() throws CoreException { >@@ -7005,7 +7005,7 @@ > ); > } > finally { >- removeLibraryEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/b148215.jar")); >+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/b148215.jar")); > } > } > >@@ -8305,4 +8305,88 @@ > ); > } > >+/** >+ * @bug 199004: [search] Java Search in 'JRE libraries' finds matches in Application Libraries >+ * @test 1) That only match in system libraries are returned when SYSTEM_LIBRARIES is used in scope >+ * 2) That only match outside system libraries are returned when SYSTEM_LIBRARIES is NOT used in scope >+ * 3) That match in system libraries are returned when no mask is used in scope >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=199004" >+ * @throws CoreException >+ */ >+public void testBug199004_SystemLibraries() throws CoreException { >+ DefaultContainerInitializer intializer = new DefaultContainerInitializer(new String[] {"JavaSearchBugs", "/JavaSearchBugs/lib/b199004.jar"}) { >+ protected DefaultContainer newContainer(char[][] libPaths) { >+ return new DefaultContainer(libPaths) { >+ public int getKind() { >+ return IClasspathContainer.K_SYSTEM; >+ } >+ }; >+ } >+ }; >+ ContainerInitializer.setInitializer(intializer); >+ Path libPath = new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"); >+ addClasspathEntry(JAVA_PROJECT, JavaCore.newContainerEntry(libPath)); >+ try { >+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { JAVA_PROJECT }, IJavaSearchScope.SYSTEM_LIBRARIES); >+ search("length", IJavaSearchConstants.METHOD, IJavaSearchConstants.DECLARATIONS, scope); >+ assertSearchResults( >+ "lib/b199004.jar int Test.length() EXACT_MATCH" >+ ); >+ } >+ finally { >+ removeClasspathEntry(JAVA_PROJECT, libPath); >+ } >+} >+public void testBug199004_ApplicationLibraries() throws CoreException { >+ DefaultContainerInitializer intializer = new DefaultContainerInitializer(new String[] {"JavaSearchBugs", "/JavaSearchBugs/lib/b199004.jar"}) { >+ protected DefaultContainer newContainer(char[][] libPaths) { >+ return new DefaultContainer(libPaths) { >+ public int getKind() { >+ return IClasspathContainer.K_SYSTEM; >+ } >+ }; >+ } >+ }; >+ ContainerInitializer.setInitializer(intializer); >+ Path libPath = new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"); >+ addClasspathEntry(JAVA_PROJECT, JavaCore.newContainerEntry(libPath)); >+ try { >+ int mask = IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES | IJavaSearchScope.REFERENCED_PROJECTS; >+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { JAVA_PROJECT }, mask); >+ search("length", IJavaSearchConstants.METHOD, IJavaSearchConstants.DECLARATIONS, scope); >+ assertSearchResults( >+ ""+ getExternalJCLPathString("1.5") + " int java.lang.CharSequence.length() EXACT_MATCH\n" + >+ ""+ getExternalJCLPathString("1.5") + " int java.lang.String.length() EXACT_MATCH" >+ ); >+ } >+ finally { >+ removeClasspathEntry(JAVA_PROJECT, libPath); >+ } >+} >+public void testBug199004_NoMask() throws CoreException { >+ DefaultContainerInitializer intializer = new DefaultContainerInitializer(new String[] {"JavaSearchBugs", "/JavaSearchBugs/lib/b199004.jar"}) { >+ protected DefaultContainer newContainer(char[][] libPaths) { >+ return new DefaultContainer(libPaths) { >+ public int getKind() { >+ return IClasspathContainer.K_SYSTEM; >+ } >+ }; >+ } >+ }; >+ ContainerInitializer.setInitializer(intializer); >+ Path libPath = new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"); >+ addClasspathEntry(JAVA_PROJECT, JavaCore.newContainerEntry(libPath)); >+ try { >+ search("length", IJavaSearchConstants.METHOD, IJavaSearchConstants.DECLARATIONS); >+ assertSearchResults( >+ ""+ getExternalJCLPathString("1.5") + " int java.lang.CharSequence.length() EXACT_MATCH\n" + >+ ""+ getExternalJCLPathString("1.5") + " int java.lang.String.length() EXACT_MATCH\n" + >+ "lib/b199004.jar int Test.length() EXACT_MATCH" >+ ); >+ } >+ finally { >+ removeClasspathEntry(JAVA_PROJECT, libPath); >+ } >+} >+ > } >\ No newline at end of file >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java,v >retrieving revision 1.9 >diff -u -r1.9 JavaSearchScopeTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java 28 Apr 2007 13:53:11 -0000 1.9 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java 8 Aug 2007 13:49:11 -0000 >@@ -133,7 +133,7 @@ > */ > public void testApplicationLibrairiesClasspathContainer() throws CoreException { > try { >- ContainerInitializer.setInitializer(new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); > IJavaProject project = createJavaProject("P", new String[] {}, new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, ""); > IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}, IJavaSearchScope.APPLICATION_LIBRARIES); > assertScopeEquals( >@@ -151,7 +151,7 @@ > */ > public void testSystemLibraries() throws CoreException { > try { >- ClasspathInitializerTests.DefaultContainerInitializer intializer = new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"}) { >+ DefaultContainerInitializer intializer = new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"}) { > protected DefaultContainer newContainer(char[][] libPaths) { > return new DefaultContainer(libPaths) { > public int getKind() { >@@ -199,7 +199,7 @@ > public void testSourcesOrContainerReferencedProjects() throws CoreException { > try { > createJavaProject("P1"); >- ContainerInitializer.setInitializer(new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {"P2", "/P1"})); >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1"})); > IJavaProject project = createJavaProject("P2", new String[] {"src"}, new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, "bin"); > IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}, IJavaSearchScope.SOURCES | IJavaSearchScope.REFERENCED_PROJECTS); > assertScopeEquals( >Index: src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java,v >retrieving revision 1.50 >diff -u -r1.50 ClasspathInitializerTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 27 Jun 2007 14:28:23 -0000 1.50 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 8 Aug 2007 13:49:10 -0000 >@@ -17,7 +17,6 @@ > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; > import org.eclipse.jdt.core.*; >-import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.core.JavaModelManager; > import org.eclipse.jdt.internal.core.JavaModelStatus; > import org.eclipse.jdt.internal.core.UserLibraryClasspathContainer; >@@ -49,74 +48,6 @@ > } > } > >-public static class DefaultContainerInitializer implements ContainerInitializer.ITestInitializer { >- >- public static class DefaultContainer implements IClasspathContainer { >- char[][] libPaths; >- public DefaultContainer(char[][] libPaths) { >- this.libPaths = libPaths; >- } >- public IClasspathEntry[] getClasspathEntries() { >- int length = this.libPaths.length; >- IClasspathEntry[] entries = new IClasspathEntry[length]; >- for (int j = 0; j < length; j++) { >- IPath path = new Path(new String(this.libPaths[j])); >- if (path.segmentCount() == 1) { >- entries[j] = JavaCore.newProjectEntry(path); >- } else { >- entries[j] = JavaCore.newLibraryEntry(path, null, null); >- } >- } >- return entries; >- } >- public String getDescription() { >- return "Test container"; >- } >- public int getKind() { >- return IClasspathContainer.K_APPLICATION; >- } >- public IPath getPath() { >- return new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"); >- } >- } >- >- Map containerValues; >- CoreException exception; >- >- /* >- * values is [<project name>, <lib path>[,<lib path>]* ]* >- */ >- public DefaultContainerInitializer(String[] values) { >- containerValues = new HashMap(); >- for (int i = 0; i < values.length; i+=2) { >- final String projectName = values[i]; >- final char[][] libPaths = CharOperation.splitOn(',', values[i+1].toCharArray()); >- containerValues.put( >- projectName, >- newContainer(libPaths) >- ); >- } >- } >- protected DefaultContainer newContainer(final char[][] libPaths) { >- return new DefaultContainer(libPaths); >- } >- public boolean allowFailureContainer() { >- return true; >- } >- public void initialize(IPath containerPath, IJavaProject project) throws CoreException { >- if (containerValues == null) return; >- try { >- JavaCore.setClasspathContainer( >- containerPath, >- new IJavaProject[] {project}, >- new IClasspathContainer[] {(IClasspathContainer)containerValues.get(project.getElementName())}, >- null); >- } catch (CoreException e) { >- this.exception = e; >- throw e; >- } >- } >-} > // Simple container initializer, which keeps setting container to null > // (30920 - stackoverflow when setting container to null) > public class NullContainerInitializer implements ContainerInitializer.ITestInitializer { >@@ -485,7 +416,7 @@ > */ > public void testContainerInitializer09() throws CoreException { > try { >- ClasspathInitializerTests.DefaultContainerInitializer initializer = new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {"P1", "/P1/lib.jar"}) { >+ DefaultContainerInitializer initializer = new DefaultContainerInitializer(new String[] {"P1", "/P1/lib.jar"}) { > protected DefaultContainer newContainer(char[][] libPaths) { > return new DefaultContainer(libPaths) { > public IClasspathEntry[] getClasspathEntries() { >@@ -622,7 +553,7 @@ > new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, > ""); > simulateExitRestart(); >- ClasspathInitializerTests.DefaultContainerInitializer initializer = new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {}) { >+ DefaultContainerInitializer initializer = new DefaultContainerInitializer(new String[] {}) { > public void initialize(IPath containerPath,IJavaProject project) throws CoreException { > assertTrue("Should not initialize container on shutdown", false); > } >Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaModelCompletionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelCompletionTests.java,v >retrieving revision 1.10 >diff -u -r1.10 AbstractJavaModelCompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaModelCompletionTests.java 16 Mar 2007 18:35:32 -0000 1.10 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaModelCompletionTests.java 8 Aug 2007 13:49:09 -0000 >@@ -67,7 +67,7 @@ > IJavaProject javaProject = getJavaProject(projectName); > IProject project = javaProject.getProject(); > String projectPath = '/' + project.getName() + '/'; >- removeLibraryEntry(javaProject, new Path(projectPath + jarName)); >+ removeClasspathEntry(javaProject, new Path(projectPath + jarName)); > } > public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException { > return super.getWorkingCopy(path, source, this.wcOwner); >Index: src/org/eclipse/jdt/core/tests/model/JavaModelTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelTests.java,v >retrieving revision 1.23 >diff -u -r1.23 JavaModelTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaModelTests.java 27 Apr 2007 16:02:33 -0000 1.23 >+++ src/org/eclipse/jdt/core/tests/model/JavaModelTests.java 8 Aug 2007 13:49:10 -0000 >@@ -17,7 +17,6 @@ > import org.eclipse.core.runtime.OperationCanceledException; > import org.eclipse.core.runtime.jobs.ISchedulingRule; > import org.eclipse.jdt.core.*; >-import org.eclipse.jdt.core.tests.model.ClasspathInitializerTests.DefaultContainerInitializer; > > import junit.framework.Test; > /** >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java,v >retrieving revision 1.35 >diff -u -r1.35 CompletionTests2.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests2.java 6 Mar 2007 04:43:19 -0000 1.35 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests2.java 8 Aug 2007 13:49:10 -0000 >@@ -2331,7 +2331,7 @@ > "doit2C[METHOD_REF]{doit2C, Lpack.Util;, (I)V, doit2C, "+(R_DEFAULT + R_RESOLVED + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}", > requestor.getResults()); > } finally { >- removeLibraryEntry(this.currentProject, new Path(jarName)); >+ removeClasspathEntry(this.currentProject, new Path(jarName)); > deleteFile(new File(jarName)); > } > } >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.117 >diff -u -r1.117 ReconcilerTests.java >--- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 27 Mar 2007 14:28:56 -0000 1.117 >+++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 8 Aug 2007 13:49:12 -0000 >@@ -867,7 +867,7 @@ > "----------\n" > ); > } finally { >- removeLibraryEntry(project, new Path(jarPath)); >+ removeClasspathEntry(project, new Path(jarPath)); > deleteFile(new File(jarPath)); > } > } >@@ -960,7 +960,7 @@ > "----------\n" > ); > } finally { >- removeLibraryEntry(project, new Path(jarName)); >+ removeClasspathEntry(project, new Path(jarName)); > deleteFile(new File(jarName)); > } > } >@@ -1281,7 +1281,7 @@ > this.workingCopy.discardWorkingCopy(); // don't use the one created in setUp() > this.workingCopy = null; > this.problemRequestor = new ProblemRequestor(); >- ContainerInitializer.setInitializer(new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {" ", getExternalJCLPathString()})); >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {" ", getExternalJCLPathString()})); > IClasspathEntry[] classpath = new IClasspathEntry[] { > JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER")) > }; >Index: src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java,v >retrieving revision 1.48 >diff -u -r1.48 AttachSourceTests.java >--- src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java 27 Apr 2007 16:02:33 -0000 1.48 >+++ src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java 8 Aug 2007 13:49:10 -0000 >@@ -1149,7 +1149,7 @@ > } > } > } finally { >- removeLibraryEntry(new Path("/JavaSearchBugs/lib/b148215.jar")); >+ removeClasspathEntry(new Path("/JavaSearchBugs/lib/b148215.jar")); > root.close(); > } > } >Index: src/org/eclipse/jdt/core/tests/model/ThreadSafetyTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ThreadSafetyTests.java,v >retrieving revision 1.18 >diff -u -r1.18 ThreadSafetyTests.java >--- src/org/eclipse/jdt/core/tests/model/ThreadSafetyTests.java 29 Mar 2006 04:03:07 -0000 1.18 >+++ src/org/eclipse/jdt/core/tests/model/ThreadSafetyTests.java 8 Aug 2007 13:49:12 -0000 >@@ -59,7 +59,7 @@ > final Semaphore step2 = new Semaphore("<2:permission to perform resource modification >", 0); // first acquisition to wait > final Semaphore hasCompleted = new Semaphore(0); > >- ContainerInitializer.setInitializer(new ClasspathInitializerTests.DefaultContainerInitializer(new String[] {"P", ""}){ >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", ""}){ > public void initialize(IPath containerPath, IJavaProject javaProject) throws CoreException { > step2.release(); > System.out.println(Thread.currentThread() + " initializer has started: attempting to acquire workspace lock"); >Index: src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java,v >retrieving revision 1.84 >diff -u -r1.84 JavaProjectTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java 26 Apr 2007 13:19:24 -0000 1.84 >+++ src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java 8 Aug 2007 13:49:10 -0000 >@@ -23,7 +23,6 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; > import org.eclipse.jdt.core.*; >-import org.eclipse.jdt.core.tests.model.ClasspathInitializerTests.DefaultContainerInitializer; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.core.JavaModelManager; > import org.eclipse.jdt.internal.core.PackageFragmentRoot; >Index: src/org/eclipse/jdt/core/tests/model/DefaultContainerInitializer.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/model/DefaultContainerInitializer.java >diff -N src/org/eclipse/jdt/core/tests/model/DefaultContainerInitializer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/model/DefaultContainerInitializer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,92 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.model; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.jdt.core.IClasspathContainer; >+import org.eclipse.jdt.core.IClasspathEntry; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.core.compiler.CharOperation; >+ >+public class DefaultContainerInitializer implements ContainerInitializer.ITestInitializer { >+ >+ public static class DefaultContainer implements IClasspathContainer { >+ char[][] libPaths; >+ public DefaultContainer(char[][] libPaths) { >+ this.libPaths = libPaths; >+ } >+ public IClasspathEntry[] getClasspathEntries() { >+ int length = this.libPaths.length; >+ IClasspathEntry[] entries = new IClasspathEntry[length]; >+ for (int j = 0; j < length; j++) { >+ IPath path = new Path(new String(this.libPaths[j])); >+ if (path.segmentCount() == 1) { >+ entries[j] = JavaCore.newProjectEntry(path); >+ } else { >+ entries[j] = JavaCore.newLibraryEntry(path, null, null); >+ } >+ } >+ return entries; >+ } >+ public String getDescription() { >+ return "Test container"; >+ } >+ public int getKind() { >+ return IClasspathContainer.K_APPLICATION; >+ } >+ public IPath getPath() { >+ return new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"); >+ } >+ } >+ >+ Map containerValues; >+ CoreException exception; >+ >+ /* >+ * values is [<project name>, <lib path>[,<lib path>]* ]* >+ */ >+ public DefaultContainerInitializer(String[] values) { >+ containerValues = new HashMap(); >+ for (int i = 0; i < values.length; i+=2) { >+ final String projectName = values[i]; >+ final char[][] libPaths = CharOperation.splitOn(',', values[i+1].toCharArray()); >+ containerValues.put( >+ projectName, >+ newContainer(libPaths) >+ ); >+ } >+ } >+ protected DefaultContainerInitializer.DefaultContainer newContainer(final char[][] libPaths) { >+ return new DefaultContainer(libPaths); >+ } >+ public boolean allowFailureContainer() { >+ return true; >+ } >+ public void initialize(IPath containerPath, IJavaProject project) throws CoreException { >+ if (containerValues == null) return; >+ try { >+ JavaCore.setClasspathContainer( >+ containerPath, >+ new IJavaProject[] {project}, >+ new IClasspathContainer[] {(IClasspathContainer)containerValues.get(project.getElementName())}, >+ null); >+ } catch (CoreException e) { >+ this.exception = e; >+ throw e; >+ } >+ } >+}
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 199004
: 75670 |
75671
|
75734