diff options
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 49ae57567..78e3488d4 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 b8aae4412..fcb5d4e64 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 000000000..b3a3648a1 --- /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 29327ef7f..94288c85c 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; |