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 165408 Details for
Bug 305037
missing story for attributes of referenced JARs in classpath containers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch with renamed tests
patch_305037.txt (text/plain), 11.91 KB, created by
Jay Arthanareeswaran
on 2010-04-20 06:59:03 EDT
(
hide
)
Description:
Patch with renamed tests
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-04-20 06:59:03 EDT
Size:
11.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaProject.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v >retrieving revision 1.431 >diff -u -r1.431 JavaProject.java >--- model/org/eclipse/jdt/internal/core/JavaProject.java 8 Apr 2010 17:57:19 -0000 1.431 >+++ model/org/eclipse/jdt/internal/core/JavaProject.java 15 Apr 2010 05:59:09 -0000 >@@ -2596,8 +2596,10 @@ > referencedEntriesSet.add(referencedEntries[index]); > } > } >- result.referencedEntries = new IClasspathEntry[referencedEntriesSet.size()]; >- referencedEntriesSet.toArray(result.referencedEntries); >+ if (referencedEntriesSet.size() > 0) { >+ result.referencedEntries = new IClasspathEntry[referencedEntriesSet.size()]; >+ referencedEntriesSet.toArray(result.referencedEntries); >+ } > } > } > >@@ -2629,6 +2631,8 @@ > ClasspathEntry[] extraEntries = ((ClasspathEntry) resolvedEntry).resolvedChainedLibraries(); > for (int j = 0, length2 = extraEntries.length; j < length2; j++) { > if (!rawLibrariesPath.contains(extraEntries[j].getPath())) { >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305037 >+ // referenced entries for variable entries could also be persisted with extra attributes, so addAsChainedEntry = true > addToResult(rawEntry, extraEntries[j], result, resolvedEntries, externalFoldersManager, referencedEntriesMap, true); > } > } >@@ -2667,16 +2671,8 @@ > if (cEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { > // resolve ".." in library path > cEntry = cEntry.resolvedDotDot(); >- >- if (resolveChainedLibraries && result.rawReverseMap.get(cEntry.getPath()) == null) { >- // resolve Class-Path: in manifest >- ClasspathEntry[] extraEntries = cEntry.resolvedChainedLibraries(); >- for (int k = 0, length2 = extraEntries.length; k < length2; k++) { >- if (!rawLibrariesPath.contains(extraEntries[k].getPath())) { >- addToResult(rawEntry, extraEntries[k], result, resolvedEntries, externalFoldersManager, referencedEntriesMap, true); >- } >- } >- } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305037 >+ // responsibility of resolving chained (referenced) libraries lies with the container > } > addToResult(rawEntry, cEntry, result, resolvedEntries, externalFoldersManager, referencedEntriesMap, false); > } >@@ -2720,14 +2716,11 @@ > resolvedEntries.add(resolvedEntry); > if (addAsChainedEntry) { > IClasspathEntry chainedEntry = null; >- if (rawEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { >- >- chainedEntry = (ClasspathEntry) oldChainedEntriesMap.get(resolvedPath); >- if (chainedEntry != null) { >- // This is required to keep the attributes if any added by the user in >- // the previous session such as source attachment path etc. >- copyFromOldChainedEntry((ClasspathEntry) resolvedEntry, (ClasspathEntry) chainedEntry); >- } >+ chainedEntry = (ClasspathEntry) oldChainedEntriesMap.get(resolvedPath); >+ if (chainedEntry != null) { >+ // This is required to keep the attributes if any added by the user in >+ // the previous session such as source attachment path etc. >+ copyFromOldChainedEntry((ClasspathEntry) resolvedEntry, (ClasspathEntry) chainedEntry); > } > } > } >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v >retrieving revision 1.213 >diff -u -r1.213 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 12 Apr 2010 10:04:10 -0000 1.213 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 15 Apr 2010 05:59:22 -0000 >@@ -6433,15 +6433,14 @@ > } > } > /** >- * @bug 304081:IJavaProject#isOnClasspath(IJavaElement) returns false for type from referenced JAR >- * When the JAR, which a variable classpath entry resolves to, references other JAR via >- * MANIFEST, test that {@link IJavaProject#isOnClasspath(IJavaElement)} returns true >- * for the referenced classpath entries. >+ * @bug 252431: Additional tests >+ * Test that attributes set on referenced libraries of variable entries via MANIFEST are persisted >+ * and can be retrieved > * >- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=304081" >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=252431" > * @throws Exception > */ >-public void testBug304081() throws Exception { >+public void testBug252431d() throws Exception { > File libDir = null; > try { > >@@ -6463,55 +6462,67 @@ > > createFile("/P/lib1.jar", ""); > >- classpath[0] = JavaCore.newVariableEntry(new Path( >- "/MyVar/variable.jar"), null, null); >- >- proj.setRawClasspath(classpath, null); >- waitForAutoBuild(); >- IProject project = getWorkspaceRoot().getProject("P"); >- IResource resource = project.getFile("variable.jar"); >- assertTrue(proj.isOnClasspath(resource)); >- IJavaElement element = proj.getPackageFragmentRoot(resource); >- assertTrue(proj.isOnClasspath(element)); >- >- resource = project.getFile("lib1.jar"); >- assertTrue(proj.isOnClasspath(resource)); >- element = proj.getPackageFragmentRoot(resource); >- assertTrue(proj.isOnClasspath(element)); >+ classpath = proj.getResolvedClasspath(true); >+ assertClasspathEquals(classpath, >+ "/P/lib1.jar[CPE_LIBRARY][K_BINARY][isExported:true]\n" + >+ "/P/variable.jar[CPE_LIBRARY][K_BINARY][isExported:true]"); >+ >+ IClasspathEntry[] chains = JavaCore.getReferencedClasspathEntries(classpath[1], null); >+ assertClasspathEquals(chains, "/P/lib1.jar[CPE_LIBRARY][K_BINARY][isExported:true]"); >+ ((ClasspathEntry)chains[0]).sourceAttachmentPath = new Path("/P/efg.zip"); >+ ((ClasspathEntry)chains[0]).sourceAttachmentRootPath = new Path("/src2"); >+ >+ IClasspathAttribute javadocLoc = JavaCore.newClasspathAttribute("javadoc_location", "/P/efg.zip"); >+ ((ClasspathEntry)chains[0]).extraAttributes = new IClasspathAttribute[]{javadocLoc}; >+ >+ proj.setRawClasspath(proj.getRawClasspath(), chains, proj.getOutputLocation(), null); >+ classpath = proj.getResolvedClasspath(true); >+ assertClasspathEquals(classpath, >+ "/P/lib1.jar[CPE_LIBRARY][K_BINARY][sourcePath:/P/efg.zip][rootPath:/src2][isExported:true][attributes:javadoc_location=/P/efg.zip]\n" + >+ "/P/variable.jar[CPE_LIBRARY][K_BINARY][isExported:true]"); > } finally { > this.deleteProject("P"); > JavaCore.removeClasspathVariable("MyVar", null); > } > } > /** >- * Additional tests for 304081 >- * When the JAR, which is in the raw classpath, references other JAR via >+ * @bug 304081:IJavaProject#isOnClasspath(IJavaElement) returns false for type from referenced JAR >+ * When the JAR, which a variable classpath entry resolves to, references other JAR via > * MANIFEST, test that {@link IJavaProject#isOnClasspath(IJavaElement)} returns true > * for the referenced classpath entries. > * > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=304081" > * @throws Exception > */ >-public void testBug304081a() throws Exception { >+public void testBug304081() throws Exception { >+ File libDir = null; > try { > > IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin"); >+ IPath libPath = proj.getResource().getLocation(); >+ JavaCore.setClasspathVariable("MyVar", libPath, null); >+ libDir = new File(libPath.toPortableString()); > IClasspathEntry[] classpath = new IClasspathEntry[1]; >- >- addLibrary(proj, "library.jar", null, new String[0], >+ File libJar = new File(libDir, "variable.jar"); >+ libJar.createNewFile(); >+ >+ addLibrary(proj, "variable.jar", null, new String[0], > new String[] { >- "META-INF/MANIFEST.MF", >- "Manifest-Version: 1.0\n" + >- "Class-Path: lib1.jar\n", >- }, >- JavaCore.VERSION_1_4); >- createFile("/P/lib1.jar", ""); >- classpath[0] = JavaCore.newLibraryEntry(new Path("/P/library.jar"), null, null); >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Class-Path: lib1.jar\n", >+ }, >+ JavaCore.VERSION_1_4); >+ >+ createFile("/P/lib1.jar", ""); >+ >+ classpath[0] = JavaCore.newVariableEntry(new Path( >+ "/MyVar/variable.jar"), null, null); > > proj.setRawClasspath(classpath, null); > waitForAutoBuild(); > IProject project = getWorkspaceRoot().getProject("P"); >- IResource resource = project.getFile("library.jar"); >+ IResource resource = project.getFile("variable.jar"); > assertTrue(proj.isOnClasspath(resource)); > IJavaElement element = proj.getPackageFragmentRoot(resource); > assertTrue(proj.isOnClasspath(element)); >@@ -6522,55 +6533,38 @@ > assertTrue(proj.isOnClasspath(element)); > } finally { > this.deleteProject("P"); >+ JavaCore.removeClasspathVariable("MyVar", null); > } > } > /** > * Additional tests for 304081 >- * When the JAR, which is part of a classpath container, references other JAR via >+ * When the JAR, which is in the raw classpath, references other JAR via > * MANIFEST, test that {@link IJavaProject#isOnClasspath(IJavaElement)} returns true > * for the referenced classpath entries. > * > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=304081" > * @throws Exception > */ >-public void testBug304081b() throws Exception { >- File libDir = null; >+public void testBug304081a() throws Exception { > try { > > IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin"); > IClasspathEntry[] classpath = new IClasspathEntry[1]; >- libDir = new File(proj.getResource().getLocation().toPortableString()); >- File libJar = new File(libDir, "container.jar"); >- >- addLibrary(proj, "container.jar", null, new String[0], >+ >+ addLibrary(proj, "library.jar", null, new String[0], > new String[] { > "META-INF/MANIFEST.MF", > "Manifest-Version: 1.0\n" + > "Class-Path: lib1.jar\n", > }, > JavaCore.VERSION_1_4); >- createFile("/P/lib1.jar", ""); >- >- ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID); >- String libraryName = "TestUserLibrary"; >- IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID); >- UserLibraryClasspathContainer containerSuggestion = new UserLibraryClasspathContainer(libraryName); >- initializer.requestClasspathContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); >- >- IEclipsePreferences preferences = new InstanceScope().getNode(JavaCore.PLUGIN_ID); >- String propertyName = JavaModelManager.CP_USERLIBRARY_PREFERENCES_PREFIX+"TestUserLibrary"; >- StringBuffer propertyValue = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<userlibrary systemlibrary=\"false\" version=\"1\">\r\n<archive"); >- propertyValue.append(" path=\"" + libJar.getAbsolutePath()); >- propertyValue.append("\"/>\r\n</userlibrary>\r\n"); >- preferences.put(propertyName, propertyValue.toString()); >- preferences.flush(); >- >- classpath[0] = JavaCore.newContainerEntry(containerSuggestion.getPath()); >+ createFile("/P/lib1.jar", ""); >+ classpath[0] = JavaCore.newLibraryEntry(new Path("/P/library.jar"), null, null); > > proj.setRawClasspath(classpath, null); > waitForAutoBuild(); > IProject project = getWorkspaceRoot().getProject("P"); >- IResource resource = project.getFile("container.jar"); >+ IResource resource = project.getFile("library.jar"); > assertTrue(proj.isOnClasspath(resource)); > IJavaElement element = proj.getPackageFragmentRoot(resource); > assertTrue(proj.isOnClasspath(element)); >@@ -6579,7 +6573,6 @@ > assertTrue(proj.isOnClasspath(resource)); > element = proj.getPackageFragmentRoot(resource); > assertTrue(proj.isOnClasspath(element)); >- > } finally { > this.deleteProject("P"); > }
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 305037
:
164932
| 165408