Bug 341232 - Eclipse is not able to set the simplest of - remainder of
the tests + test class cleanup
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
index 122b0a9..a228b948 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
@@ -74,6 +74,7 @@
import org.eclipse.jdt.debug.tests.core.WatchExpressionTests;
import org.eclipse.jdt.debug.tests.core.WorkingDirectoryTests;
import org.eclipse.jdt.debug.tests.core.WorkspaceSourceContainerTests;
+import org.eclipse.jdt.debug.tests.eval.GenericsEvalTests;
import org.eclipse.jdt.debug.tests.launching.ConfigurationEncodingTests;
import org.eclipse.jdt.debug.tests.launching.ConfigurationResourceMappingTests;
import org.eclipse.jdt.debug.tests.launching.ContributedTabTests;
@@ -184,6 +185,7 @@
addTest(new TestSuite(TestIntegerAccessUnboxing15.class));
addTest(new TestSuite(StepIntoSelectionWithGenerics.class));
addTest(new TestSuite(ConditionalBreakpointsWithGenerics.class));
+ addTest(new TestSuite(GenericsEvalTests.class));
}
//Sourcelookup tests
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithGenerics.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithGenerics.java
index 0ce22eb..0527bdc 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithGenerics.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithGenerics.java
@@ -12,8 +12,8 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.breakpoints;
+import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
import org.eclipse.jdt.debug.core.IJavaThread;
import org.eclipse.jdt.debug.tests.AbstractDebugTest;
@@ -48,19 +48,13 @@
public void testDuplicateGenericTypes() throws Exception {
String typeName = "a.b.c.ConditionalsNearGenerics";
String innerTypeName = "a.b.c.ConditionalsNearGenerics.ItemIterator";
- IJavaLineBreakpoint bp1 = createConditionalLineBreakpoint(33, typeName, "false", true);
- IJavaLineBreakpoint bp2 = createConditionalLineBreakpoint(39, typeName, "false", true);
- IJavaLineBreakpoint bp3 = createConditionalLineBreakpoint(52, innerTypeName, "false", true);
- IJavaLineBreakpoint bp4 = createConditionalLineBreakpoint(53, innerTypeName, "true", true);
+ createConditionalLineBreakpoint(33, typeName, "false", true);
+ createConditionalLineBreakpoint(44, typeName, "false", true);
+ ILineBreakpoint bp = createConditionalLineBreakpoint(56, innerTypeName, "true", true);
IJavaThread thread= null;
try {
- thread= launchToLineBreakpoint(typeName, bp4); // If compiled correctly, this will jump over bp1-bp3 !!
-
- bp1.delete();
- bp2.delete();
- bp3.delete();
- bp4.delete();
+ thread= launchToLineBreakpoint(typeName, bp); // If compiled correctly, this will jump over bp1-bp3 !!
} finally {
terminateAndRemove(thread);
removeAllBreakpoints();
@@ -208,7 +202,7 @@
try {
String condition = "Iterator<Integer> i = tokenize(Arrays.asList(1, 2, 3), \"condition\");\n"+
"return i.hasNext();";
- createConditionalLineBreakpoint(34, type, condition, true);
+ createConditionalLineBreakpoint(33, type, condition, true);
thread = launchToBreakpoint(type);
assertNotNull("Breakpoint not hit within timeout period", thread);
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/SnippetsWithGenericsEvalTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/GenericsEvalTests.java
similarity index 66%
rename from org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/SnippetsWithGenericsEvalTests.java
rename to org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/GenericsEvalTests.java
index 87a2bc0..2ed3972 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/SnippetsWithGenericsEvalTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/GenericsEvalTests.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.eval;
+import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.debug.core.IJavaThread;
import org.eclipse.jdt.debug.tests.AbstractDebugTest;
@@ -19,12 +20,12 @@
*
* @since 3.8
*/
-public class SnippetsWithGenericsEvalTests extends AbstractDebugTest {
+public class GenericsEvalTests extends AbstractDebugTest {
/**
* @param name
*/
- public SnippetsWithGenericsEvalTests(String name) {
+ public GenericsEvalTests(String name) {
super(name);
}
@@ -178,4 +179,86 @@
terminateAndRemove(thread);
}
}
+
+ public void testEvalGenerics9() throws Exception {
+ IJavaThread thread = null;
+ try {
+ String type = "a.b.c.ConditionalsNearGenerics";
+ createLineBreakpoint(32, type);
+ thread = launchToBreakpoint(type);
+ assertNotNull("The program did not suspend", thread);
+ String snippet = "char[] chars = name.toCharArray();";
+ doEval(thread, snippet);
+ }
+ finally {
+ removeAllBreakpoints();
+ terminateAndRemove(thread);
+ }
+ }
+
+ public void testEvalGeneric10() throws Exception {
+ IJavaThread thread = null;
+ try {
+ String type = "a.b.c.ConditionalsNearGenerics";
+ createLineBreakpoint(33, type);
+ thread = launchToBreakpoint(type);
+ assertNotNull("The program did not suspend", thread);
+ String snippet = "tokenize(Arrays.asList(1,2,3), name)";
+ doEval(thread, snippet);
+ }
+ finally {
+ removeAllBreakpoints();
+ terminateAndRemove(thread);
+ }
+ }
+
+ public void testEvalGeneric11() throws Exception {
+ IJavaThread thread = null;
+ try {
+ String type = "a.b.c.ConditionalsNearGenerics";
+ createLineBreakpoint(44, type);
+ thread = launchToBreakpoint(type);
+ assertNotNull("The program did not suspend", thread);
+ String snippet = "list.iterator()";
+ doEval(thread, snippet);
+ }
+ finally {
+ removeAllBreakpoints();
+ terminateAndRemove(thread);
+ }
+ }
+
+ public void testEvalGeneric12() throws Exception {
+ IJavaThread thread = null;
+ try {
+ String type = "a.b.c.ConditionalsNearGenerics";
+ ILineBreakpoint bp = createLineBreakpoint(56, type);
+ assertTrue("The breakpoint on line 56 must exist", bp.getMarker().exists());
+ thread = launchToBreakpoint(type);
+ assertNotNull("The program did not suspend", thread);
+ String snippet = "this.input";
+ doEval(thread, snippet);
+ }
+ finally {
+ removeAllBreakpoints();
+ terminateAndRemove(thread);
+ }
+ }
+
+ public void testEvalGeneric13() throws Exception {
+ IJavaThread thread = null;
+ try {
+ String type = "a.b.c.ConditionalsNearGenerics";
+ ILineBreakpoint bp = createLineBreakpoint(64, type);
+ assertTrue("The breakpoint on line 64 must exist", bp.getMarker().exists());
+ thread = launchToBreakpoint(type);
+ assertNotNull("The program did not suspend", thread);
+ String snippet = "this.input";
+ doEval(thread, snippet);
+ }
+ finally {
+ removeAllBreakpoints();
+ terminateAndRemove(thread);
+ }
+ }
}
diff --git a/org.eclipse.jdt.debug.tests/testsource-j2se-1.5/a/b/c/ConditionalsNearGenerics.java b/org.eclipse.jdt.debug.tests/testsource-j2se-1.5/a/b/c/ConditionalsNearGenerics.java
index 93565a0..68c347a 100644
--- a/org.eclipse.jdt.debug.tests/testsource-j2se-1.5/a/b/c/ConditionalsNearGenerics.java
+++ b/org.eclipse.jdt.debug.tests/testsource-j2se-1.5/a/b/c/ConditionalsNearGenerics.java
@@ -14,7 +14,7 @@
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
-
+@SuppressWarnings("unused")
public class ConditionalsNearGenerics {
private String name;
@@ -30,13 +30,17 @@
public void bug() throws Exception {
char[] chars = name.toCharArray();
- System.out.println(chars);
- tokenize(Arrays.asList(1,2,3), name);
+ Iterator<Integer> iter = tokenize(Arrays.asList(1,2,3), name);
+ while (iter.hasNext()) {
+ Integer number = iter.next();
+ }
}
- //FIXME delete following method, then the breakpoint shall work
public <T extends Number> Iterator<T> tokenize(List<T> list, String input) {
- new ItemIterator<Item>(input);
+ ItemIterator<Item> ii = new ItemIterator<Item>(input);
+ if(ii.hasNext()) {
+ ii.next();
+ }
return list.iterator();
}
@@ -50,22 +54,17 @@
public ItemIterator(String input) {
this.input = input;
- System.out.println("From ItemIterator!");
}
- @Override
public boolean hasNext() {
- return false;
+ return true;
}
- @Override
public T next() {
return null;
}
- @Override
public void remove() {
}
-
}
}
\ No newline at end of file