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 174594 Details for
Bug 309788
UserLibraryClasspathContainer should support referenced library entries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch
bug_309788.txt (text/plain), 4.32 KB, created by
Jay Arthanareeswaran
on 2010-07-19 03:10:13 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-07-19 03:10:13 EDT
Size:
4.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/UserLibrary.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibrary.java,v >retrieving revision 1.14 >diff -u -r1.14 UserLibrary.java >--- model/org/eclipse/jdt/internal/core/UserLibrary.java 27 Jun 2008 16:03:51 -0000 1.14 >+++ model/org/eclipse/jdt/internal/core/UserLibrary.java 15 Jul 2010 10:25:21 -0000 >@@ -110,7 +110,9 @@ > > for (int i = 0, length = entries.length; i < length; ++i) { > ClasspathEntry cpEntry = (ClasspathEntry) entries[i]; >- >+ if (cpEntry.getReferencingEntry() != null) { >+ continue; >+ } > HashMap archive = new HashMap(); > archive.put(TAG_PATH, cpEntry.getPath().toString()); > IPath sourceAttach= cpEntry.getSourceAttachmentPath(); >@@ -186,6 +188,10 @@ > attributeList = ClasspathEntry.getChildAttributes(ClasspathEntry.TAG_ACCESS_RULES, children, foundChildren); > IAccessRule[] accessRules = ClasspathEntry.decodeAccessRules(attributeList); > IClasspathEntry entry = JavaCore.newLibraryEntry(new Path(path), sourceAttach, sourceAttachRoot, accessRules, extraAttributes, false/*not exported*/); >+ IClasspathEntry[] referencedEntries = ((ClasspathEntry)entry).resolvedChainedLibraries(); >+ for (int index=0; index < referencedEntries.length; index++) { >+ res.add(referencedEntries[index]); >+ } > res.add(entry); > } > } >#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.215 >diff -u -r1.215 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 27 May 2010 10:10:45 -0000 1.215 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 15 Jul 2010 10:25:30 -0000 >@@ -6747,5 +6747,50 @@ > ContainerInitializer.setInitializer(null); > } > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=309788 >+public void testBug309788() throws Exception { >+ >+ try { >+ IJavaProject p = this.createJavaProject("P", new String[] {}, "bin"); >+ // Create new user library "SomeUserLibrary" >+ ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID); >+ String libraryName = "SomeUserLibrary"; >+ IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID); >+ UserLibraryClasspathContainer containerSuggestion = new UserLibraryClasspathContainer(libraryName); >+ initializer.requestClasspathContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); >+ >+ addExternalLibrary(p, getExternalResourcePath("lib1.jar"), new String[0], >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Class-Path: lib2.jar\n", >+ }, >+ JavaCore.VERSION_1_4); >+ >+ // Modify user library >+ IEclipsePreferences preferences = new InstanceScope().getNode(JavaCore.PLUGIN_ID); >+ String propertyName = JavaModelManager.CP_USERLIBRARY_PREFERENCES_PREFIX+"SomeUserLibrary"; >+ StringBuffer propertyValue = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<userlibrary systemlibrary=\"false\" version=\"1\">\r\n<archive"); >+ propertyValue.append(" path=\"" + getExternalResourcePath("lib1.jar")); >+ propertyValue.append("\"/>\r\n</userlibrary>\r\n"); >+ preferences.put(propertyName, propertyValue.toString()); >+ preferences.flush(); >+ >+ createExternalFile("lib2.jar", ""); >+ initializer.requestClasspathContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); >+ >+ IClasspathEntry[] entries = new IClasspathEntry[1]; >+ entries[0] = JavaCore.newContainerEntry(containerSuggestion.getPath()); >+ p.setRawClasspath(entries, null); >+ IClasspathEntry[] resolvedClasspath = p.getResolvedClasspath(true); >+ assertClasspathEquals(resolvedClasspath, >+ ""+ getExternalPath() + "lib2.jar[CPE_LIBRARY][K_BINARY][isExported:false]\n" + >+ ""+ getExternalPath() + "lib1.jar[CPE_LIBRARY][K_BINARY][isExported:false]"); >+ >+ } finally { >+ deleteProject("P"); >+ ContainerInitializer.setInitializer(null); >+ } >+} > > }
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 309788
: 174594