Skip to content
Open
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
25 changes: 25 additions & 0 deletions org.eclipse.jdt.debug.tests/java7/Issue693.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Issue693 {
static class Generic<U extends Number> {

private U u;

public Generic(U u) {
this.u = u;
}

void test(Generic<U> generic) {
System.out.println("tested " + this);
}
}

public static void main(String[] args) {
Generic<Integer> generic = new Generic<>(5);
generic.test(generic);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@

import com.sun.jdi.InternalException;
import com.sun.jdi.InvocationException;

import junit.framework.TestCase;

/**
Expand Down Expand Up @@ -446,6 +445,7 @@ synchronized void assert17Project() {
cfgs.add(createLaunchConfiguration(jp, "Bug567801"));
cfgs.add(createLaunchConfiguration(jp, "Bug572782"));
cfgs.add(createLaunchConfiguration(jp, "Bug576829"));
cfgs.add(createLaunchConfiguration(jp, "Issue693"));
loaded17 = true;
waitForBuild();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ public void testEvaluate_Bug576829_RecursiveMultipleGenerics_ObjectInstanceEvalu
assertEquals("value is not false", "false", value.getValueString());
}

public void testEvaluate_Issue693() throws Exception {
createConditionalLineBreakpoint(17, "Issue693", "generic.u.intValue() == 5", true);
javaThread = launchToBreakpoint("Issue693");
assertNotNull("The program did not suspend", javaThread);

String snippet = "generic.u.intValue()";
IValue value = doEval(javaThread, snippet);

assertNotNull("value is null", value);
assertEquals("value is not 5", "5", value.getValueString());
}

private void debugWithBreakpoint(String testClass, int lineNumber) throws Exception {
createLineBreakpoint(lineNumber, testClass);
javaThread = launchToBreakpoint(testClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,11 @@ private void scanAndFixSignature(String genericSignature, String erasureSignatur
* and also generic signature such as Ljava/util/function/Predicate<+Ljava/util/List<Ljava/lang/Integer;>;>; Ljava/util/Comparator<-TT;>;
* which will fail to properly resolved to the type.
*/
if (genericSignature.startsWith(String.valueOf(Signature.C_TYPE_VARIABLE)) || genericSignature.startsWith(String.valueOf(Signature.C_CAPTURE))
if (genericSignature.startsWith(String.valueOf(Signature.C_TYPE_VARIABLE))) {
fixedSignature.append(genericSignature.substring(String.valueOf(Signature.C_TYPE_VARIABLE).length(), genericSignature.length() - 1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you provide the value you get in the generic signature with your test case which you provided this fix for ?

return;
}
if (genericSignature.startsWith(String.valueOf(Signature.C_CAPTURE))
|| genericSignature.startsWith(String.valueOf(Signature.C_SUPER))) {
fixedSignature.append(toDotQualified(erasureSignature));
return;
Expand Down