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 110547 Details for
Bug 244549
JavaCore.create(String handleIdentifier) fails for local variable with parameterized type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
244549.txt (text/plain), 3.44 KB, created by
Jerome Lanneluc
on 2008-08-21 06:14:38 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-08-21 06:14:38 EDT
Size:
3.44 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/LocalVariable.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LocalVariable.java,v >retrieving revision 1.28 >diff -u -r1.28 LocalVariable.java >--- model/org/eclipse/jdt/internal/core/LocalVariable.java 27 Jun 2008 16:03:51 -0000 1.28 >+++ model/org/eclipse/jdt/internal/core/LocalVariable.java 21 Aug 2008 10:13:36 -0000 >@@ -228,7 +228,7 @@ > buff.append(JEM_COUNT); > buff.append(this.nameEnd); > buff.append(JEM_COUNT); >- buff.append(this.typeSignature); >+ escapeMementoName(buff, this.typeSignature); > if (this.occurrenceCount > 1) { > buff.append(JEM_COUNT); > buff.append(this.occurrenceCount); >#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.25 >diff -u -r1.25 MementoTests.java >--- src/org/eclipse/jdt/core/tests/model/MementoTests.java 27 Jun 2008 16:02:38 -0000 1.25 >+++ src/org/eclipse/jdt/core/tests/model/MementoTests.java 21 Aug 2008 10:13:38 -0000 >@@ -470,6 +470,18 @@ > /** > * Tests that a local variable can be persisted and restored using its memento. > */ >+public void testLocalVariableMemento2() throws JavaModelException { >+ IType type = getClassFile("/P/src/p/X.class").getType(); >+ IMethod method = type.getMethod("foo", new String[]{"I"}); >+ >+ ILocalVariable localVar = new LocalVariable((JavaElement)method, "var", 1, 2, 3, 4, "Z", null); >+ assertMemento( >+ "=P/src<p(X.class[X~foo~I@var!1!2!3!4!Z", >+ localVar); >+} >+/** >+ * Tests that a local variable can be persisted and restored using its memento. >+ */ > public void testLocalVariableMemento3() { > IType type = getCompilationUnit("/P/src/p/X.java").getType("X"); > IInitializer initializer = type.getInitializer(1); >@@ -481,15 +493,27 @@ > } > /** > * Tests that a local variable can be persisted and restored using its memento. >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=244549 ) > */ >-public void testLocalVariableMemento2() throws JavaModelException { >- IType type = getClassFile("/P/src/p/X.class").getType(); >- IMethod method = type.getMethod("foo", new String[]{"I"}); >- >- ILocalVariable localVar = new LocalVariable((JavaElement)method, "var", 1, 2, 3, 4, "Z", null); >- assertMemento( >- "=P/src<p(X.class[X~foo~I@var!1!2!3!4!Z", >- localVar); >+public void testLocalVariableMemento4() throws Exception { >+ try { >+ createJavaProject("P1", new String[] {"src"}, new String[] {getExternalJCLPathString("1.5")}, "bin", "1.5"); >+ createFile( >+ "/P1/src/X.java", >+ "public class X<T> {\n" + >+ " void foo() {\n" + >+ " X<String> var = null;\n" + >+ " }\n" + >+ "}" >+ ); >+ ILocalVariable localVar = getLocalVariable(getCompilationUnit("/P1/src/X.java"), "var", "var"); >+ String memento = localVar.getHandleIdentifier(); >+ IJavaElement restored = JavaCore.create(memento); >+ String restoredMemento = restored.getHandleIdentifier(); >+ assertEquals("Unexpected restored memento", memento, restoredMemento); >+ } finally { >+ deleteProject("P1"); >+ } > } > /** > * Tests that a package declaration can be persisted and restored using its memento.
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 244549
: 110547