### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.core
Index: model/org/eclipse/jdt/core/JavaCore.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v
retrieving revision 1.614
diff -u -r1.614 JavaCore.java
--- model/org/eclipse/jdt/core/JavaCore.java 28 Apr 2008 19:45:56 -0000 1.614
+++ model/org/eclipse/jdt/core/JavaCore.java 15 May 2008 13:16:12 -0000
@@ -2335,13 +2335,13 @@
* Returns the Java model element corresponding to the given handle identifier
* generated by IJavaElement.getHandleIdentifier()
, or
* null
if unable to create the associated element.
- * If the returned Java element is an ICompilationUnit
, its owner
- * is the given owner if such a working copy exists, otherwise the compilation unit
- * is a primary compilation unit.
+ * If the returned Java element is an ICompilationUnit
or an element
+ * inside a compilation unit, the compilation unit's owner is the given owner if such a
+ * working copy exists, otherwise the compilation unit is a primary compilation unit.
*
* @param handleIdentifier the given handle identifier
* @param owner the owner of the returned compilation unit, ignored if the returned
- * element is not a compilation unit
+ * element is not a compilation unit, or an element inside a compilation unit
* @return the Java element corresponding to the handle identifier
* @since 3.0
*/
@@ -2349,6 +2349,8 @@
if (handleIdentifier == null) {
return null;
}
+ if (owner == null)
+ owner = DefaultWorkingCopyOwner.PRIMARY;
MementoTokenizer memento = new MementoTokenizer(handleIdentifier);
JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
return model.getHandleFromMemento(memento, owner);
#P org.eclipse.jdt.core.tests.model
Index: src/org/eclipse/jdt/core/tests/model/MementoTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java,v
retrieving revision 1.22
diff -u -r1.22 MementoTests.java
--- src/org/eclipse/jdt/core/tests/model/MementoTests.java 24 Oct 2007 13:50:40 -0000 1.22
+++ src/org/eclipse/jdt/core/tests/model/MementoTests.java 15 May 2008 13:16:14 -0000
@@ -267,7 +267,7 @@
/**
* Tests that a compilation unit can be persisted and restored using its memento.
*/
-public void testCompilationUnitMemento() {
+public void testCompilationUnitMemento1() {
ICompilationUnit cu = getCompilationUnit("/P/src/p/X.java");
assertMemento(
"=P/src