Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ private Location findMethodLocaiton(ReferenceType refType, String methodName, St
for (Method method : methods) {
if (!method.isAbstract() && !method.isNative()
&& methodName.equals(method.name())
&& (methodSiguature.equals(method.genericSignature()) || methodSiguature.equals(method.signature()))) {
&& (methodSiguature.equals(method.genericSignature()) || methodSiguature.equals(method.signature())
|| toNoneGeneric(methodSiguature).equals(method.signature()))) {
location = method.location();
break;
}
Expand All @@ -334,6 +335,28 @@ private Location findMethodLocaiton(ReferenceType refType, String methodName, St
return location;
}

static String toNoneGeneric(String genericSig) {
StringBuilder builder = new StringBuilder();
boolean append = true;
int depth = 0;
char[] chars = genericSig.toCharArray();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if (c == '<') {
depth++;
append = (depth == 0);
}
if (append) {
builder.append(c);
}
if (c == '>') {
depth--;
append = (depth == 0);
}
}
return builder.toString();
}

private List<Location> findLocaitonsOfLine(Method method, int lineNumber) {
try {
return method.locationsOfLine(lineNumber);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.microsoft.java.debug.core;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class BreakpointTest {
@Test
public void testToNoneGeneric() {
assertEquals("Ljava.util.List;", Breakpoint.toNoneGeneric("Ljava.util.List<java.lang.String;>;"));
assertEquals("(Ljava/util/Map;)Ljava/util/Map;", Breakpoint.toNoneGeneric(
"(Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/Integer;>;>;)Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/Integer;>;>;"));
assertEquals("(Ljava/util/Map;)Ljava/util/Map;",
Breakpoint.toNoneGeneric(
"(Ljava/util/Map<Ljava/util/List<Ljava/lang/Integer;>;Ljava/util/List<Ljava/lang/Integer;>;>;)Ljava/util/Map<Ljava/util/List<Ljava/lang/Integer;>;Ljava/util/List<Ljava/lang/Integer;>;>;"));
}
}