aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2014-03-26 14:26:55 (EDT)
committerMike Rennie2014-03-26 14:26:55 (EDT)
commitc68ddea8969bd46d6a2306e29f730c15722e084e (patch)
tree7e2248b3ad8d8f7140c43b55a58e11216612c753
parent4f76d09c269d1338b0f6b734d0436bf394291863 (diff)
downloadeclipse.jdt.debug-c68ddea8969bd46d6a2306e29f730c15722e084e.zip
eclipse.jdt.debug-c68ddea8969bd46d6a2306e29f730c15722e084e.tar.gz
eclipse.jdt.debug-c68ddea8969bd46d6a2306e29f730c15722e084e.tar.bz2
Bug 430902 - Method breakpoint not working on generic method with
generic array argument Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java1
-rw-r--r--org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests15.java48
-rw-r--r--org.eclipse.jdt.debug.tests/testsource-j2se-1.5/a/b/c/GenericMethodEntryTest.java39
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java2
4 files changed, 87 insertions, 3 deletions
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index 49ae575..78e3488 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -392,6 +392,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
cfgs.add(createLaunchConfiguration(jp, "a.b.c.ConditionalsNearGenerics"));
cfgs.add(createLaunchConfiguration(jp, "a.b.c.bug329294WithGenerics"));
cfgs.add(createLaunchConfiguration(jp, "a.b.c.bug403028"));
+ cfgs.add(createLaunchConfiguration(jp, "a.b.c.GenericMethodEntryTest"));
loaded15 = true;
waitForBuild();
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests15.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests15.java
index b8aae44..fcb5d4e 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests15.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests15.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.breakpoints;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.debug.core.model.IBreakpoint;
@@ -85,5 +88,46 @@ public class MethodBreakpointTests15 extends AbstractDebugTest {
removeAllBreakpoints();
}
}
-
+
+ /**
+ * @throws Exception
+ */
+ public void testGenericArrayEntryBreakpoints() throws Exception {
+ String typeName = "a.b.c.GenericMethodEntryTest";
+ List<IJavaMethodBreakpoint> bps = new ArrayList<IJavaMethodBreakpoint>();
+ // func(T[] arr, int m, int n) - entry
+ bps.add(createMethodBreakpoint(typeName, "func", "([Ljava/lang/Comparable;II)I", true, false));
+ // func(int m, int n)
+ bps.add(createMethodBreakpoint(typeName, "func", "(II)I", true, false));
+ // func(T t, int m, int n)
+ bps.add(createMethodBreakpoint(typeName, "func", "(Ljava/lang/Comparable;II)I", true, false));
+ IJavaThread thread = null;
+ try {
+ thread = launchToBreakpoint(typeName);
+ assertNotNull("Breakpoint not hit within timeout period", thread);
+
+ IBreakpoint hit = getBreakpoint(thread);
+ assertNotNull("suspended, but not by breakpoint", hit);
+ assertEquals("should hit entry breakpoint first", bps.get(0), hit);
+
+ // onto the next breakpoint
+
+ thread = resume(thread);
+ hit = getBreakpoint(thread);
+ assertNotNull("suspended, but not by breakpoint", hit);
+ assertEquals("should hit exit breakpoint second", bps.get(1), hit);
+
+ // onto the next breakpoint
+
+ thread = resume(thread);
+ hit = getBreakpoint(thread);
+ assertNotNull("suspended, but not by breakpoint", hit);
+ assertEquals("should hit exit breakpoint second", bps.get(2), hit);
+
+ }
+ finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
} \ No newline at end of file
diff --git a/org.eclipse.jdt.debug.tests/testsource-j2se-1.5/a/b/c/GenericMethodEntryTest.java b/org.eclipse.jdt.debug.tests/testsource-j2se-1.5/a/b/c/GenericMethodEntryTest.java
new file mode 100644
index 0000000..b3a3648
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/testsource-j2se-1.5/a/b/c/GenericMethodEntryTest.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package a.b.c;
+public class GenericMethodEntryTest {
+
+ public static <T extends Comparable<T>> int func(T[] arr, int m, int n) { // method breakpoint on func(T[],int,int)
+ int i = 0;
+ ++i;
+ return i;
+ }
+
+ public static <T extends Comparable<T>> int func(int m, int n) { // method breakpoint on func(int,int)
+ int i = 0;
+ ++i;
+ return i;
+ }
+
+ public static <T extends Comparable<T>> int func(T t, int m, int n) { // method breakpoint on func(int,int)
+ int i = 0;
+ ++i;
+ return i;
+ }
+
+ public static void main(String[] args) {
+ String[] ss = new String[]{"a","b"};
+ func(ss, 1, 2); // should hit in func(T[],int,int)
+ func(1, 2); // hits in func(int,int)
+ func("s", 1, 2); // hits in func(T,int,int)
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
index 29327ef..94288c8 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
@@ -1023,7 +1023,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtensio
return "Ljava/lang/Object;"; //$NON-NLS-1$
}
String bound = Signature.createTypeSignature(bounds[0], false);
- return resolveTypeSignature(method, bound);
+ return Signature.createArraySignature(resolveTypeSignature(method, bound), count);
}
// the type name cannot be resolved
return null;