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 170061 Details for
Bug 313965
Breaking change in classpath container API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch_313965.txt (text/plain), 7.28 KB, created by
Jay Arthanareeswaran
on 2010-05-26 14:00:16 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-05-26 14:00:16 EDT
Size:
7.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.451 >diff -u -r1.451 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 20 May 2010 14:12:01 -0000 1.451 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 26 May 2010 17:54:24 -0000 >@@ -212,6 +212,11 @@ > public static final String ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID = "annotationProcessorManager" ; //$NON-NLS-1$ > > /** >+ * Name of the JVM parameter to specify whether or not referenced JAR should be resolved for container libraries. >+ */ >+ public static final String RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS = "resolveReferencedLibrariesForContainers"; //$NON-NLS-1$ >+ >+ /** > * Special value used for recognizing ongoing initialization and breaking initialization cycles > */ > public final static IPath VARIABLE_INITIALIZATION_IN_PROGRESS = new Path("Variable Initialization In Progress"); //$NON-NLS-1$ >@@ -257,6 +262,8 @@ > > public static boolean PERF_VARIABLE_INITIALIZER = false; > public static boolean PERF_CONTAINER_INITIALIZER = false; >+ // Non-static, which will give it a chance to retain the default when and if JavaModelManager is restarted. >+ boolean resolveReferencedLibrariesForContainers = false; > > public final static ICompilationUnit[] NO_WORKING_COPY = new ICompilationUnit[0]; > >@@ -1541,6 +1548,11 @@ > this.indexManager = new IndexManager(); > this.nonChainingJars = loadNonChainingJarsCache(); > } >+ >+ String includeContainerReferencedLib = System.getProperty(RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS); >+ if ("true".equalsIgnoreCase(includeContainerReferencedLib)) { //$NON-NLS-1$ >+ this.resolveReferencedLibrariesForContainers = true; >+ } > } > > /** >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.432 >diff -u -r1.432 JavaProject.java >--- model/org/eclipse/jdt/internal/core/JavaProject.java 20 Apr 2010 08:57:43 -0000 1.432 >+++ model/org/eclipse/jdt/internal/core/JavaProject.java 26 May 2010 17:54:26 -0000 >@@ -2671,8 +2671,17 @@ > if (cEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { > // resolve ".." in library path > cEntry = cEntry.resolvedDotDot(); >- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305037 >- // responsibility of resolving chained (referenced) libraries lies with the container >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965 >+ // Do not resolve if the system attribute is set to false >+ if (resolveChainedLibraries && JavaModelManager.getJavaModelManager().resolveReferencedLibrariesForContainers && 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, false); >+ } >+ } >+ } > } > addToResult(rawEntry, cEntry, result, resolvedEntries, externalFoldersManager, referencedEntriesMap, false); > } >#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.214 >diff -u -r1.214 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 20 Apr 2010 08:57:35 -0000 1.214 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 26 May 2010 17:54:31 -0000 >@@ -6673,5 +6673,79 @@ > JavaCore.removeClasspathVariable("MyVar", null); > } > } >+/** >+ * @bug 313965: Breaking change in classpath container API >+ * Test that when the includeContainerReferencedLib system property is set to true, the referenced libraries >+ * for JARs from containers are resolved. >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965" >+ * @throws Exception >+ */ >+public void testBug313965() throws Exception { >+ try { >+ simulateExit(); >+ // Use the literal attribute and not constant. Attribute once documented is not supposed to change. >+ System.setProperty("resolveReferencedLibrariesForContainers", "true"); >+ simulateRestart(); >+ IJavaProject p = this.createJavaProject("P", new String[] {}, "bin"); >+ addLibrary(p, "lib.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); >+ IClasspathEntry[] classpath = new IClasspathEntry[1]; >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); >+ classpath[0] = JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER")); >+ setClasspath(p, classpath); >+ createFile("/P/lib1.jar", ""); >+ >+ IClasspathEntry[] resolvedClasspath = p.getResolvedClasspath(true); >+ assertClasspathEquals(resolvedClasspath, >+ "/P/lib1.jar[CPE_LIBRARY][K_BINARY][isExported:false]\n" + >+ "/P/lib.jar[CPE_LIBRARY][K_BINARY][isExported:false]"); >+ } finally { >+ deleteProject("P"); >+ ContainerInitializer.setInitializer(null); >+ simulateExit(); >+ System.setProperty("resolveReferencedLibrariesForContainers", ""); >+ simulateRestart(); >+ } >+} >+/** >+ * @bug 313965: Breaking change in classpath container API >+ * Test that when the includeContainerReferencedLib system property is set to false (or default), the referenced libraries >+ * for JARs from containers are NOT resolved or added to the project's classpath. >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965" >+ * @throws Exception >+ */ >+public void testBug313965a() throws Exception { >+ try { >+ // Do not set the includeContainerReferencedLib system property (the default value is false) >+ IJavaProject p = this.createJavaProject("P", new String[] {}, "bin"); >+ addLibrary(p, "lib.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); >+ IClasspathEntry[] classpath = new IClasspathEntry[1]; >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); >+ classpath[0] = JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER")); >+ setClasspath(p, classpath); >+ >+ createFile("/P/lib1.jar", ""); >+ >+ IClasspathEntry[] resolvedClasspath = p.getResolvedClasspath(true); >+ assertClasspathEquals(resolvedClasspath, >+ "/P/lib.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 313965
:
170061
|
170081
|
170086