Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanuel Graf2009-09-07 08:02:16 -0400
committerEmanuel Graf2009-09-07 08:02:16 -0400
commite5cac49c11893237e676711a0b7f5fa6e7415bf0 (patch)
tree23b3e349742e6f3b1a3e17acab2387f3788a10aa
parentcf5583999059ac2e86ec748e8066d7ff787493da (diff)
downloadorg.eclipse.cdt-e5cac49c11893237e676711a0b7f5fa6e7415bf0.tar.gz
org.eclipse.cdt-e5cac49c11893237e676711a0b7f5fa6e7415bf0.tar.xz
org.eclipse.cdt-e5cac49c11893237e676711a0b7f5fa6e7415bf0.zip
FIXED - bug 288736: Source->Implement Method goes into an infinite loop for methods which have a templated parameter with no name
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288736
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/PseudoNameGeneratorTest.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java3
2 files changed, 7 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/PseudoNameGeneratorTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/PseudoNameGeneratorTest.java
index 6e6a649076..cc8644dbe5 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/PseudoNameGeneratorTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/PseudoNameGeneratorTest.java
@@ -60,4 +60,8 @@ public class PseudoNameGeneratorTest extends TestCase {
public void testWithNamespace() {
assertEquals("string", pseudoNameGenerator.generateNewName("std::string")); //$NON-NLS-1$//$NON-NLS-2$
}
+
+ public void testBug288736TemplateParam() {
+ assertEquals("tempClass", pseudoNameGenerator.generateNewName("tempClass<int>"));
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java
index 6364253c4d..8e744aa8bc 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java
@@ -32,6 +32,9 @@ public class PseudoNameGenerator {
String[] nameParts = typeName.split("::"); //$NON-NLS-1$
typeName = nameParts[nameParts.length - 1];
+ if(typeName.contains("<")) { //$NON-NLS-1$
+ typeName = typeName.substring(0, typeName.indexOf('<'));
+ }
if(typeName.length() != 0) {
typeName = typeName.substring(0, 1).toLowerCase() + typeName.substring(1);
}

Back to the top